Main MRPT website > C++ reference for MRPT 1.4.0
List of all members | Public Member Functions | Private Attributes
mrpt::math::CSparseMatrix::CholeskyDecomp Class Reference

Detailed Description

Auxiliary class to hold the results of a Cholesky factorization of a sparse matrix.

This implementation does not allow updating/downdating.

Usage example:

CSparseMatrix SM(100,100);
SM.insert_entry(i,j, val); ...
SM.compressFromTriplet();
// Do Cholesky decomposition:
CD.get_inverse();
...
Auxiliary class to hold the results of a Cholesky factorization of a sparse matrix.
A sparse matrix structure, wrapping T.
Note
Only the upper triangular part of the input matrix is accessed.
This class was initially adapted from "robotvision", by Hauke Strasdat, Steven Lovegrove and Andrew J. Davison. See http://www.openslam.org/robotvision.html
This class designed to be "uncopiable".
See also
The main class: CSparseMatrix

Definition at line 360 of file CSparseMatrix.h.

#include <mrpt/math/CSparseMatrix.h>

Inheritance diagram for mrpt::math::CSparseMatrix::CholeskyDecomp:
Inheritance graph

Public Member Functions

 CholeskyDecomp (const CSparseMatrix &A)
 Constructor from a square definite-positive sparse matrix A, which can be use to solve Ax=b The actual Cholesky decomposition takes places in this constructor.
 
virtual ~CholeskyDecomp ()
 Destructor.
 
CMatrixDouble get_L () const
 Return the L matrix (L*L' = M), as a dense matrix.
 
void get_L (CMatrixDouble &out_L) const
 Return the L matrix (L*L' = M), as a dense matrix.
 
template<class VECTOR >
VECTOR backsub (const VECTOR &b) const
 Return the vector from a back-substitution step that solves: Ux=b

 
void backsub (const Eigen::VectorXd &b, Eigen::VectorXd &result_x) const
 Return the vector from a back-substitution step that solves: Ux=b.
 
void backsub (const double *b, double *result, const size_t N) const
 
void update (const CSparseMatrix &new_SM)
 Update the Cholesky factorization from an updated vesion of the original input, square definite-positive sparse matrix.
 

Private Attributes

css * m_symbolic_structure
 
csn * m_numeric_structure
 
const CSparseMatrixm_originalSM
 A const reference to the original matrix used to build this decomposition.
 

Constructor & Destructor Documentation

◆ CholeskyDecomp()

mrpt::math::CSparseMatrix::CholeskyDecomp::CholeskyDecomp ( const CSparseMatrix A)

Constructor from a square definite-positive sparse matrix A, which can be use to solve Ax=b The actual Cholesky decomposition takes places in this constructor.

Note
Only the upper triangular part of the matrix is accessed.
Exceptions
std::runtime_errorOn non-square input matrix.
mrpt::math::CExceptionNotDefPosOn non-definite-positive matrix as input.

◆ ~CholeskyDecomp()

virtual mrpt::math::CSparseMatrix::CholeskyDecomp::~CholeskyDecomp ( )
virtual

Destructor.

Member Function Documentation

◆ backsub() [1/3]

void mrpt::math::CSparseMatrix::CholeskyDecomp::backsub ( const double *  b,
double *  result,
const size_t  N 
) const

◆ backsub() [2/3]

void mrpt::math::CSparseMatrix::CholeskyDecomp::backsub ( const Eigen::VectorXd &  b,
Eigen::VectorXd &  result_x 
) const

Return the vector from a back-substitution step that solves: Ux=b.

Vectors can be Eigen::VectorXd or mrpt::math::CVectorDouble

◆ backsub() [3/3]

template<class VECTOR >
VECTOR mrpt::math::CSparseMatrix::CholeskyDecomp::backsub ( const VECTOR &  b) const
inline

Return the vector from a back-substitution step that solves: Ux=b

Definition at line 387 of file CSparseMatrix.h.

References backsub().

Referenced by backsub().

◆ get_L() [1/2]

CMatrixDouble mrpt::math::CSparseMatrix::CholeskyDecomp::get_L ( ) const
inline

Return the L matrix (L*L' = M), as a dense matrix.

Definition at line 380 of file CSparseMatrix.h.

References get_L().

Referenced by get_L().

◆ get_L() [2/2]

void mrpt::math::CSparseMatrix::CholeskyDecomp::get_L ( CMatrixDouble out_L) const

Return the L matrix (L*L' = M), as a dense matrix.

◆ update()

void mrpt::math::CSparseMatrix::CholeskyDecomp::update ( const CSparseMatrix new_SM)

Update the Cholesky factorization from an updated vesion of the original input, square definite-positive sparse matrix.

NOTE: This new matrix MUST HAVE exactly the same sparse structure than the original one.

Member Data Documentation

◆ m_numeric_structure

csn* mrpt::math::CSparseMatrix::CholeskyDecomp::m_numeric_structure
private

Definition at line 364 of file CSparseMatrix.h.

◆ m_originalSM

const CSparseMatrix* mrpt::math::CSparseMatrix::CholeskyDecomp::m_originalSM
private

A const reference to the original matrix used to build this decomposition.

Definition at line 365 of file CSparseMatrix.h.

◆ m_symbolic_structure

css* mrpt::math::CSparseMatrix::CholeskyDecomp::m_symbolic_structure
private

Definition at line 363 of file CSparseMatrix.h.




Page generated by Doxygen 1.9.7 for MRPT 1.4.0 SVN: at Tue Jun 13 13:45:58 UTC 2023