Skip to content

Commit

Permalink
fix(linalg/decomposition): rm assertion for check
Browse files Browse the repository at this point in the history
  • Loading branch information
drewxs committed Dec 18, 2023
1 parent 10068b7 commit 13287d4
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/linalg/tensor/decomposition.rs
Original file line number Diff line number Diff line change
@@ -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
/// ```
Expand All @@ -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> {
self.validate_square("cholesky");
if !self.is_square() {
return None;
}

let mut result = Tensor::zeros(self.rows, self.cols);

Expand Down

0 comments on commit 13287d4

Please sign in to comment.