gtsam
Loading...
Searching...
No Matches
gtsam::HybridGaussianProductFactor Class Reference

Detailed Description

Alias for DecisionTree of GaussianFactorGraphs and their scalar sums.

Inheritance diagram for gtsam::HybridGaussianProductFactor:

Public Member Functions

Constructors
 HybridGaussianProductFactor ()=default
 Default constructor.
template<class FACTOR>
 HybridGaussianProductFactor (const std::shared_ptr< FACTOR > &factor)
 Construct from a single factor.
 HybridGaussianProductFactor (Base &&tree)
 Construct from DecisionTree.
Operators
HybridGaussianProductFactor operator+ (const GaussianFactor::shared_ptr &factor) const
 Add GaussianFactor into HybridGaussianProductFactor.
HybridGaussianProductFactor operator+ (const HybridGaussianFactor &factor) const
 Add HybridGaussianFactor into HybridGaussianProductFactor.
HybridGaussianProductFactor & operator+= (const GaussianFactor::shared_ptr &factor)
 Add-assign operator for GaussianFactor.
HybridGaussianProductFactor & operator+= (const HybridGaussianFactor &factor)
 Add-assign operator for HybridGaussianFactor.
Testable
void print (const std::string &s="", const KeyFormatter &formatter=DefaultKeyFormatter) const
 Print the HybridGaussianProductFactor.
bool equals (const HybridGaussianProductFactor &other, double tol=1e-9) const
 Check if this HybridGaussianProductFactor is equal to another.
Other methods
HybridGaussianProductFactor removeEmpty () const
 Remove empty GaussianFactorGraphs from the decision tree.
Public Member Functions inherited from gtsam::DecisionTree< Key, GaussianFactorGraphValuePair >
 DecisionTree ()
 Default constructor (for serialization).
 DecisionTree (const GaussianFactorGraphValuePair &y)
 Create a constant.
 DecisionTree (const Key &label, const GaussianFactorGraphValuePair &y1, const GaussianFactorGraphValuePair &y2)
 Create tree with 2 assignments y1, y2, splitting on variable label.
 DecisionTree (const LabelC &label, const GaussianFactorGraphValuePair &y1, const GaussianFactorGraphValuePair &y2)
 Allow Label+Cardinality for convenience.
 DecisionTree (const std::vector< LabelC > &labelCs, const std::vector< GaussianFactorGraphValuePair > &ys)
 Create from keys and a corresponding vector of values.
 DecisionTree (const std::vector< LabelC > &labelCs, const std::string &table)
 Create from keys and string table.
 DecisionTree (Iterator begin, Iterator end, const Key &label)
 Create DecisionTree from others.
 DecisionTree (const Key &label, const DecisionTree &f0, const DecisionTree &f1)
 Create DecisionTree from two others.
 DecisionTree (const Unary &op, DecisionTree &&other) noexcept
 Move constructor for DecisionTree.
 DecisionTree (const DecisionTree< Key, X > &other, Func Y_of_X)
 Convert from a different value type.
 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.
void print (const std::string &s, const LabelFormatter &labelFormatter, const ValueFormatter &valueFormatter) const
 GTSAM-style print.
bool equals (const DecisionTree &other, const CompareFunc &compare=&DefaultCompare) const
virtual ~DecisionTree ()=default
 Make virtual.
bool empty () const
 Check if tree is empty.
bool operator== (const DecisionTree &q) const
 equality
const GaussianFactorGraphValuePair & operator() (const Assignment< Key > &x) const
 evaluate
void visit (Func f) const
 Visit all leaves in depth-first fashion.
void visitLeaf (Func f) const
 Visit all leaves in depth-first fashion.
void visitWith (Func f) const
 Visit all leaves in depth-first fashion.
size_t nrLeaves () const
 Return the number of leaves in the tree.
X fold (Func f, X x0) const
 Fold a binary function over the tree, returning accumulator.
std::set< Key > labels () const
 Retrieve all unique labels as a set.
DecisionTree apply (const Unary &op) const
 apply Unary operation "op" to f
DecisionTree apply (const UnaryAssignment &op) const
 Apply Unary operation "op" to f while also providing the corresponding assignment.
DecisionTree apply (const DecisionTree &g, const Binary &op) const
 apply binary operation "op" to f and g
DecisionTree choose (const Key &label, size_t index) const
 create a new function where value(label)==index It's like "restrict" in Darwiche09book pg329, 330?
DecisionTree restrict (const Assignment< Key > &assignment) const
 Choose multiple values.
DecisionTree combine (const Key &label, size_t cardinality, const Binary &op) const
 combine subtrees on key with binary operation "op"
DecisionTree combine (const LabelC &labelC, const Binary &op) const
 combine with LabelC for convenience
void dot (std::ostream &os, const LabelFormatter &labelFormatter, const ValueFormatter &valueFormatter, bool showZero=true) const
 output to graphviz format, stream version
void dot (const std::string &name, const LabelFormatter &labelFormatter, const ValueFormatter &valueFormatter, bool showZero=true) const
 output to graphviz format, open a file
std::string dot (const LabelFormatter &labelFormatter, const ValueFormatter &valueFormatter, bool showZero=true) const
 output to graphviz format string
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.
 DecisionTree (const NodePtr &root)

Public Types

using Base = DecisionTree<Key, GaussianFactorGraphValuePair>
Public Types inherited from gtsam::DecisionTree< Key, GaussianFactorGraphValuePair >
using LabelFormatter
using ValueFormatter
using CompareFunc
using Unary
 Handy typedefs for unary and binary function types.
using UnaryAssignment
using Binary
using LabelC
 A label annotated with cardinality.
using NodePtr
 ---------------------— Node base class ------------------------—

Additional Inherited Members

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.
Static Protected Member Functions inherited from gtsam::DecisionTree< Key, GaussianFactorGraphValuePair >
static bool DefaultCompare (const GaussianFactorGraphValuePair &a, const GaussianFactorGraphValuePair &b)
 Default method for comparison of two objects of type Y.
static NodePtr build (It begin, It end, ValueIt beginY, ValueIt endY)
 Internal recursive function to create from keys, cardinalities, and Y values.
static NodePtr create (It begin, It end, ValueIt beginY, ValueIt endY)
 Internal helper function to create a tree from keys, cardinalities, and Y values.
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>.
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>.

Constructor & Destructor Documentation

◆ HybridGaussianProductFactor() [1/2]

template<class FACTOR>
gtsam::HybridGaussianProductFactor::HybridGaussianProductFactor ( const std::shared_ptr< FACTOR > & factor)
inline

Construct from a single factor.

Template Parameters
FACTORFactor type
Parameters
factorShared pointer to the factor

◆ HybridGaussianProductFactor() [2/2]

gtsam::HybridGaussianProductFactor::HybridGaussianProductFactor ( Base && tree)
inline

Construct from DecisionTree.

Parameters
treeDecision tree to construct from

Member Function Documentation

◆ equals()

bool gtsam::HybridGaussianProductFactor::equals ( const HybridGaussianProductFactor & other,
double tol = 1e-9 ) const

Check if this HybridGaussianProductFactor is equal to another.

Parameters
otherThe other HybridGaussianProductFactor to compare with
tolTolerance for floating point comparisons
Returns
true if equal, false otherwise

◆ print()

void gtsam::HybridGaussianProductFactor::print ( const std::string & s = "",
const KeyFormatter & formatter = DefaultKeyFormatter ) const

Print the HybridGaussianProductFactor.

Parameters
sOptional string to prepend
formatterOptional key formatter

◆ removeEmpty()

HybridGaussianProductFactor gtsam::HybridGaussianProductFactor::removeEmpty ( ) const

Remove empty GaussianFactorGraphs from the decision tree.

Returns
A new HybridGaussianProductFactor with empty GaussianFactorGraphs removed

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.


The documentation for this class was generated from the following files:
  • /tmp/gtsam-4.3.0-doxygen.rsXPUS/source/gtsam/hybrid/HybridGaussianProductFactor.h
  • /tmp/gtsam-4.3.0-doxygen.rsXPUS/source/gtsam/hybrid/HybridGaussianProductFactor.cpp