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:
parent
80c7064bf4
commit
a4c2ca941d
|
@ -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> {
|
||||
|
|
Loading…
Reference in New Issue