13 _optimizer = optimizer;
19 std::set<std::pair<int, int> > pattern;
20 for (std::set<OptimizableGraph::Edge*>::iterator it=edges.begin(); it!=edges.end(); it++){
21 augmentSparsePattern(pattern, *it);
27 bool result = computePartialInverse(spInv, pattern);
35 for (std::set<OptimizableGraph::Edge*>::iterator it=edges.begin(); it!=edges.end(); it++){
36 count += labelEdge(spInv, *it) ? 1 : 0;
42 for (
size_t i=0; i<e->
vertices().size(); i++){
47 for (
size_t j=i; j<e->
vertices().size(); j++){
54 pattern.insert(std::make_pair(ti, tj));
60 std::vector<std::pair<int, int> > blockIndices(pattern.size());
65 for(std::set<std::pair<int, int> >::const_iterator it= pattern.begin(); it!=pattern.end(); it++){
66 blockIndices[k++]=*it;
70 return _optimizer->computeMarginals(spinv, blockIndices);
80 for (
size_t i=0; i<e->
vertices().size(); i++){
90 MatrixXd cov(maxDim, maxDim);
92 for (
size_t i=0; i<e->
vertices().size(); i++){
97 for (
size_t j=0; j<e->
vertices().size(); j++){
104 assert(spinv.
block(ti, tj));
110 *spinv.
block(ti, tj);
112 assert(spinv.
block(tj, ti));
117 spinv.
block(tj, ti)->transpose();
129 VectorXd incMean(maxDim);
131 std::vector<MySigmaPoint, Eigen::aligned_allocator<MySigmaPoint> > incrementPoints;
133 cerr <<
"sampleUnscented fail" << endl;
141 cerr <<
"FATAL: Edge::setMeasurementFromState() not implemented" << endl;
143 assert(smss &&
"Edge::setMeasurementFromState() not implemented");
146 std::vector<MySigmaPoint, Eigen::aligned_allocator<MySigmaPoint> > errorPoints(incrementPoints.size());
151 for (
size_t i=0; i<incrementPoints.size(); i++) {
156 for (
size_t j=0; j<e->
vertices().size(); j++){
164 for (
size_t j=0; j<e->
vertices().size(); j++){
169 vr->
oplus(&incrementPoints[i]._sample[cumPos]);
183 errorPoints[i]._sample=errorPoint;
184 errorPoints[i]._wi=incrementPoints[i]._wi;
185 errorPoints[i]._wp=incrementPoints[i]._wp;
188 for (
size_t j=0; j<e->
vertices().size(); j++){
202 info=errorCov.inverse();
int labelEdges(std::set< OptimizableGraph::Edge * > &edges)
virtual const double * errorData() const =0
returns the error vector cached after calling the computeError;
int dimension() const
returns the dimensions of the error function
SparseMatrixBlock * block(int r, int c, bool alloc=false)
returns the block at location r,c. if alloc=true he block is created if it does not exist ...
void reconstructGaussian(SampleType &mean, CovarianceType &covariance, const std::vector< SigmaPoint< SampleType >, Eigen::aligned_allocator< SigmaPoint< SampleType > > > &sigmaPoints)
EdgeLabeler(SparseOptimizer *optimizer)
int hessianIndex() const
temporary index of this node in the parameter vector obtained from linearization
virtual const double * informationData() const =0
returns the memory of the information matrix, usable for example with a Eigen::Map<MatrixXD> ...
void oplus(const double *v)
const VertexContainer & vertices() const
virtual void computeError()=0
void augmentSparsePattern(std::set< std::pair< int, int > > &pattern, OptimizableGraph::Edge *e)
virtual void push()=0
backup the position of the vertex to a stack
virtual void pop()=0
restore the position of the vertex by retrieving the position from the stack
virtual int minimalEstimateDimension() const
bool labelEdge(const SparseBlockMatrix< Eigen::MatrixXd > &spinv, OptimizableGraph::Edge *e)
bool sampleUnscented(std::vector< SigmaPoint< SampleType >, Eigen::aligned_allocator< SigmaPoint< SampleType > > > &sigmaPoints, const SampleType &mean, const CovarianceType &covariance)
A general case Vertex for optimization.
bool computePartialInverse(SparseBlockMatrix< Eigen::MatrixXd > &spinv, const std::set< std::pair< int, int > > &pattern)
virtual bool setMeasurementFromState()
SigmaPoint< VectorXd > MySigmaPoint
Sparse matrix which uses blocks.