From 13287d43674ffcc502e149df606015597a683a79 Mon Sep 17 00:00:00 2001 From: "Andrew X. Shah" Date: Sun, 17 Dec 2023 17:52:20 -0700 Subject: [PATCH] fix(linalg/decomposition): rm assertion for check --- src/linalg/tensor/decomposition.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/linalg/tensor/decomposition.rs b/src/linalg/tensor/decomposition.rs index c731fb9..921833b 100644 --- a/src/linalg/tensor/decomposition.rs +++ b/src/linalg/tensor/decomposition.rs @@ -1,7 +1,9 @@ use crate::Tensor; impl Tensor { - /// Returns the Cholesky decomposition of the tensor. + /// Cholesky decomposition of a symmetric, positive-definite matrix. + /// Returns the product of the lower triangular matrix and its conjugate transpose. + /// Returns None if the input matrix is not not square or positive-definite. /// /// # Examples /// ``` @@ -11,7 +13,9 @@ impl Tensor { /// assert_eq!(t2, tensor![[2.0, 0.0, 0.0], [6.0, 1.0, 0.0], [-8.0, 5.0, 3.0]]); /// ``` pub fn cholesky(&self) -> Option { - self.validate_square("cholesky"); + if !self.is_square() { + return None; + } let mut result = Tensor::zeros(self.rows, self.cols);