pub struct Cholesky<T, D>where
T: SimdComplexField,
D: Dim,
DefaultAllocator: Allocator<T, D, D>,{ /* private fields */ }
Expand description
The Cholesky decomposition of a symmetric-definite-positive matrix.
Implementations§
source§impl<T, D> Cholesky<T, D>where
T: SimdComplexField,
D: Dim,
DefaultAllocator: Allocator<T, D, D>,
impl<T, D> Cholesky<T, D>where T: SimdComplexField, D: Dim, DefaultAllocator: Allocator<T, D, D>,
sourcepub fn new_unchecked(
matrix: Matrix<T, D, D, <DefaultAllocator as Allocator<T, D, D>>::Buffer>
) -> Cholesky<T, D>
pub fn new_unchecked( matrix: Matrix<T, D, D, <DefaultAllocator as Allocator<T, D, D>>::Buffer> ) -> Cholesky<T, D>
Computes the Cholesky decomposition of matrix
without checking that the matrix is definite-positive.
If the input matrix is not definite-positive, the decomposition may contain trash values (Inf, NaN, etc.)
sourcepub fn unpack(
self
) -> Matrix<T, D, D, <DefaultAllocator as Allocator<T, D, D>>::Buffer>
pub fn unpack( self ) -> Matrix<T, D, D, <DefaultAllocator as Allocator<T, D, D>>::Buffer>
Retrieves the lower-triangular factor of the Cholesky decomposition with its strictly upper-triangular part filled with zeros.
sourcepub fn unpack_dirty(
self
) -> Matrix<T, D, D, <DefaultAllocator as Allocator<T, D, D>>::Buffer>
pub fn unpack_dirty( self ) -> Matrix<T, D, D, <DefaultAllocator as Allocator<T, D, D>>::Buffer>
Retrieves the lower-triangular factor of the Cholesky decomposition, without zeroing-out its strict upper-triangular part.
The values of the strict upper-triangular part are garbage and should be ignored by further computations.
sourcepub fn l(
&self
) -> Matrix<T, D, D, <DefaultAllocator as Allocator<T, D, D>>::Buffer>
pub fn l( &self ) -> Matrix<T, D, D, <DefaultAllocator as Allocator<T, D, D>>::Buffer>
Retrieves the lower-triangular factor of the Cholesky decomposition with its strictly uppen-triangular part filled with zeros.
sourcepub fn l_dirty(
&self
) -> &Matrix<T, D, D, <DefaultAllocator as Allocator<T, D, D>>::Buffer>
pub fn l_dirty( &self ) -> &Matrix<T, D, D, <DefaultAllocator as Allocator<T, D, D>>::Buffer>
Retrieves the lower-triangular factor of the Cholesky decomposition, without zeroing-out its strict upper-triangular part.
This is an allocation-less version of self.l()
. The values of the strict upper-triangular
part are garbage and should be ignored by further computations.
sourcepub fn solve_mut<R2, C2, S2>(&self, b: &mut Matrix<T, R2, C2, S2>)where
R2: Dim,
C2: Dim,
S2: StorageMut<T, R2, C2>,
ShapeConstraint: SameNumberOfRows<R2, D>,
pub fn solve_mut<R2, C2, S2>(&self, b: &mut Matrix<T, R2, C2, S2>)where R2: Dim, C2: Dim, S2: StorageMut<T, R2, C2>, ShapeConstraint: SameNumberOfRows<R2, D>,
Solves the system self * x = b
where self
is the decomposed matrix and x
the unknown.
The result is stored on b
.
sourcepub fn solve<R2, C2, S2>(
&self,
b: &Matrix<T, R2, C2, S2>
) -> Matrix<T, R2, C2, <DefaultAllocator as Allocator<T, R2, C2>>::Buffer>where
R2: Dim,
C2: Dim,
S2: Storage<T, R2, C2>,
DefaultAllocator: Allocator<T, R2, C2>,
ShapeConstraint: SameNumberOfRows<R2, D>,
pub fn solve<R2, C2, S2>( &self, b: &Matrix<T, R2, C2, S2> ) -> Matrix<T, R2, C2, <DefaultAllocator as Allocator<T, R2, C2>>::Buffer>where R2: Dim, C2: Dim, S2: Storage<T, R2, C2>, DefaultAllocator: Allocator<T, R2, C2>, ShapeConstraint: SameNumberOfRows<R2, D>,
Returns the solution of the system self * x = b
where self
is the decomposed matrix and
x
the unknown.
sourcepub fn inverse(
&self
) -> Matrix<T, D, D, <DefaultAllocator as Allocator<T, D, D>>::Buffer>
pub fn inverse( &self ) -> Matrix<T, D, D, <DefaultAllocator as Allocator<T, D, D>>::Buffer>
Computes the inverse of the decomposed matrix.
sourcepub fn determinant(&self) -> <T as SimdComplexField>::SimdRealField
pub fn determinant(&self) -> <T as SimdComplexField>::SimdRealField
Computes the determinant of the decomposed matrix.
source§impl<T, D> Cholesky<T, D>where
T: ComplexField,
D: Dim,
DefaultAllocator: Allocator<T, D, D>,
impl<T, D> Cholesky<T, D>where T: ComplexField, D: Dim, DefaultAllocator: Allocator<T, D, D>,
sourcepub fn new(
matrix: Matrix<T, D, D, <DefaultAllocator as Allocator<T, D, D>>::Buffer>
) -> Option<Cholesky<T, D>>
pub fn new( matrix: Matrix<T, D, D, <DefaultAllocator as Allocator<T, D, D>>::Buffer> ) -> Option<Cholesky<T, D>>
Attempts to compute the Cholesky decomposition of matrix
.
Returns None
if the input matrix is not definite-positive. The input matrix is assumed
to be symmetric and only the lower-triangular part is read.
sourcepub fn rank_one_update<R2, S2>(
&mut self,
x: &Matrix<T, R2, Const<1>, S2>,
sigma: <T as ComplexField>::RealField
)where
R2: Dim,
S2: Storage<T, R2, Const<1>>,
DefaultAllocator: Allocator<T, R2, Const<1>>,
ShapeConstraint: SameNumberOfRows<R2, D>,
pub fn rank_one_update<R2, S2>( &mut self, x: &Matrix<T, R2, Const<1>, S2>, sigma: <T as ComplexField>::RealField )where R2: Dim, S2: Storage<T, R2, Const<1>>, DefaultAllocator: Allocator<T, R2, Const<1>>, ShapeConstraint: SameNumberOfRows<R2, D>,
Given the Cholesky decomposition of a matrix M
, a scalar sigma
and a vector v
,
performs a rank one update such that we end up with the decomposition of M + sigma * (v * v.adjoint())
.
sourcepub fn insert_column<R2, S2>(
&self,
j: usize,
col: Matrix<T, R2, Const<1>, S2>
) -> Cholesky<T, <D as DimAdd<Const<1>>>::Output>where
D: DimAdd<Const<1>>,
R2: Dim,
S2: Storage<T, R2, Const<1>>,
DefaultAllocator: Allocator<T, <D as DimAdd<Const<1>>>::Output, <D as DimAdd<Const<1>>>::Output> + Allocator<T, R2, Const<1>>,
ShapeConstraint: SameNumberOfRows<R2, <D as DimAdd<Const<1>>>::Output>,
pub fn insert_column<R2, S2>( &self, j: usize, col: Matrix<T, R2, Const<1>, S2> ) -> Cholesky<T, <D as DimAdd<Const<1>>>::Output>where D: DimAdd<Const<1>>, R2: Dim, S2: Storage<T, R2, Const<1>>, DefaultAllocator: Allocator<T, <D as DimAdd<Const<1>>>::Output, <D as DimAdd<Const<1>>>::Output> + Allocator<T, R2, Const<1>>, ShapeConstraint: SameNumberOfRows<R2, <D as DimAdd<Const<1>>>::Output>,
Updates the decomposition such that we get the decomposition of a matrix with the given column col
in the j
th position.
Since the matrix is square, an identical row will be added in the j
th row.
sourcepub fn remove_column(
&self,
j: usize
) -> Cholesky<T, <D as DimSub<Const<1>>>::Output>where
D: DimSub<Const<1>>,
DefaultAllocator: Allocator<T, <D as DimSub<Const<1>>>::Output, <D as DimSub<Const<1>>>::Output> + Allocator<T, D, Const<1>>,
pub fn remove_column( &self, j: usize ) -> Cholesky<T, <D as DimSub<Const<1>>>::Output>where D: DimSub<Const<1>>, DefaultAllocator: Allocator<T, <D as DimSub<Const<1>>>::Output, <D as DimSub<Const<1>>>::Output> + Allocator<T, D, Const<1>>,
Updates the decomposition such that we get the decomposition of the factored matrix with its j
th column removed.
Since the matrix is square, the j
th row will also be removed.
Trait Implementations§
source§impl<T, D> Clone for Cholesky<T, D>where
T: Clone + SimdComplexField,
D: Clone + Dim,
DefaultAllocator: Allocator<T, D, D>,
impl<T, D> Clone for Cholesky<T, D>where T: Clone + SimdComplexField, D: Clone + Dim, DefaultAllocator: Allocator<T, D, D>,
source§impl<T, D> Debug for Cholesky<T, D>where
T: Debug + SimdComplexField,
D: Debug + Dim,
DefaultAllocator: Allocator<T, D, D>,
impl<T, D> Debug for Cholesky<T, D>where T: Debug + SimdComplexField, D: Debug + Dim, DefaultAllocator: Allocator<T, D, D>,
source§impl<'de, T, D> Deserialize<'de> for Cholesky<T, D>where
T: SimdComplexField,
D: Dim,
DefaultAllocator: Allocator<T, D, D> + Allocator<T, D, Const<1>>,
Matrix<T, D, D, <DefaultAllocator as Allocator<T, D, D>>::Buffer>: Deserialize<'de>,
impl<'de, T, D> Deserialize<'de> for Cholesky<T, D>where T: SimdComplexField, D: Dim, DefaultAllocator: Allocator<T, D, D> + Allocator<T, D, Const<1>>, Matrix<T, D, D, <DefaultAllocator as Allocator<T, D, D>>::Buffer>: Deserialize<'de>,
source§fn deserialize<__D>(
__deserializer: __D
) -> Result<Cholesky<T, D>, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>( __deserializer: __D ) -> Result<Cholesky<T, D>, <__D as Deserializer<'de>>::Error>where __D: Deserializer<'de>,
source§impl<T, D> Serialize for Cholesky<T, D>where
T: SimdComplexField,
D: Dim,
DefaultAllocator: Allocator<T, D, D> + Allocator<T, D, Const<1>>,
Matrix<T, D, D, <DefaultAllocator as Allocator<T, D, D>>::Buffer>: Serialize,
impl<T, D> Serialize for Cholesky<T, D>where T: SimdComplexField, D: Dim, DefaultAllocator: Allocator<T, D, D> + Allocator<T, D, Const<1>>, Matrix<T, D, D, <DefaultAllocator as Allocator<T, D, D>>::Buffer>: Serialize,
source§fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>( &self, __serializer: __S ) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where __S: Serializer,
impl<T, D> Copy for Cholesky<T, D>where T: SimdComplexField, D: Dim, DefaultAllocator: Allocator<T, D, D>, Matrix<T, D, D, <DefaultAllocator as Allocator<T, D, D>>::Buffer>: Copy,
Auto Trait Implementations§
impl<T, D> !RefUnwindSafe for Cholesky<T, D>
impl<T, D> !Send for Cholesky<T, D>
impl<T, D> !Sync for Cholesky<T, D>
impl<T, D> !Unpin for Cholesky<T, D>
impl<T, D> !UnwindSafe for Cholesky<T, D>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere T: Any,
§fn into_any(self: Box<T, Global>) -> Box<dyn Any, Global>
fn into_any(self: Box<T, Global>) -> Box<dyn Any, Global>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.§fn into_any_rc(self: Rc<T, Global>) -> Rc<dyn Any, Global>
fn into_any_rc(self: Rc<T, Global>) -> Rc<dyn Any, Global>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self
from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self
is actually part of its subset T
(and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset
but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self
to the equivalent element of its superset.