35 :
Base(continuousKeys, discreteKeys), factors_(factors) {}
39 const This *
e =
dynamic_cast<const This *
>(&lf);
40 if (e ==
nullptr)
return false;
50 return f1->equals(*f2, tol);
60 std::cout <<
" empty" << std::endl;
67 if (gf && !gf->empty()) {
68 gf->print(
"", formatter);
75 std::cout <<
"}" << std::endl;
108 auto errorFunc = [&continuousValues](
const sharedFactor &gf) {
109 return gf->error(continuousValues);
A set of GaussianFactors, indexed by a set of discrete keys.
Decision Tree for use in DiscreteFactors.
GaussianMixtureFactor()=default
Default constructor, mainly for serialization.
GaussianFactorGraphTree asGaussianFactorGraphTree() const
Helper function to return factors and functional to create a DecisionTree of Gaussian Factor Graphs...
Implementation of a discrete conditional mixture factor. Implements a joint discrete-continuous facto...
A factor with a quadratic error function - a Gaussian.
const GaussianFactorGraph factors
const VectorValues & continuous() const
Return the multi-dimensional vector values.
double f2(const Vector2 &x)
const KeyFormatter & formatter
AlgebraicDecisionTree< Key > error(const VectorValues &continuousValues) const
Compute error of the GaussianMixtureFactor as a tree.
void print(const std::string &s="HybridFactor\, const KeyFormatter &formatter=DefaultKeyFormatter) const override
print
std::string str() const
return the string
virtual bool equals(const HybridFactor &lf, double tol=1e-9) const
equals
Array< double, 1, 3 > e(1./3., 0.5, 2.)
std::shared_ptr< GaussianFactor > sharedFactor
Linear Factor Graph where all factors are Gaussians.
bool equals(const DecisionTree &other, const CompareFunc &compare=&DefaultCompare) const
DecisionTree apply(const Unary &op) const
std::function< std::string(Key)> KeyFormatter
Typedef for a function to format a key, i.e. to convert it to a string.
NonlinearFactorGraph graph2()
void print(const std::string &s, const LabelFormatter &labelFormatter, const ValueFormatter &valueFormatter) const
GTSAM-style print.
bool empty() const
Check if tree is empty.
bool equals(const HybridFactor &lf, double tol=1e-9) const override
equals
Point2 f1(const Point3 &p, OptionalJacobian< 2, 3 > H)
mxArray * wrap(const Class &value)
const DiscreteValues & discrete() const
Return the discrete values.
void print(const std::string &s="GaussianMixtureFactor\, const KeyFormatter &formatter=DefaultKeyFormatter) const override
print
FastVector< Key > KeyVector
Define collection type once and for all - also used in wrappers.
GaussianFactorGraphTree add(const GaussianFactorGraphTree &sum) const
Combine the Gaussian Factor Graphs in sum and this while maintaining the original tree structure...
sharedFactor operator()(const DiscreteValues &assignment) const
Get factor at a given discrete assignment.
std::uint64_t Key
Integer nonlinear key type.
Factors factors_
Decision tree of Gaussian factors indexed by discrete keys.
DiscreteKeys is a set of keys that can be assembled using the & operator.