NDEVR
API Documentation
BlockSolver< Traits >

Implementation of a solver operating on the blocks of the Hessian. More...

Inheritance diagram for BlockSolver< Traits >:
[legend]
Collaboration diagram for BlockSolver< Traits >:
[legend]

Public Member Functions

 BlockSolver ()
 Default constructor.
bool buildStructure (bool zeroBlocks, IndexScratch &scratch)
 Builds the sparse block matrix structure from the graph.
bool buildSystem ()
 Builds the linear system (Hessian blocks and gradient) from the current graph.
void clear ()
 Clears all solver state, resetting sizes to zero.
bool init (bool online=false)
 Initializes the block solver.
void multiplyHessian (g_type *dest, const g_type *src) const
 Multiplies the pose Hessian by a vector: dest = Hpp * src.
SparseOptimizeroptimizer ()
 Returns a mutable reference to the underlying optimizer.
const SparseOptimizeroptimizer () const
 Returns a const reference to the underlying optimizer.
void restoreDiagonal ()
 Restores the Hessian diagonal from the backup.
bool schur ()
 Returns whether the Schur complement is currently enabled.
bool setLambda (g_type lambda, bool backup=false)
 Adds a damping factor to the diagonal of the Hessian.
void setSchur (bool s)
 Enables or disables the Schur complement.
bool solve ()
 Solves the linear system, optionally using the Schur complement.
bool supportsSchur ()
 Returns true; this solver supports the Schur complement.
bool updateStructure (const Buffer< HyperGraph::HGVertex * > &vset, const Set< HyperGraph::HGVertex * > &edges)
 Updates the structure after vertices or edges have changed.
Public Member Functions inherited from Solver
 Solver ()
 Default constructor.
 ~Solver ()
 Destructor.
g_type * b ()
 return b, the right hand side of the system
uint04 vectorSize () const
 return the size of the solution vector (x) and b
g_type * x ()
 return x, the solution vector

Public Attributes

LinearSolverType solver
 The underlying linear solver.

Protected Member Functions

void resize (IndexScratch &scratch, int totalDim)
 Resizes all internal matrices and vectors for the given problem size.
Protected Member Functions inherited from Solver
void resizeVector (uint04 sx)
 Resizes the solution and right-hand side vectors.

Protected Attributes

Buffer< g_type > _bschur
 Right-hand side for the Schur complement system.
Buffer< g_type > _coefficients
 Coefficient buffer for Schur elimination.
Buffer< LandmarkVectorType > _diagonalBackupLandmark
 Backup of landmark Hessian diagonal.
Buffer< PoseVectorType > _diagonalBackupPose
 Backup of pose Hessian diagonal.
SparseBlockMatrixDiagonal< LandmarkMatrixType > _DInvSchur
 Inverse diagonal of the landmark Hessian.
bool _doSchur
 Whether to use the Schur complement.
SparseBlockMatrix< LandmarkMatrixType > _Hll
 Landmark-landmark Hessian block.
SparseBlockMatrix< PoseLandmarkMatrixType > _Hpl
 Pose-landmark Hessian block.
SparseBlockMatrixCCS< PoseLandmarkMatrixType > _HplCCS
 CCS view of the pose-landmark Hessian.
SparseBlockMatrix< PoseMatrixType > _Hpp
 Pose-pose Hessian block.
SparseBlockMatrix< PoseMatrixType > _Hschur
 Schur complement of the Hessian.
SparseBlockMatrixCCS< PoseMatrixType > _HschurTransposedCCS
 Transposed CCS view of the Schur complement.
uint04 _numLandmarks
 Number of pose and landmark blocks.
uint04 _sizeLandmarks
 Total scalar dimensions of poses and landmarks.
Protected Attributes inherited from Solver
Buffer< g_type > _b
 The right-hand side vector.
Buffer< g_type > _x
 The solution vector.

Detailed Description

template<typename Traits>
class BlockSolver< Traits >

Implementation of a solver operating on the blocks of the Hessian.

Definition at line 66 of file block_solver.h.

Member Function Documentation

◆ buildStructure()

◆ buildSystem()

template<typename Traits>
bool BlockSolver< Traits >::buildSystem ( )
inline

Builds the linear system (Hessian blocks and gradient) from the current graph.

Returns
True on success.

Definition at line 124 of file block_solver.h.

◆ init()

template<typename Traits>
bool BlockSolver< Traits >::init ( bool online = false)

Initializes the block solver.

Parameters
[in]onlineWhether this is an online (incremental) session.
Returns
True on success.

Definition at line 364 of file block_solver.hpp.

References _Hll, _Hpl, _Hpp, and solver.

◆ multiplyHessian()

template<typename Traits>
void BlockSolver< Traits >::multiplyHessian ( g_type * dest,
const g_type * src ) const
inline

Multiplies the pose Hessian by a vector: dest = Hpp * src.

Parameters
[out]destThe destination vector.
[in]srcThe source vector.

Definition at line 292 of file block_solver.h.

◆ resize()

template<typename Traits>
void BlockSolver< Traits >::resize ( IndexScratch & scratch,
int totalDim )
protected

Resizes all internal matrices and vectors for the given problem size.

Parameters
[in]scratchScratch buffers for index assignments.
[in]totalDimThe total dimension of the problem.

Definition at line 49 of file block_solver.hpp.

References _bschur, _coefficients, _DInvSchur, _doSchur, _Hll, _Hpl, _HplCCS, _Hpp, _Hschur, _HschurTransposedCCS, IndexScratch::block_landmark_indices, IndexScratch::block_pose_indices, and Solver::resizeVector().

Referenced by buildStructure().

◆ setLambda()

template<typename Traits>
bool BlockSolver< Traits >::setLambda ( g_type lambda,
bool backup = false )

Adds a damping factor to the diagonal of the Hessian.

Parameters
[in]lambdaThe damping factor.
[in]backupWhether to backup the diagonal before modification.
Returns
True on success.

Definition at line 319 of file block_solver.hpp.

References _diagonalBackupLandmark, _diagonalBackupPose, _Hll, _Hpp, _numLandmarks, and Solver::b().

◆ setSchur()

template<typename Traits>
void BlockSolver< Traits >::setSchur ( bool s)
inline

Enables or disables the Schur complement.

Parameters
[in]sTrue to enable, false to disable.

Definition at line 288 of file block_solver.h.

◆ solve()

template<typename Traits>
bool BlockSolver< Traits >::solve ( )
inline

Solves the linear system, optionally using the Schur complement.

Returns
True on success.

Definition at line 162 of file block_solver.h.

◆ updateStructure()

template<typename Traits>
bool BlockSolver< Traits >::updateStructure ( const Buffer< HyperGraph::HGVertex * > & vset,
const Set< HyperGraph::HGVertex * > & edges )

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