|
g2o
|
Implementation of a solver operating on the blocks of the Hessian. More...
#include <block_solver.h>


Public Types | |
| typedef Traits::PoseMatrixType | PoseMatrixType |
| typedef Traits::LandmarkMatrixType | LandmarkMatrixType |
| typedef Traits::PoseLandmarkMatrixType | PoseLandmarkMatrixType |
| typedef Traits::PoseVectorType | PoseVectorType |
| typedef Traits::LandmarkVectorType | LandmarkVectorType |
| typedef Traits::PoseHessianType | PoseHessianType |
| typedef Traits::LandmarkHessianType | LandmarkHessianType |
| typedef Traits::PoseLandmarkHessianType | PoseLandmarkHessianType |
| typedef Traits::LinearSolverType | LinearSolverType |
Public Member Functions | |
| BlockSolver (std::unique_ptr< LinearSolverType > linearSolver) | |
| ~BlockSolver () | |
| virtual bool | init (SparseOptimizer *optmizer, bool online=false) |
| virtual bool | buildStructure (bool zeroBlocks=false) |
| virtual bool | updateStructure (const std::vector< HyperGraph::Vertex * > &vset, const HyperGraph::EdgeSet &edges) |
| virtual bool | buildSystem () |
| virtual bool | solve () |
| virtual bool | computeMarginals (SparseBlockMatrix< MatrixX > &spinv, const std::vector< std::pair< int, int > > &blockIndices) |
| virtual bool | setLambda (double lambda, bool backup=false) |
| virtual void | restoreDiagonal () |
| virtual bool | supportsSchur () |
| virtual bool | schur () |
| should the solver perform the schur complement or not | |
| virtual void | setSchur (bool s) |
| LinearSolver< PoseMatrixType > & | linearSolver () const |
| virtual void | setWriteDebug (bool writeDebug) |
| virtual bool | writeDebug () const |
| virtual bool | saveHessian (const std::string &fileName) const |
| write the hessian to disk using the specified file name | |
| virtual void | multiplyHessian (double *dest, const double *src) const |
Public Member Functions inherited from g2o::BlockSolverBase | |
| virtual | ~BlockSolverBase () |
Public Member Functions inherited from g2o::Solver | |
| Solver () | |
| virtual | ~Solver () |
| double * | x () |
| return x, the solution vector | |
| const double * | x () const |
| double * | b () |
| return b, the right hand side of the system | |
| const double * | b () const |
| size_t | vectorSize () const |
| return the size of the solution vector (x) and b | |
| SparseOptimizer * | optimizer () const |
| the optimizer (graph) on which the solver works | |
| void | setOptimizer (SparseOptimizer *optimizer) |
| bool | levenberg () const |
| the system is Levenberg-Marquardt | |
| void | setLevenberg (bool levenberg) |
| size_t | additionalVectorSpace () const |
| void | setAdditionalVectorSpace (size_t s) |
Static Public Attributes | |
| static const int | PoseDim = Traits::PoseDim |
| static const int | LandmarkDim = Traits::LandmarkDim |
Protected Member Functions | |
| void | resize (int *blockPoseIndices, int numPoseBlocks, int *blockLandmarkIndices, int numLandmarkBlocks, int totalDim) |
| void | deallocate () |
Protected Member Functions inherited from g2o::Solver | |
| void | resizeVector (size_t sx) |
Implementation of a solver operating on the blocks of the Hessian.
Definition at line 103 of file block_solver.h.
| typedef Traits::LandmarkHessianType g2o::BlockSolver< Traits >::LandmarkHessianType |
Definition at line 114 of file block_solver.h.
| typedef Traits::LandmarkMatrixType g2o::BlockSolver< Traits >::LandmarkMatrixType |
Definition at line 108 of file block_solver.h.
| typedef Traits::LandmarkVectorType g2o::BlockSolver< Traits >::LandmarkVectorType |
Definition at line 111 of file block_solver.h.
| typedef Traits::LinearSolverType g2o::BlockSolver< Traits >::LinearSolverType |
Definition at line 116 of file block_solver.h.
| typedef Traits::PoseHessianType g2o::BlockSolver< Traits >::PoseHessianType |
Definition at line 113 of file block_solver.h.
| typedef Traits::PoseLandmarkHessianType g2o::BlockSolver< Traits >::PoseLandmarkHessianType |
Definition at line 115 of file block_solver.h.
| typedef Traits::PoseLandmarkMatrixType g2o::BlockSolver< Traits >::PoseLandmarkMatrixType |
Definition at line 109 of file block_solver.h.
| typedef Traits::PoseMatrixType g2o::BlockSolver< Traits >::PoseMatrixType |
Definition at line 107 of file block_solver.h.
| typedef Traits::PoseVectorType g2o::BlockSolver< Traits >::PoseVectorType |
Definition at line 110 of file block_solver.h.
| g2o::BlockSolver< Traits >::BlockSolver | ( | std::unique_ptr< LinearSolverType > | linearSolver | ) |
allocate a block solver ontop of the underlying linear solver. NOTE: The BlockSolver assumes exclusive access to the linear solver and will therefore free the pointer in its destructor.
Definition at line 41 of file block_solver.hpp.
References g2o::BlockSolver< Traits >::_doSchur, g2o::BlockSolver< Traits >::_numLandmarks, g2o::BlockSolver< Traits >::_numPoses, g2o::BlockSolver< Traits >::_sizeLandmarks, g2o::BlockSolver< Traits >::_sizePoses, and g2o::Solver::_xSize.
| g2o::BlockSolver< Traits >::~BlockSolver | ( | ) |
Definition at line 107 of file block_solver.hpp.
|
virtual |
build the structure of the system
Implements g2o::Solver.
Definition at line 110 of file block_solver.hpp.
References g2o::SparseBlockMatrixHashMap< MatrixType >::addBlock(), g2o::SparseBlockMatrixHashMap< MatrixType >::blockCols(), g2o::OptimizableGraph::Vertex::dimension(), g2o::OptimizableGraph::Vertex::hessianIndex(), g2o::OptimizableGraph::Vertex::mapHessianMemory(), g2o::OptimizableGraph::Edge::mapHessianMemory(), g2o::OptimizableGraph::Vertex::marginalized(), g2o::OptimizableGraph::Vertex::setColInHessian(), g2o::HyperGraph::Edge::vertex(), and g2o::HyperGraph::Edge::vertices().
|
virtual |
build the current system
Implements g2o::Solver.
Definition at line 492 of file block_solver.hpp.
References g2o::arrayHasNaN(), g2o::OptimizableGraph::Vertex::clearQuadraticForm(), g2o::OptimizableGraph::Vertex::colInHessian(), g2o::OptimizableGraph::Edge::constructQuadraticForm(), g2o::OptimizableGraph::Vertex::copyB(), g2o::OptimizableGraph::Vertex::dimension(), g2o::OptimizableGraph::Edge::dimension(), g2o::OptimizableGraph::Vertex::fixed(), G2O_WARN, g2o::OptimizableGraph::Edge::linearizeOplus(), g2o::OptimizableGraph::Vertex::marginalized(), g2o::HyperGraph::Edge::vertex(), g2o::HyperGraph::Edge::vertices(), and g2o::JacobianWorkspace::workspaceForVertex().
|
virtual |
computes the block diagonal elements of the pattern specified in the input and stores them in given SparseBlockMatrix
Implements g2o::Solver.
Definition at line 479 of file block_solver.hpp.
References g2o::get_monotonic_time(), g2o::G2OBatchStatistics::globalStats(), and g2o::G2OBatchStatistics::timeMarginals.
|
protected |
Definition at line 93 of file block_solver.hpp.
|
virtual |
initialize the solver, called once before the first iteration
Implements g2o::Solver.
Definition at line 604 of file block_solver.hpp.
References g2o::SparseOptimizer::clear().
|
inline |
Definition at line 142 of file block_solver.h.
References g2o::BlockSolver< Traits >::_linearSolver.
Referenced by g2o::SparseOptimizerIncremental::initSolver().
|
inlinevirtual |
compute dest = H * src
Implements g2o::BlockSolverBase.
Definition at line 149 of file block_solver.h.
References g2o::BlockSolver< Traits >::_Hpp.
|
protected |
Definition at line 53 of file block_solver.hpp.
|
virtual |
restore a previously made backup of the diagonal
Implements g2o::Solver.
Definition at line 588 of file block_solver.hpp.
|
virtual |
write the hessian to disk using the specified file name
Implements g2o::Solver.
Definition at line 621 of file block_solver.hpp.
|
inlinevirtual |
should the solver perform the schur complement or not
Implements g2o::Solver.
Definition at line 139 of file block_solver.h.
References g2o::BlockSolver< Traits >::_doSchur.
|
virtual |
update the system while performing Levenberg, i.e., modifying the diagonal components of A by doing += lambda along the main diagonal of the Matrix. Note that this function may be called with a positive and a negative lambda. The latter is used to undo a former modification. If backup is true, then the solver should store a backup of the diagonal, which can be restored by restoreDiagonal()
Implements g2o::Solver.
Definition at line 563 of file block_solver.hpp.
|
inlinevirtual |
Implements g2o::Solver.
Definition at line 140 of file block_solver.h.
References g2o::BlockSolver< Traits >::_doSchur.
Referenced by g2o::SparseOptimizerIncremental::initSolver().
|
virtual |
write debug output of the Hessian if system is not positive definite
Implements g2o::Solver.
Definition at line 616 of file block_solver.hpp.
|
virtual |
solve Ax = b
Implements g2o::Solver.
Definition at line 331 of file block_solver.hpp.
References g2o::SparseBlockMatrixCCS< MatrixType >::blockCols(), g2o::get_monotonic_time(), g2o::G2OBatchStatistics::globalStats(), g2o::G2OBatchStatistics::hessianDimension, g2o::G2OBatchStatistics::hessianLandmarkDimension, g2o::G2OBatchStatistics::hessianPoseDimension, g2o::G2OBatchStatistics::timeLinearSolver, and g2o::G2OBatchStatistics::timeSchurComplement.
|
inlinevirtual |
does this solver support the Schur complement for solving a system consisting of poses and landmarks. Re-implement in a derived solver, if your solver supports it.
Reimplemented from g2o::Solver.
Definition at line 138 of file block_solver.h.
|
virtual |
update the structures for online processing
Implements g2o::Solver.
Definition at line 271 of file block_solver.hpp.
References __PRETTY_FUNCTION__, g2o::OptimizableGraph::Vertex::dimension(), G2O_ERROR, g2o::OptimizableGraph::Vertex::hessianIndex(), g2o::OptimizableGraph::Vertex::mapHessianMemory(), g2o::OptimizableGraph::Edge::mapHessianMemory(), g2o::OptimizableGraph::Vertex::marginalized(), g2o::OptimizableGraph::Vertex::setColInHessian(), g2o::HyperGraph::Edge::vertex(), and g2o::HyperGraph::Edge::vertices().
|
inlinevirtual |
Implements g2o::Solver.
Definition at line 145 of file block_solver.h.
References g2o::BlockSolver< Traits >::_linearSolver.
|
protected |
Definition at line 181 of file block_solver.h.
|
protected |
Definition at line 180 of file block_solver.h.
|
protected |
Definition at line 172 of file block_solver.h.
|
protected |
Definition at line 171 of file block_solver.h.
|
protected |
Definition at line 164 of file block_solver.h.
|
protected |
Definition at line 178 of file block_solver.h.
Referenced by g2o::BlockSolver< Traits >::BlockSolver(), g2o::BlockSolver< Traits >::schur(), and g2o::BlockSolver< Traits >::setSchur().
|
protected |
Definition at line 160 of file block_solver.h.
|
protected |
Definition at line 161 of file block_solver.h.
|
protected |
Definition at line 166 of file block_solver.h.
|
protected |
Definition at line 159 of file block_solver.h.
Referenced by g2o::BlockSolver< Traits >::multiplyHessian().
|
protected |
Definition at line 163 of file block_solver.h.
|
protected |
Definition at line 167 of file block_solver.h.
|
protected |
Definition at line 169 of file block_solver.h.
Referenced by g2o::BlockSolver< Traits >::linearSolver(), and g2o::BlockSolver< Traits >::writeDebug().
|
protected |
Definition at line 183 of file block_solver.h.
Referenced by g2o::BlockSolver< Traits >::BlockSolver().
|
protected |
Definition at line 183 of file block_solver.h.
Referenced by g2o::BlockSolver< Traits >::BlockSolver().
|
protected |
Definition at line 184 of file block_solver.h.
Referenced by g2o::BlockSolver< Traits >::BlockSolver().
|
protected |
Definition at line 184 of file block_solver.h.
Referenced by g2o::BlockSolver< Traits >::BlockSolver().
|
static |
Definition at line 106 of file block_solver.h.
|
static |
Definition at line 105 of file block_solver.h.