30 : values_(solution), factorization_(factorization) {
31 gttic(MarginalsConstructor);
40 gttic(MarginalsConstructor);
48 gttic(MarginalsConstructor);
56 gttic(MarginalsConstructor);
63 gttic(MarginalsConstructor);
64 for (
const auto& keyValue: solution) {
74 gttic(MarginalsConstructor);
75 for (
const auto& keyValue: solution) {
121 throw std::runtime_error(
"Marginals::marginalFactor: Unknown factorization");
149 if(variables.size() == 1)
152 std::vector<size_t> dims;
153 dims.push_back(info.rows());
160 if(variables.size() == 2) {
174 Matrix info = augmentedInfo.topLeftCorner(augmentedInfo.rows()-1, augmentedInfo.cols()-1);
178 std::sort(variablesSorted.begin(), variablesSorted.end());
181 std::vector<size_t> dims;
182 dims.reserve(variablesSorted.size());
183 for(
const auto&
key: variablesSorted) {
198 cout << s <<
"Joint marginal on keys ";
200 for(
const auto&
key: keys_) {
207 cout <<
". Use 'at' or 'operator()' to query matrix blocks." << endl;
const gtsam::Symbol key('X', 0)
Matrix marginalCovariance(Key variable) const
GaussianFactorGraph graph_
const ValueType at(Key j) const
VectorValues optimize() const
std::shared_ptr< BayesTreeType > marginalMultifrontalBayesTree(const Ordering &variables, const Eliminate &function=EliminationTraitsType::DefaultEliminate, OptionalVariableIndex variableIndex={}) const
Matrix marginalInformation(Key variable) const
std::pair< std::shared_ptr< GaussianConditional >, std::shared_ptr< GaussianFactor > > EliminatePreferCholesky(const GaussianFactorGraph &factors, const Ordering &keys)
Matrix augmentedHessian(const Ordering &ordering) const
void print(const std::string &s="", const KeyFormatter &formatter=DefaultKeyFormatter) const
NonlinearFactorGraph graph
static enum @1107 ordering
virtual void print(const std::string &s="FactorGraph", const KeyFormatter &formatter=DefaultKeyFormatter) const
Print out graph to std::cout, with optional key formatter.
const KeyFormatter & formatter
std::shared_ptr< GaussianFactorGraph > linearize(const Values &linearizationPoint) const
Linearize a nonlinear factor graph.
void invertInPlace()
Invert the entire active matrix in place.
JointMarginal jointMarginalCovariance(const KeyVector &variables) const
void print(const std::string &str="", const KeyFormatter &keyFormatter=DefaultKeyFormatter) const
GaussianBayesTree bayesTree_
SymmetricBlockMatrix blockMatrix_
VectorValues optimize() const
Marginals()
Default constructor only for wrappers.
Contains the HessianFactor class, a general quadratic factor.
void print(const std::string &s="", const KeyFormatter &keyFormatter=DefaultKeyFormatter) const
std::pair< GaussianConditional::shared_ptr, JacobianFactor::shared_ptr > EliminateQR(const GaussianFactorGraph &factors, const Ordering &keys)
OrderingType
Type of ordering to use.
std::function< std::string(Key)> KeyFormatter
Typedef for a function to format a key, i.e. to convert it to a string.
JointMarginal jointMarginalInformation(const KeyVector &variables) const
std::shared_ptr< This > shared_ptr
shared_ptr to this class
Factorization factorization_
std::shared_ptr< BayesTreeType > eliminateMultifrontal(OptionalOrderingType orderingType={}, const Eliminate &function=EliminationTraitsType::DefaultEliminate, OptionalVariableIndex variableIndex={}) const
void print(const std::string &str="Marginals: ", const KeyFormatter &keyFormatter=DefaultKeyFormatter) const
void insert(Key j, const Value &val)
A class for computing marginals in a NonlinearFactorGraph.
sharedFactorGraph joint(Key j1, Key j2, const Eliminate &function=EliminationTraitsType::DefaultEliminate) const
FastVector< Key > KeyVector
Define collection type once and for all - also used in wrappers.
sharedConditional marginalFactor(Key j, const Eliminate &function=EliminationTraitsType::DefaultEliminate) const
std::uint64_t Key
Integer nonlinear key type.
GaussianFactor::shared_ptr marginalFactor(Key variable) const