Allow constructing Cholesky struct directly

This is useful if there the data for the matrix comes from elsewhere,
such as a custom algorithm. One such use-case can be seen
https://github.com/nestordemeure/friedrich/issues/43 where we do special
handling for the try_sqrt or is_zero cases that would normally fail the
decomposition in `Cholesky::new()`.
This commit is contained in:
Mateusz Kowalczyk 2021-08-30 11:09:53 +09:00
parent 80c7064bf4
commit a4c2ca941d
No known key found for this signature in database
GPG Key ID: 2CFE145ADE8C2E62

View File

@ -74,6 +74,14 @@ where
Cholesky { chol: matrix }
}
/// Uses the given matrix as-is without any checks or modifications as the
/// Cholesky decomposition.
///
/// It is up to the user to ensure all invariants hold.
pub fn pack_dirty(matrix: OMatrix<T, D, D>) -> Self {
Cholesky { chol: matrix }
}
/// Retrieves the lower-triangular factor of the Cholesky decomposition with its strictly
/// upper-triangular part filled with zeros.
pub fn unpack(mut self) -> OMatrix<T, D, D> {