CscCholesky

Struct CscCholesky 

Source
pub struct CscCholesky<T> { /* private fields */ }
Expand description

A sparse Cholesky factorization A = L L^T of a CscMatrix.

The factor L is a sparse, lower-triangular matrix. See the article on Wikipedia for more information.

The implementation is a port of the CsCholesky implementation in nalgebra. It is similar to Tim Davis’ CSparse. The current implementation performs no fill-in reduction, and can therefore be expected to produce much too dense Cholesky factors for many matrices. It is therefore not currently recommended to use this implementation for serious projects.

Implementations§

Source§

impl<T: RealField> CscCholesky<T>

Source

pub fn factor_numerical( symbolic: CscSymbolicCholesky, values: &[T], ) -> Result<Self, CholeskyError>

Computes the numerical Cholesky factorization associated with the given symbolic factorization and the provided values.

The values correspond to the non-zero values of the CSC matrix for which the symbolic factorization was computed.

§Errors

Returns an error if the numerical factorization fails. This can occur if the matrix is not symmetric positive definite.

§Panics

Panics if the number of values differ from the number of non-zeros of the sparsity pattern of the matrix that was symbolically factored.

Source

pub fn factor(matrix: &CscMatrix<T>) -> Result<Self, CholeskyError>

Computes the Cholesky factorization of the provided matrix.

The matrix must be symmetric positive definite. Symmetry is not checked, and it is up to the user to enforce this property.

§Errors

Returns an error if the numerical factorization fails. This can occur if the matrix is not symmetric positive definite.

§Panics

Panics if the matrix is not square.

Source

pub fn refactor(&mut self, values: &[T]) -> Result<(), CholeskyError>

Re-computes the factorization for a new set of non-zero values.

This is useful when the values of a matrix changes, but the sparsity pattern remains constant.

§Errors

Returns an error if the numerical factorization fails. This can occur if the matrix is not symmetric positive definite.

§Panics

Panics if the number of values does not match the number of non-zeros in the sparsity pattern.

Source

pub fn l(&self) -> &CscMatrix<T>

Returns a reference to the Cholesky factor L.

Source

pub fn take_l(self) -> CscMatrix<T>

Returns the Cholesky factor L.

Source

pub fn solve<'a>(&'a self, b: impl Into<DMatrixView<'a, T>>) -> DMatrix<T>

Solves the system A X = B, where X and B are dense matrices.

§Panics

Panics if B is not square.

Source

pub fn solve_mut<'a>(&'a self, b: impl Into<DMatrixViewMut<'a, T>>)

Solves the system AX = B, where X and B are dense matrices.

The result is stored in-place in b.

§Panics

Panics if b is not square.

Trait Implementations§

Source§

impl<T: Clone> Clone for CscCholesky<T>

Source§

fn clone(&self) -> CscCholesky<T>

Returns a duplicate of the value. Read more
1.0.0§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<T: Debug> Debug for CscCholesky<T>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<T> Freeze for CscCholesky<T>

§

impl<T> RefUnwindSafe for CscCholesky<T>
where T: RefUnwindSafe,

§

impl<T> Send for CscCholesky<T>
where T: Send,

§

impl<T> Sync for CscCholesky<T>
where T: Sync,

§

impl<T> Unpin for CscCholesky<T>
where T: Unpin,

§

impl<T> UnwindSafe for CscCholesky<T>
where T: UnwindSafe,

Blanket Implementations§

§

impl<T> Any for T
where T: 'static + ?Sized,

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> Borrow<T> for T
where T: ?Sized,

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

impl<T> BorrowMut<T> for T
where T: ?Sized,

§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> CloneToUninit for T
where T: Clone,

§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T, U> Into<U> for T
where U: From<T>,

§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

Source§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
Source§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
Source§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
Source§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V