g2o
Loading...
Searching...
No Matches
g2o::LinearSolverEigen< MatrixType > Class Template Reference

linear solver which uses the sparse Cholesky solver from Eigen More...

#include <linear_solver_eigen.h>

Inheritance diagram for g2o::LinearSolverEigen< MatrixType >:
Collaboration diagram for g2o::LinearSolverEigen< MatrixType >:

Classes

class  CholeskyDecomposition
 Sub-classing Eigen's SimplicialLLT to perform ordering with a given ordering. More...

Public Types

typedef Eigen::SparseMatrix< double, Eigen::ColMajor > SparseMatrix
typedef Eigen::Triplet< double > Triplet
typedef Eigen::PermutationMatrix< Eigen::Dynamic, Eigen::Dynamic > PermutationMatrix
using CholeskyDecompositionBase

Public Member Functions

 LinearSolverEigen ()
virtual bool init ()
bool solve (const SparseBlockMatrix< MatrixType > &A, double *x, double *b)
Public Member Functions inherited from g2o::LinearSolverCCS< MatrixType >
 LinearSolverCCS ()
 ~LinearSolverCCS ()
virtual bool solveBlocks (double **&blocks, const SparseBlockMatrix< MatrixType > &A)
virtual bool solvePattern (SparseBlockMatrix< MatrixX > &spinv, const std::vector< std::pair< int, int > > &blockIndices, const SparseBlockMatrix< MatrixType > &A)
bool blockOrdering () const
 do the AMD ordering on the blocks or on the scalar matrix
void setBlockOrdering (bool blockOrdering)
Public Member Functions inherited from g2o::LinearSolver< MatrixType >
 LinearSolver ()
virtual ~LinearSolver ()
bool writeDebug () const
 write a debug dump of the system matrix if it is not PSD in solve
void setWriteDebug (bool b)

Public Attributes

 EIGEN_MAKE_ALIGNED_OPERATOR_NEW

Protected Member Functions

bool computeCholesky (const SparseBlockMatrix< MatrixType > &A, double &t)
void computeSymbolicDecomposition (const SparseBlockMatrix< MatrixType > &A)
void fillSparseMatrix (const SparseBlockMatrix< MatrixType > &A, bool onlyValues)
bool solveBlocks_impl (const SparseBlockMatrix< MatrixType > &A, std::function< void(MarginalCovarianceCholesky &)> compute)
Protected Member Functions inherited from g2o::LinearSolverCCS< MatrixType >
void initMatrixStructure (const SparseBlockMatrix< MatrixType > &A)

Protected Attributes

bool _init
SparseMatrix _sparseMatrix
CholeskyDecomposition _cholesky
Protected Attributes inherited from g2o::LinearSolverCCS< MatrixType >
SparseBlockMatrixCCS< MatrixType > * _ccsMatrix
bool _blockOrdering
Protected Attributes inherited from g2o::LinearSolver< MatrixType >
bool _writeDebug

Additional Inherited Members

Static Public Member Functions inherited from g2o::LinearSolver< MatrixType >
static void allocateBlocks (const SparseBlockMatrix< MatrixType > &A, double **&blocks)
 allocate block memory structure
static void deallocateBlocks (const SparseBlockMatrix< MatrixType > &A, double **&blocks)
 de-allocate the block structure
template<typename BlockDerived, typename ScalarDerived>
static void blockToScalarPermutation (const SparseBlockMatrix< MatrixType > &A, const Eigen::MatrixBase< BlockDerived > &p, const Eigen::MatrixBase< ScalarDerived > &scalar)

Detailed Description

template<typename MatrixType>
class g2o::LinearSolverEigen< MatrixType >

linear solver which uses the sparse Cholesky solver from Eigen

Has no dependencies except Eigen. Hence, should compile almost everywhere without to much issues. Performance should be similar to CSparse.

Definition at line 51 of file linear_solver_eigen.h.

Member Typedef Documentation

◆ CholeskyDecompositionBase

template<typename MatrixType>
using g2o::LinearSolverEigen< MatrixType >::CholeskyDecompositionBase
Initial value:

Definition at line 58 of file linear_solver_eigen.h.

◆ PermutationMatrix

template<typename MatrixType>
typedef Eigen::PermutationMatrix<Eigen::Dynamic, Eigen::Dynamic> g2o::LinearSolverEigen< MatrixType >::PermutationMatrix

Definition at line 56 of file linear_solver_eigen.h.

◆ SparseMatrix

template<typename MatrixType>
typedef Eigen::SparseMatrix<double, Eigen::ColMajor> g2o::LinearSolverEigen< MatrixType >::SparseMatrix

Definition at line 53 of file linear_solver_eigen.h.

◆ Triplet

template<typename MatrixType>
typedef Eigen::Triplet<double> g2o::LinearSolverEigen< MatrixType >::Triplet

Definition at line 54 of file linear_solver_eigen.h.

Constructor & Destructor Documentation

◆ LinearSolverEigen()

template<typename MatrixType>
g2o::LinearSolverEigen< MatrixType >::LinearSolverEigen ( )
inline

Member Function Documentation

◆ computeCholesky()

◆ computeSymbolicDecomposition()

template<typename MatrixType>
void g2o::LinearSolverEigen< MatrixType >::computeSymbolicDecomposition ( const SparseBlockMatrix< MatrixType > & A)
inlineprotected

◆ fillSparseMatrix()

template<typename MatrixType>
void g2o::LinearSolverEigen< MatrixType >::fillSparseMatrix ( const SparseBlockMatrix< MatrixType > & A,
bool onlyValues )
inlineprotected

◆ init()

template<typename MatrixType>
virtual bool g2o::LinearSolverEigen< MatrixType >::init ( )
inlinevirtual

init for operating on matrices with a different non-zero pattern like before

Implements g2o::LinearSolver< MatrixType >.

Definition at line 89 of file linear_solver_eigen.h.

References _init.

Referenced by g2o::SolverSLAM2DLinear::solveOrientation().

◆ solve()

template<typename MatrixType>
bool g2o::LinearSolverEigen< MatrixType >::solve ( const SparseBlockMatrix< MatrixType > & A,
double * x,
double * b )
inlinevirtual

Assumes that A is the same matrix for several calls. Among other assumptions, the non-zero pattern does not change! If the matrix changes call init() before. solve system Ax = b, x and b have to allocated beforehand!!

Implements g2o::LinearSolver< MatrixType >.

Definition at line 94 of file linear_solver_eigen.h.

References _cholesky, _sparseMatrix, g2o::G2OBatchStatistics::choleskyNNZ, computeCholesky(), g2o::get_monotonic_time(), g2o::G2OBatchStatistics::globalStats(), and g2o::G2OBatchStatistics::timeNumericDecomposition.

◆ solveBlocks_impl()

template<typename MatrixType>
bool g2o::LinearSolverEigen< MatrixType >::solveBlocks_impl ( const SparseBlockMatrix< MatrixType > & A,
std::function< void(MarginalCovarianceCholesky &)> compute )
inlineprotectedvirtual

Implementation of the general parts for computing the inverse blocks of the linear system matrix. Here we call a function to do the underlying computation.

Implements g2o::LinearSolverCCS< MatrixType >.

Definition at line 198 of file linear_solver_eigen.h.

References _cholesky, g2o::G2OBatchStatistics::choleskyNNZ, computeCholesky(), g2o::G2OBatchStatistics::globalStats(), and g2o::MarginalCovarianceCholesky::setCholeskyFactor().

Member Data Documentation

◆ _cholesky

template<typename MatrixType>
CholeskyDecomposition g2o::LinearSolverEigen< MatrixType >::_cholesky
protected

◆ _init

template<typename MatrixType>
bool g2o::LinearSolverEigen< MatrixType >::_init
protected

Definition at line 113 of file linear_solver_eigen.h.

Referenced by computeCholesky(), init(), and LinearSolverEigen().

◆ _sparseMatrix

template<typename MatrixType>
SparseMatrix g2o::LinearSolverEigen< MatrixType >::_sparseMatrix
protected

◆ EIGEN_MAKE_ALIGNED_OPERATOR_NEW

template<typename MatrixType>
g2o::LinearSolverEigen< MatrixType >::EIGEN_MAKE_ALIGNED_OPERATOR_NEW

Definition at line 86 of file linear_solver_eigen.h.


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