34 class GaussianFactorGraph;
36 class GaussianConditional;
37 class GaussianBayesNet;
38 class GaussianEliminationTree;
39 class GaussianBayesTree;
40 class GaussianJunctionTree;
52 static std::pair<boost::shared_ptr<ConditionalType>, boost::shared_ptr<FactorType> >
55 return EliminatePreferCholesky(factors, keys); }
80 template<
typename ITERATOR>
84 template<
class CONTAINER>
88 template<
class DERIVEDFACTOR>
97 bool equals(
const This& fg,
double tol = 1e-9)
const;
108 void add(
const Vector& b) {
113 const Vector& b,
const SharedDiagonal& model = SharedDiagonal()) {
118 Key key2,
const Matrix& A2,
119 const Vector& b,
const SharedDiagonal& model = SharedDiagonal()) {
124 Key key2,
const Matrix& A2,
125 Key key3,
const Matrix& A3,
126 const Vector& b,
const SharedDiagonal& model = SharedDiagonal()) {
130 template<
class TERMS>
131 void add(
const TERMS& terms,
const Vector &b,
const SharedDiagonal& model = SharedDiagonal()) {
142 std::map<Key, size_t> getKeyDimMap()
const;
144 std::vector<size_t> getkeydim()
const;
148 double total_error = 0.;
151 total_error += factor->error(x);
158 return exp(-0.5 * error(c));
190 std::vector<boost::tuple<size_t, size_t, double> > sparseJacobian()
const;
197 Matrix sparseJacobian_()
const;
206 Matrix augmentedJacobian(boost::optional<const Ordering&> optionalOrdering = boost::none)
const;
215 std::pair<Matrix,Vector> jacobian(boost::optional<const Ordering&> optionalOrdering = boost::none)
const;
228 Matrix augmentedHessian(boost::optional<const Ordering&> optionalOrdering = boost::none)
const;
236 std::pair<Matrix,Vector> hessian(boost::optional<const Ordering&> optionalOrdering = boost::none)
const;
242 virtual std::map<Key,Matrix> hessianBlockDiagonal()
const;
249 const Eliminate&
function = EliminationTraitsType::DefaultEliminate)
const;
310 void multiplyHessianAdd(
double alpha,
const VectorValues& x,
314 void multiplyHessianAdd(
double alpha,
const double* x,
321 void multiplyInPlace(
const VectorValues& x,
const Errors::iterator& e)
const;
327 friend class boost::serialization::access;
328 template<
class ARCHIVE>
329 void serialize(ARCHIVE & ar,
const unsigned int version) {
330 ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP(
Base);
339 GTSAM_EXPORT
bool hasConstraints(
const GaussianFactorGraph& factors);
void add(const sharedFactor &factor)
Add a factor by pointer - stores pointer without copying the factor.
Definition: GaussianFactorGraph.h:105
void transposeMultiplyAdd(double alpha, const Matrix &A, const Vector &e, Vector &x)
BLAS Level-2 style x <- x + alpha*A'*e.
Definition: Matrix.cpp:168
GaussianEliminationTree EliminationTreeType
Type of elimination tree.
Definition: GaussianFactorGraph.h:49
GaussianFactorGraph(const FactorGraph< DERIVEDFACTOR > &graph)
Implicit copy/downcast constructor to override explicit template container constructor.
Definition: GaussianFactorGraph.h:89
virtual ~GaussianFactorGraph()
Virtual destructor.
Definition: GaussianFactorGraph.h:92
Variable elimination algorithms for factor graphs.
A factor graph is a bipartite graph with factor nodes connected to variable nodes.
Definition: BayesTree.h:32
double error(const VectorValues &x) const
unnormalized error
Definition: GaussianFactorGraph.h:147
A Bayes net made from linear-Gaussian densities.
Definition: GaussianBayesNet.h:30
GaussianBayesNet BayesNetType
Type of Bayes net from sequential elimination.
Definition: GaussianFactorGraph.h:48
GaussianFactor FactorType
Type of factors in factor graph.
Definition: GaussianFactorGraph.h:45
bool hasConstraints(const GaussianFactorGraph &factors)
Evaluates whether linear factors have any constrained noise models.
Definition: GaussianFactorGraph.cpp:383
void add(const GaussianFactor &factor)
Add a factor by value - makes a copy.
Definition: GaussianFactorGraph.h:102
Contains the HessianFactor class, a general quadratic factor.
A Gaussian factor in the squared-error form.
Definition: JacobianFactor.h:82
Definition: GaussianEliminationTree.h:27
void add(Key key1, const Matrix &A1, Key key2, const Matrix &A2, const Vector &b, const SharedDiagonal &model=SharedDiagonal())
Add a binary factor.
Definition: GaussianFactorGraph.h:117
GaussianFactorGraph FactorGraphType
Type of the factor graph (e.g. GaussianFactorGraph)
Definition: GaussianFactorGraph.h:46
GaussianFactorGraph()
Default constructor.
Definition: GaussianFactorGraph.h:77
Point2 operator*(double s, const Point2 &p)
multiply with scalar
Definition: Point2.h:249
boost::shared_ptr< GaussianFactor > sharedFactor
Shared pointer to a factor.
Definition: FactorGraph.h:84
static std::pair< boost::shared_ptr< ConditionalType >, boost::shared_ptr< FactorType > > DefaultEliminate(const FactorGraphType &factors, const Ordering &keys)
The default dense elimination function.
Definition: GaussianFactorGraph.h:54
A factor with a quadratic error function - a Gaussian.
boost::shared_ptr< This > shared_ptr
shared_ptr to this class
Definition: GaussianFactorGraph.h:74
GaussianBayesTree BayesTreeType
Type of Bayes tree.
Definition: GaussianFactorGraph.h:50
GaussianFactorGraph(ITERATOR firstFactor, ITERATOR lastFactor)
Construct from iterator over factors.
Definition: GaussianFactorGraph.h:81
Template to create a binary predicate.
Definition: Testable.h:102
void add(Key key1, const Matrix &A1, Key key2, const Matrix &A2, Key key3, const Matrix &A3, const Vector &b, const SharedDiagonal &model=SharedDiagonal())
Add a ternary factor.
Definition: GaussianFactorGraph.h:123
GaussianConditional ConditionalType
Type of conditionals from elimination.
Definition: GaussianFactorGraph.h:47
size_t Key
Integer nonlinear key type.
Definition: types.h:59
virtual GaussianFactor::shared_ptr clone() const =0
Clone a factor (make a deep copy)
Point3 optimize(const NonlinearFactorGraph &graph, const Values &values, Key landmarkKey)
Optimize for triangulation.
Definition: triangulation.cpp:72
double probPrime(const VectorValues &c) const
Unnormalized probability.
Definition: GaussianFactorGraph.h:157
Definition: GaussianJunctionTree.h:48
GaussianFactorGraph(const CONTAINER &factors)
Construct from container of factors (shared_ptr or plain objects)
Definition: GaussianFactorGraph.h:85
This class represents a collection of vector-valued variables associated each with a unique integer i...
Definition: VectorValues.h:89
void add(Key key1, const Matrix &A1, const Vector &b, const SharedDiagonal &model=SharedDiagonal())
Add a unary factor.
Definition: GaussianFactorGraph.h:112
Traits class for eliminateable factor graphs, specifies the types that result from elimination...
Definition: BayesTreeCliqueBase.h:28
void add(const Vector &b)
Add a null factor.
Definition: GaussianFactorGraph.h:108
EliminateableFactorGraph< This > BaseEliminateable
Typedef to base elimination class.
Definition: GaussianFactorGraph.h:73
GaussianFactorGraph This
Typedef to this class.
Definition: GaussianFactorGraph.h:71
A Linear Factor Graph is a factor graph where all factors are Gaussian, i.e.
Definition: GaussianFactorGraph.h:65
Definition: Ordering.h:30
vector of errors
Definition: Errors.h:33
FactorGraph< GaussianFactor > Base
Typedef to base factor graph type.
Definition: GaussianFactorGraph.h:72
void add(const TERMS &terms, const Vector &b, const SharedDiagonal &model=SharedDiagonal())
Add an n-ary factor.
Definition: GaussianFactorGraph.h:131
A conditional Gaussian functions as the node in a Bayes network It has a set of parents y...
Definition: GaussianConditional.h:36
A Bayes tree representing a Gaussian density.
Definition: GaussianBayesTree.h:49
GaussianJunctionTree JunctionTreeType
Type of Junction tree.
Definition: GaussianFactorGraph.h:51
EliminateableFactorGraph is a base class for factor graphs that contains elimination algorithms...
Definition: EliminateableFactorGraph.h:56
FastSet< Key > Keys
Return the set of variables involved in the factors (computes a set union).
Definition: GaussianFactorGraph.h:138
An abstract virtual base class for JacobianFactor and HessianFactor.
Definition: GaussianFactor.h:35