gtsam  3.2.1
gtsam
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
JacobianFactorQR.h
1 /*
2  * @file JacobianFactorQR.h
3  * @brief Jacobianfactor that combines and eliminates points
4  * @date Oct 27, 2013
5  * @uthor Frank Dellaert
6  */
7 
8 #pragma once
9 #include <gtsam/slam/JacobianSchurFactor.h>
10 
11 namespace gtsam {
15 template<size_t D>
17 
19 
20 public:
21 
25  JacobianFactorQR(const std::vector<typename Base::KeyMatrix2D>& Fblocks,
26  const Matrix& E, const Matrix3& P, const Vector& b,
27  const SharedDiagonal& model = SharedDiagonal()) :
28  JacobianSchurFactor<D>() {
29  // Create a number of Jacobian factors in a factor graph
31  Symbol pointKey('p', 0);
32  size_t i = 0;
33  BOOST_FOREACH(const typename Base::KeyMatrix2D& it, Fblocks) {
34  gfg.add(pointKey, E.block<2, 3>(2 * i, 0), it.first, it.second,
35  b.segment<2>(2 * i), model);
36  i += 1;
37  }
38  //gfg.print("gfg");
39 
40  // eliminate the point
41  GaussianBayesNet::shared_ptr bn;
43  std::vector < Key > variables;
44  variables.push_back(pointKey);
45  boost::tie(bn, fg) = gfg.eliminatePartialSequential(variables, EliminateQR);
46  //fg->print("fg");
47 
48  JacobianFactor::operator=(JacobianFactor(*fg));
49  }
50 };
51 // class
52 
53 }// gtsam
Character and index key used in VectorValues, GaussianFactorGraph, GaussianFactor, etc.
Definition: Symbol.h:33
JacobianFactorQR(const std::vector< typename Base::KeyMatrix2D > &Fblocks, const Matrix &E, const Matrix3 &P, const Vector &b, const SharedDiagonal &model=SharedDiagonal())
Constructor.
Definition: JacobianFactorQR.h:25
void add(const GaussianFactor &factor)
Add a factor by value - makes a copy.
Definition: GaussianFactorGraph.h:102
JacobianFactor for Schur complement that uses Q noise model.
Definition: JacobianFactorQR.h:16
This is the base class for all factor types.
Definition: Factor.h:51
JacobianFactor()
default constructor for I/O
Definition: JacobianFactor.cpp:61
boost::shared_ptr< This > shared_ptr
shared_ptr to this class
Definition: GaussianFactorGraph.h:74
JacobianFactor for Schur complement that uses Q noise model.
Definition: JacobianSchurFactor.h:22
A Linear Factor Graph is a factor graph where all factors are Gaussian, i.e.
Definition: GaussianFactorGraph.h:65
std::pair< boost::shared_ptr< BayesNetType >, boost::shared_ptr< FactorGraphType > > eliminatePartialSequential(const Ordering &ordering, const Eliminate &function=EliminationTraitsType::DefaultEliminate, OptionalVariableIndex variableIndex=boost::none) const
Do sequential elimination of some variables, in ordering provided, to produce a Bayes net and a remai...
Definition: EliminateableFactorGraph-inst.h:97