27 #ifndef G2O_BASE_VERTEX_H 28 #define G2O_BASE_VERTEX_H 35 #include <Eigen/Dense> 36 #include <Eigen/Cholesky> 37 #include <Eigen/StdVector> 49 template <
int D,
typename T>
54 std::vector<EstimateType, Eigen::aligned_allocator<EstimateType> > >
59 typedef Eigen::Map<Eigen::Matrix<double, D, D, Eigen::ColMajor>, Eigen::Matrix<double, D, D, Eigen::ColMajor>::Flags & Eigen::AlignedBit ? Eigen::Aligned : Eigen::Unaligned >
HessianBlockType;
64 virtual const double&
hessian(
int i,
int j)
const { assert(i<D && j<D);
return _hessian(i,j);}
65 virtual double&
hessian(
int i,
int j) { assert(i<D && j<D);
return _hessian(i,j);}
71 virtual int copyB(
double* b_)
const {
72 memcpy(b_,
_b.data(), Dimension *
sizeof(double));
76 virtual const double&
b(
int i)
const { assert(i < D);
return _b(i);}
77 virtual double&
b(
int i) { assert(i < D);
return _b(i);}
78 virtual double*
bData() {
return _b.data();}
87 Eigen::Matrix<double, D, 1, Eigen::ColMajor>&
b() {
return _b;}
88 const Eigen::Matrix<double, D, 1, Eigen::ColMajor>&
b()
const {
return _b;}
91 const HessianBlockType&
A()
const {
return _hessian;}
105 Eigen::Matrix<double, D, 1, Eigen::ColMajor>
_b;
109 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
virtual void push()
backup the position of the vertex to a stack
virtual double solveDirect(double lambda=0)
virtual void discardTop()
pop the last element from the stack, without restoring the current estimate
Eigen::Matrix< double, D, 1, Eigen::ColMajor > _b
virtual void updateCache()
const HessianBlockType & A() const
virtual const double & hessian(int i, int j) const
get the element from the hessian matrix
virtual const double & b(int i) const
get the b vector element
virtual int copyB(double *b_) const
virtual double & b(int i)
virtual double * bData()
return a pointer to the b vector associated with this vertex
HessianBlockType & A()
return the hessian block associated with the vertex
HessianBlockType _hessian
Eigen::Matrix< double, D, 1, Eigen::ColMajor > & b()
return right hand side b of the constructed linear system
virtual void clearQuadraticForm()
std::stack< EstimateType, std::vector< EstimateType, Eigen::aligned_allocator< EstimateType > > > BackupStackType
const Eigen::Matrix< double, D, 1, Eigen::ColMajor > & b() const
void setEstimate(const EstimateType &et)
set the estimate for the vertex also calls updateCache()
A general case Vertex for optimization.
virtual void pop()
restore the position of the vertex by retrieving the position from the stack
Eigen::Map< Eigen::Matrix< double, D, D, Eigen::ColMajor >, Eigen::Matrix< double, D, D, Eigen::ColMajor >::Flags &Eigen::AlignedBit?Eigen::Aligned:Eigen::Unaligned > HessianBlockType
const EstimateType & estimate() const
return the current estimate of the vertex
virtual double * hessianData()
virtual int stackSize() const
return the stack size
virtual double & hessian(int i, int j)
virtual double hessianDeterminant() const
virtual void mapHessianMemory(double *d)
static const int Dimension
dimension of the estimate (minimal) in the manifold space