g2o
Loading...
Searching...
No Matches
g2o::LinearSolver< MatrixType > Class Template Referenceabstract

basic solver for Ax = b More...

#include <linear_solver.h>

Inheritance diagram for g2o::LinearSolver< MatrixType >:

Public Member Functions

 LinearSolver ()
virtual ~LinearSolver ()
virtual bool init ()=0
virtual bool solve (const SparseBlockMatrix< MatrixType > &A, double *x, double *b)=0
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 writeDebug () const
 write a debug dump of the system matrix if it is not PSD in solve
void setWriteDebug (bool b)

Static Public Member Functions

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)

Protected Attributes

bool _writeDebug

Detailed Description

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

basic solver for Ax = b

basic solver for Ax = b which has to reimplemented for different linear algebra libraries. A is assumed to be symmetric (only upper triangular block is stored) and positive-semi-definite.

Definition at line 47 of file linear_solver.h.

Constructor & Destructor Documentation

◆ LinearSolver()

◆ ~LinearSolver()

template<typename MatrixType>
virtual g2o::LinearSolver< MatrixType >::~LinearSolver ( )
inlinevirtual

Definition at line 50 of file linear_solver.h.

Member Function Documentation

◆ allocateBlocks()

template<typename MatrixType>
void g2o::LinearSolver< MatrixType >::allocateBlocks ( const SparseBlockMatrix< MatrixType > & A,
double **& blocks )
inlinestatic

allocate block memory structure

Definition at line 97 of file linear_solver.h.

Referenced by g2o::LinearSolverCCS< MatrixType >::solveBlocks().

◆ blockToScalarPermutation()

template<typename MatrixType>
template<typename BlockDerived, typename ScalarDerived>
void g2o::LinearSolver< MatrixType >::blockToScalarPermutation ( const SparseBlockMatrix< MatrixType > & A,
const Eigen::MatrixBase< BlockDerived > & p,
const Eigen::MatrixBase< ScalarDerived > & scalar )
inlinestatic

◆ deallocateBlocks()

template<typename MatrixType>
void g2o::LinearSolver< MatrixType >::deallocateBlocks ( const SparseBlockMatrix< MatrixType > & A,
double **& blocks )
inlinestatic

de-allocate the block structure

Definition at line 109 of file linear_solver.h.

◆ init()

template<typename MatrixType>
virtual bool g2o::LinearSolver< MatrixType >::init ( )
pure virtual

◆ setWriteDebug()

template<typename MatrixType>
void g2o::LinearSolver< MatrixType >::setWriteDebug ( bool b)
inline

Definition at line 94 of file linear_solver.h.

◆ solve()

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

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!!

Implemented in g2o::LinearSolverCholmod< MatrixType >, g2o::LinearSolverCholmodOnline< MatrixType >, g2o::LinearSolverCSparse< MatrixType >, g2o::LinearSolverDense< MatrixType >, g2o::LinearSolverEigen< MatrixType >, and g2o::LinearSolverPCG< MatrixType >.

◆ solveBlocks()

template<typename MatrixType>
virtual bool g2o::LinearSolver< MatrixType >::solveBlocks ( double **& blocks,
const SparseBlockMatrix< MatrixType > & A )
inlinevirtual

Inverts the diagonal blocks of A

Returns
false if not defined.

Reimplemented in g2o::LinearSolverCCS< MatrixType >.

Definition at line 71 of file linear_solver.h.

◆ solvePattern()

template<typename MatrixType>
virtual bool g2o::LinearSolver< MatrixType >::solvePattern ( SparseBlockMatrix< MatrixX > & spinv,
const std::vector< std::pair< int, int > > & blockIndices,
const SparseBlockMatrix< MatrixType > & A )
inlinevirtual

Inverts the a block pattern of A in spinv

Returns
false if not defined.

Reimplemented in g2o::LinearSolverCCS< MatrixType >.

Definition at line 82 of file linear_solver.h.

◆ writeDebug()

template<typename MatrixType>
bool g2o::LinearSolver< MatrixType >::writeDebug ( ) const
inline

write a debug dump of the system matrix if it is not PSD in solve

Definition at line 93 of file linear_solver.h.

Referenced by g2o::LinearSolverEigen< MatrixType >::computeCholesky(), g2o::LinearSolverCholmod< MatrixType >::computeCholmodFactor(), and g2o::LinearSolverCSparse< MatrixType >::solve().

Member Data Documentation

◆ _writeDebug

template<typename MatrixType>
bool g2o::LinearSolver< MatrixType >::_writeDebug
protected

Definition at line 143 of file linear_solver.h.


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