27 #ifndef G2O_BLOCK_SOLVER_H 28 #define G2O_BLOCK_SOLVER_H 35 #include "g2o/config.h" 42 template <
int _PoseDim,
int _LandmarkDim>
47 typedef Eigen::Matrix<double, PoseDim, PoseDim, Eigen::ColMajor>
PoseMatrixType;
65 static const int PoseDim = Eigen::Dynamic;
89 virtual void multiplyHessian(
double* dest,
const double* src)
const = 0;
95 template <
typename Traits>
99 static const int PoseDim = Traits::PoseDim;
123 virtual bool buildStructure(
bool zeroBlocks =
false);
124 virtual bool updateStructure(
const std::vector<HyperGraph::Vertex*>& vset,
const HyperGraph::EdgeSet& edges);
125 virtual bool buildSystem();
126 virtual bool solve();
128 virtual bool setLambda(
double lambda,
bool backup =
false);
129 virtual void restoreDiagonal();
131 virtual bool schur() {
return _doSchur;}
136 virtual void setWriteDebug(
bool writeDebug);
137 virtual bool writeDebug()
const {
return _linearSolver->writeDebug();}
139 virtual bool saveHessian(
const std::string& fileName)
const;
141 virtual void multiplyHessian(
double* dest,
const double* src)
const { _Hpp->multiplySymmetricUpperTriangle(dest, src);}
144 void resize(
int* blockPoseIndices,
int numPoseBlocks,
145 int* blockLandmarkIndices,
int numLandmarkBlocks,
int totalDim);
165 std::vector<OpenMPMutex> _coefficientsMutex;
SparseBlockMatrix< PoseMatrixType > * _Hschur
Traits::PoseHessianType PoseHessianType
std::vector< LandmarkVectorType, Eigen::aligned_allocator< LandmarkVectorType > > _diagonalBackupLandmark
Traits::LandmarkMatrixType LandmarkMatrixType
Eigen::Matrix< double, LandmarkDim, 1, Eigen::ColMajor > LandmarkVectorType
BlockSolver< BlockSolverTraits< 6, 3 > > BlockSolver_6_3
Traits::PoseVectorType PoseVectorType
MatrixXD LandmarkMatrixType
SparseBlockMatrix< PoseMatrixType > * _Hpp
virtual bool schur()
should the solver perform the schur complement or not
Traits::LandmarkHessianType LandmarkHessianType
virtual void setSchur(bool s)
static const int LandmarkDim
SparseBlockMatrixDiagonal< LandmarkMatrixType > * _DInvSchur
SparseBlockMatrixCCS< PoseLandmarkMatrixType > * _HplCCS
traits to summarize the properties of the fixed size optimization problem
Eigen::Matrix< double, LandmarkDim, LandmarkDim, Eigen::ColMajor > LandmarkMatrixType
SparseBlockMatrix< LandmarkMatrixType > * _Hll
SparseBlockMatrix< PoseLandmarkMatrixType > PoseLandmarkHessianType
Traits::PoseMatrixType PoseMatrixType
Traits::LinearSolverType LinearSolverType
SparseBlockMatrix< PoseMatrixType > PoseHessianType
std::set< Edge * > EdgeSet
MatrixXD PoseLandmarkMatrixType
BlockSolver< BlockSolverTraits< 3, 2 > > BlockSolver_3_2
VectorXD LandmarkVectorType
SparseBlockMatrixCCS< PoseMatrixType > * _HschurTransposedCCS
Traits::PoseLandmarkHessianType PoseLandmarkHessianType
LinearSolver< PoseMatrixType > * linearSolver() const
std::vector< PoseVectorType, Eigen::aligned_allocator< PoseVectorType > > _diagonalBackupPose
Traits::PoseLandmarkMatrixType PoseLandmarkMatrixType
Generic interface for a sparse solver operating on a graph which solves one iteration of the lineariz...
Traits::LandmarkVectorType LandmarkVectorType
LinearSolver< PoseMatrixType > LinearSolverType
SparseBlockMatrix< PoseLandmarkMatrixType > PoseLandmarkHessianType
Eigen::Matrix< double, PoseDim, 1, Eigen::ColMajor > PoseVectorType
virtual bool supportsSchur()
Eigen::Matrix< double, Eigen::Dynamic, 1, Eigen::ColMajor > VectorXD
SparseBlockMatrix< PoseLandmarkMatrixType > * _Hpl
SparseBlockMatrix< PoseMatrixType > PoseHessianType
virtual void multiplyHessian(double *dest, const double *src) const
SparseBlockMatrix< LandmarkMatrixType > LandmarkHessianType
BlockSolver< BlockSolverTraits< 7, 3 > > BlockSolver_7_3
LinearSolver< PoseMatrixType > * _linearSolver
Implementation of a solver operating on the blocks of the Hessian.
Eigen::Matrix< double, PoseDim, LandmarkDim, Eigen::ColMajor > PoseLandmarkMatrixType
LinearSolver< PoseMatrixType > LinearSolverType
Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic, Eigen::ColMajor > MatrixXD
SparseBlockMatrix< LandmarkMatrixType > LandmarkHessianType
Eigen::Matrix< double, PoseDim, PoseDim, Eigen::ColMajor > PoseMatrixType
virtual ~BlockSolverBase()
virtual bool writeDebug() const
base for the block solvers with some basic function interfaces
BlockSolver< BlockSolverTraits< Eigen::Dynamic, Eigen::Dynamic > > BlockSolverX