Alias for DecisionTree of GaussianFactorGraphs and their scalar sums. More...
#include <HybridGaussianProductFactor.h>
Public Types | |
using | Base = DecisionTree< Key, GaussianFactorGraphValuePair > |
Public Types inherited from gtsam::DecisionTree< Key, GaussianFactorGraphValuePair > | |
using | Binary = std::function< GaussianFactorGraphValuePair(const GaussianFactorGraphValuePair &, const GaussianFactorGraphValuePair &)> |
using | CompareFunc = std::function< bool(const GaussianFactorGraphValuePair &, const GaussianFactorGraphValuePair &)> |
using | LabelC = std::pair< Key, size_t > |
using | LabelFormatter = std::function< std::string(Key)> |
using | NodePtr = typename Node::Ptr |
using | Unary = std::function< GaussianFactorGraphValuePair(const GaussianFactorGraphValuePair &)> |
using | UnaryAssignment = std::function< GaussianFactorGraphValuePair(const Assignment< Key > &, const GaussianFactorGraphValuePair &)> |
using | ValueFormatter = std::function< std::string(GaussianFactorGraphValuePair)> |
Public Member Functions | |
Constructors | |
HybridGaussianProductFactor ()=default | |
Default constructor. More... | |
template<class FACTOR > | |
HybridGaussianProductFactor (const std::shared_ptr< FACTOR > &factor) | |
Construct from a single factor. More... | |
HybridGaussianProductFactor (Base &&tree) | |
Construct from DecisionTree. More... | |
Operators | |
HybridGaussianProductFactor | operator+ (const GaussianFactor::shared_ptr &factor) const |
Add GaussianFactor into HybridGaussianProductFactor. More... | |
HybridGaussianProductFactor | operator+ (const HybridGaussianFactor &factor) const |
Add HybridGaussianFactor into HybridGaussianProductFactor. More... | |
HybridGaussianProductFactor & | operator+= (const GaussianFactor::shared_ptr &factor) |
Add-assign operator for GaussianFactor. More... | |
HybridGaussianProductFactor & | operator+= (const HybridGaussianFactor &factor) |
Add-assign operator for HybridGaussianFactor. More... | |
Testable | |
void | print (const std::string &s="", const KeyFormatter &formatter=DefaultKeyFormatter) const |
Print the HybridGaussianProductFactor. More... | |
bool | equals (const HybridGaussianProductFactor &other, double tol=1e-9) const |
Check if this HybridGaussianProductFactor is equal to another. More... | |
Other methods | |
HybridGaussianProductFactor | removeEmpty () const |
Remove empty GaussianFactorGraphs from the decision tree. More... | |
Public Member Functions inherited from gtsam::DecisionTree< Key, GaussianFactorGraphValuePair > | |
DecisionTree () | |
DecisionTree (const GaussianFactorGraphValuePair &y) | |
DecisionTree (const Key &label, const GaussianFactorGraphValuePair &y1, const GaussianFactorGraphValuePair &y2) | |
Create tree with 2 assignments y1 , y2 , splitting on variable label More... | |
DecisionTree (const LabelC &label, const GaussianFactorGraphValuePair &y1, const GaussianFactorGraphValuePair &y2) | |
DecisionTree (const std::vector< LabelC > &labelCs, const std::vector< GaussianFactorGraphValuePair > &ys) | |
DecisionTree (const std::vector< LabelC > &labelCs, const std::string &table) | |
DecisionTree (Iterator begin, Iterator end, const Key &label) | |
DecisionTree (const Key &label, const DecisionTree &f0, const DecisionTree &f1) | |
DecisionTree (const Unary &op, DecisionTree &&other) noexcept | |
Move constructor for DecisionTree. Very efficient as does not allocate anything, just changes in-place. But other is consumed. More... | |
DecisionTree (const DecisionTree< Key, X > &other, Func Y_of_X) | |
Convert from a different value type. More... | |
DecisionTree (const DecisionTree< M, X > &other, const std::map< M, Key > &map, Func Y_of_X) | |
Convert from a different value type X to value type Y, also translate labels via map from type M to L. More... | |
void | print (const std::string &s, const LabelFormatter &labelFormatter, const ValueFormatter &valueFormatter) const |
GTSAM-style print. More... | |
bool | equals (const DecisionTree &other, const CompareFunc &compare=&DefaultCompare) const |
virtual | ~DecisionTree ()=default |
Make virtual. More... | |
bool | empty () const |
Check if tree is empty. More... | |
bool | operator== (const DecisionTree &q) const |
const GaussianFactorGraphValuePair & | operator() (const Assignment< Key > &x) const |
void | visit (Func f) const |
Visit all leaves in depth-first fashion. More... | |
void | visitLeaf (Func f) const |
Visit all leaves in depth-first fashion. More... | |
void | visitWith (Func f) const |
Visit all leaves in depth-first fashion. More... | |
size_t | nrLeaves () const |
Return the number of leaves in the tree. More... | |
X | fold (Func f, X x0) const |
Fold a binary function over the tree, returning accumulator. More... | |
std::set< Key > | labels () const |
DecisionTree | apply (const Unary &op) const |
DecisionTree | apply (const UnaryAssignment &op) const |
Apply Unary operation "op" to f while also providing the corresponding assignment. More... | |
DecisionTree | apply (const DecisionTree &g, const Binary &op) const |
DecisionTree | choose (const Key &label, size_t index) const |
DecisionTree | combine (const Key &label, size_t cardinality, const Binary &op) const |
DecisionTree | combine (const LabelC &labelC, const Binary &op) const |
void | dot (std::ostream &os, const LabelFormatter &labelFormatter, const ValueFormatter &valueFormatter, bool showZero=true) const |
void | dot (const std::string &name, const LabelFormatter &labelFormatter, const ValueFormatter &valueFormatter, bool showZero=true) const |
std::string | dot (const LabelFormatter &labelFormatter, const ValueFormatter &valueFormatter, bool showZero=true) const |
std::pair< DecisionTree< Key, A >, DecisionTree< Key, B > > | split (std::function< std::pair< A, B >(const GaussianFactorGraphValuePair &)> AB_of_Y) const |
Convert into two trees with value types A and B. More... | |
DecisionTree (const NodePtr &root) | |
Additional Inherited Members | |
Static Public Member Functions inherited from gtsam::DecisionTree< Key, GaussianFactorGraphValuePair > | |
static NodePtr | compose (Iterator begin, Iterator end, const Key &label) |
Public Attributes inherited from gtsam::DecisionTree< Key, GaussianFactorGraphValuePair > | |
NodePtr | root_ |
A DecisionTree just contains the root. TODO(dellaert): make protected. More... | |
Static Protected Member Functions inherited from gtsam::DecisionTree< Key, GaussianFactorGraphValuePair > | |
static NodePtr | build (It begin, It end, ValueIt beginY, ValueIt endY) |
static NodePtr | convertFrom (const typename DecisionTree< Key, X >::NodePtr &f, std::function< GaussianFactorGraphValuePair(const X &)> Y_of_X) |
Convert from a DecisionTree<L, X> to DecisionTree<L, Y>. More... | |
static NodePtr | convertFrom (const typename DecisionTree< M, X >::NodePtr &f, std::function< Key(const M &)> L_of_M, std::function< GaussianFactorGraphValuePair(const X &)> Y_of_X) |
Convert from a DecisionTree<M, X> to DecisionTree<L, Y>. More... | |
static NodePtr | create (It begin, It end, ValueIt beginY, ValueIt endY) |
static bool | DefaultCompare (const GaussianFactorGraphValuePair &a, const GaussianFactorGraphValuePair &b) |
Default method for comparison of two objects of type Y. More... | |
Alias for DecisionTree of GaussianFactorGraphs and their scalar sums.
Definition at line 34 of file HybridGaussianProductFactor.h.
Definition at line 37 of file HybridGaussianProductFactor.h.
|
default |
Default constructor.
|
inline |
Construct from a single factor.
FACTOR | Factor type |
factor | Shared pointer to the factor |
Definition at line 51 of file HybridGaussianProductFactor.h.
|
inline |
Construct from DecisionTree.
tree | Decision tree to construct from |
Definition at line 58 of file HybridGaussianProductFactor.h.
bool gtsam::HybridGaussianProductFactor::equals | ( | const HybridGaussianProductFactor & | other, |
double | tol = 1e-9 |
||
) | const |
Check if this HybridGaussianProductFactor is equal to another.
other | The other HybridGaussianProductFactor to compare with |
tol | Tolerance for floating point comparisons |
Definition at line 88 of file HybridGaussianProductFactor.cpp.
HybridGaussianProductFactor gtsam::HybridGaussianProductFactor::operator+ | ( | const GaussianFactor::shared_ptr & | factor | ) | const |
Add GaussianFactor into HybridGaussianProductFactor.
Definition at line 51 of file HybridGaussianProductFactor.cpp.
HybridGaussianProductFactor gtsam::HybridGaussianProductFactor::operator+ | ( | const HybridGaussianFactor & | factor | ) | const |
Add HybridGaussianFactor into HybridGaussianProductFactor.
Definition at line 45 of file HybridGaussianProductFactor.cpp.
HybridGaussianProductFactor & gtsam::HybridGaussianProductFactor::operator+= | ( | const GaussianFactor::shared_ptr & | factor | ) |
Add-assign operator for GaussianFactor.
Definition at line 57 of file HybridGaussianProductFactor.cpp.
HybridGaussianProductFactor & gtsam::HybridGaussianProductFactor::operator+= | ( | const HybridGaussianFactor & | factor | ) |
Add-assign operator for HybridGaussianFactor.
Definition at line 64 of file HybridGaussianProductFactor.cpp.
void gtsam::HybridGaussianProductFactor::print | ( | const std::string & | s = "" , |
const KeyFormatter & | formatter = DefaultKeyFormatter |
||
) | const |
Print the HybridGaussianProductFactor.
Definition at line 71 of file HybridGaussianProductFactor.cpp.
HybridGaussianProductFactor gtsam::HybridGaussianProductFactor::removeEmpty | ( | ) | const |
Remove empty GaussianFactorGraphs from the decision tree.
If any GaussianFactorGraph in the decision tree contains a nullptr, convert that leaf to an empty GaussianFactorGraph with zero scalar sum. This is needed because the DecisionTree will otherwise create a GaussianFactorGraph with a single (null) factor, which doesn't register as null.
Definition at line 96 of file HybridGaussianProductFactor.cpp.