g2o
Loading...
Searching...
No Matches
g2o::MarginalCovarianceCholesky Class Reference

computing the marginal covariance given a cholesky factor (lower triangle of the factor) More...

#include <marginal_covariance_cholesky.h>

Public Member Functions

 MarginalCovarianceCholesky ()
 ~MarginalCovarianceCholesky ()
void computeCovariance (double **covBlocks, const std::vector< int > &blockIndices)
void computeCovariance (SparseBlockMatrix< MatrixX > &spinv, const std::vector< int > &rowBlockIndices, const std::vector< std::pair< int, int > > &blockIndices)
void setCholeskyFactor (int n, int *Lp, int *Li, double *Lx, int *permInv)

Protected Types

typedef std::unordered_map< int, double > LookupMap

Protected Member Functions

int computeIndex (int r, int c) const
 compute the index used for hashing
double computeEntry (int r, int c)

Protected Attributes

int _n
 L is an n X n matrix.
int * _Ap
 column pointer of the CCS storage
int * _Ai
 row indices of the CCS storage
double * _Ax
 values of the cholesky factor
int * _perm
LookupMap _map
 hash look up table for the already computed entries
std::vector< double > _diag
 cache 1 / H_ii to avoid recalculations

Detailed Description

computing the marginal covariance given a cholesky factor (lower triangle of the factor)

Definition at line 42 of file marginal_covariance_cholesky.h.

Member Typedef Documentation

◆ LookupMap

typedef std::unordered_map<int, double> g2o::MarginalCovarianceCholesky::LookupMap
protected

hash struct for storing the matrix elements needed to compute the covariance

Definition at line 48 of file marginal_covariance_cholesky.h.

Constructor & Destructor Documentation

◆ MarginalCovarianceCholesky()

g2o::MarginalCovarianceCholesky::MarginalCovarianceCholesky ( )

Definition at line 46 of file marginal_covariance_cholesky.cpp.

References _Ai, _Ap, _Ax, _n, and _perm.

◆ ~MarginalCovarianceCholesky()

g2o::MarginalCovarianceCholesky::~MarginalCovarianceCholesky ( )

Definition at line 49 of file marginal_covariance_cholesky.cpp.

Member Function Documentation

◆ computeCovariance() [1/2]

void g2o::MarginalCovarianceCholesky::computeCovariance ( double ** covBlocks,
const std::vector< int > & blockIndices )

compute the marginal cov for the given block indices, write the result to the covBlocks memory (which has to be provided by the caller).

Definition at line 100 of file marginal_covariance_cholesky.cpp.

References _map, _perm, g2o::MatrixElem::c, computeEntry(), computeIndex(), and g2o::MatrixElem::r.

◆ computeCovariance() [2/2]

void g2o::MarginalCovarianceCholesky::computeCovariance ( SparseBlockMatrix< MatrixX > & spinv,
const std::vector< int > & rowBlockIndices,
const std::vector< std::pair< int, int > > & blockIndices )

◆ computeEntry()

double g2o::MarginalCovarianceCholesky::computeEntry ( int r,
int c )
protected

compute one entry in the covariance, r and c are values after applying the permutation, and upper triangular. May issue recursive calls to itself to compute the missing values.

Definition at line 69 of file marginal_covariance_cholesky.cpp.

References _Ai, _Ap, _Ax, _diag, _map, computeEntry(), and computeIndex().

Referenced by computeCovariance(), computeCovariance(), and computeEntry().

◆ computeIndex()

int g2o::MarginalCovarianceCholesky::computeIndex ( int r,
int c ) const
inlineprotected

compute the index used for hashing

Definition at line 93 of file marginal_covariance_cholesky.h.

References _n.

Referenced by computeCovariance(), computeCovariance(), and computeEntry().

◆ setCholeskyFactor()

void g2o::MarginalCovarianceCholesky::setCholeskyFactor ( int n,
int * Lp,
int * Li,
double * Lx,
int * permInv )

set the CCS representation of the cholesky factor along with the inverse permutation used to reduce the fill-in. permInv might be 0, will then not permute the entries.

The pointers provided by the user need to be still valid when calling computeCovariance(). The pointers are owned by the caller, MarginalCovarianceCholesky does not free the pointers.

Definition at line 51 of file marginal_covariance_cholesky.cpp.

References _Ai, _Ap, _Ax, _diag, _n, and _perm.

Referenced by g2o::LinearSolverCholmod< MatrixType >::solveBlocks_impl(), g2o::LinearSolverCSparse< MatrixType >::solveBlocks_impl(), and g2o::LinearSolverEigen< MatrixType >::solveBlocks_impl().

Member Data Documentation

◆ _Ai

int* g2o::MarginalCovarianceCholesky::_Ai
protected

row indices of the CCS storage

Definition at line 84 of file marginal_covariance_cholesky.h.

Referenced by computeEntry(), MarginalCovarianceCholesky(), and setCholeskyFactor().

◆ _Ap

int* g2o::MarginalCovarianceCholesky::_Ap
protected

column pointer of the CCS storage

Definition at line 83 of file marginal_covariance_cholesky.h.

Referenced by computeEntry(), MarginalCovarianceCholesky(), and setCholeskyFactor().

◆ _Ax

double* g2o::MarginalCovarianceCholesky::_Ax
protected

values of the cholesky factor

Definition at line 85 of file marginal_covariance_cholesky.h.

Referenced by computeEntry(), MarginalCovarianceCholesky(), and setCholeskyFactor().

◆ _diag

std::vector<double> g2o::MarginalCovarianceCholesky::_diag
protected

cache 1 / H_ii to avoid recalculations

Definition at line 90 of file marginal_covariance_cholesky.h.

Referenced by computeEntry(), and setCholeskyFactor().

◆ _map

LookupMap g2o::MarginalCovarianceCholesky::_map
protected

hash look up table for the already computed entries

Definition at line 89 of file marginal_covariance_cholesky.h.

Referenced by computeCovariance(), computeCovariance(), and computeEntry().

◆ _n

int g2o::MarginalCovarianceCholesky::_n
protected

L is an n X n matrix.

Definition at line 82 of file marginal_covariance_cholesky.h.

Referenced by computeIndex(), MarginalCovarianceCholesky(), and setCholeskyFactor().

◆ _perm

int* g2o::MarginalCovarianceCholesky::_perm
protected

permutation of the cholesky factor. Variable re-ordering for better fill-in

Definition at line 86 of file marginal_covariance_cholesky.h.

Referenced by computeCovariance(), computeCovariance(), MarginalCovarianceCholesky(), and setCholeskyFactor().


The documentation for this class was generated from the following files: