gtsam 4.2.0
gtsam
Loading...
Searching...
No Matches
gtsam::GaussianMixtureFactor Class Reference

Detailed Description

Implementation of a discrete conditional mixture factor.

Implements a joint discrete-continuous factor where the discrete variable serves to "select" a mixture component corresponding to a GaussianFactor type of measurement.

Represents the underlying Gaussian mixture as a Decision Tree, where the set of discrete variables indexes to the continuous gaussian distribution.

+ Inheritance diagram for gtsam::GaussianMixtureFactor:

Standard API

GaussianFactorGraphTreeoperator+= (GaussianFactorGraphTree &sum, const GaussianMixtureFactor &factor)
 Add MixtureFactor to a Sum, syntactic sugar.
 
sharedFactor operator() (const DiscreteValues &assignment) const
 Get factor at a given discrete assignment.
 
GaussianFactorGraphTree add (const GaussianFactorGraphTree &sum) const
 Combine the Gaussian Factor Graphs in sum and this while maintaining the original tree structure.
 
AlgebraicDecisionTree< Keyerror (const VectorValues &continuousValues) const
 Compute error of the GaussianMixtureFactor as a tree.
 
double error (const HybridValues &values) const override
 Compute the log-likelihood, including the log-normalizing constant.
 

Public Member Functions

Constructors
 GaussianMixtureFactor ()=default
 Default constructor, mainly for serialization.
 
 GaussianMixtureFactor (const KeyVector &continuousKeys, const DiscreteKeys &discreteKeys, const Factors &factors)
 Construct a new Gaussian mixture factor.
 
 GaussianMixtureFactor (const KeyVector &continuousKeys, const DiscreteKeys &discreteKeys, const std::vector< sharedFactor > &factors)
 Construct a new GaussianMixtureFactor object using a vector of GaussianFactor shared pointers.
 
Testable
bool equals (const HybridFactor &lf, double tol=1e-9) const override
 equals
 
void print (const std::string &s="GaussianMixtureFactor\n", const KeyFormatter &formatter=DefaultKeyFormatter) const override
 print
 
- Public Member Functions inherited from gtsam::HybridFactor
 HybridFactor ()=default
 Default constructor creates empty factor.
 
 HybridFactor (const KeyVector &keys)
 Construct hybrid factor from continuous keys.
 
 HybridFactor (const DiscreteKeys &discreteKeys)
 Construct hybrid factor from discrete keys.
 
 HybridFactor (const KeyVector &continuousKeys, const DiscreteKeys &discreteKeys)
 Construct a new Hybrid Factor object.
 
virtual ~HybridFactor ()=default
 Virtual destructor.
 
void print (const std::string &s="HybridFactor\n", const KeyFormatter &formatter=DefaultKeyFormatter) const override
 print
 
bool isDiscrete () const
 True if this is a factor of discrete variables only.
 
bool isContinuous () const
 True if this is a factor of continuous variables only.
 
bool isHybrid () const
 True is this is a Discrete-Continuous factor.
 
size_t nrContinuous () const
 Return the number of continuous variables in this factor.
 
const DiscreteKeysdiscreteKeys () const
 Return the discrete keys for this factor.
 
const KeyVectorcontinuousKeys () const
 Return only the continuous keys for this factor.
 
- Public Member Functions inherited from gtsam::Factor
virtual ~Factor ()=default
 Default destructor.
 
bool empty () const
 Whether the factor is empty (involves zero variables).
 
Key front () const
 First key.
 
Key back () const
 Last key.
 
const_iterator find (Key key) const
 find
 
const KeyVectorkeys () const
 Access the factor's involved variable keys.
 
const_iterator begin () const
 Iterator at beginning of involved variable keys.
 
const_iterator end () const
 Iterator at end of involved variable keys.
 
size_t size () const
 
virtual void printKeys (const std::string &s="Factor", const KeyFormatter &formatter=DefaultKeyFormatter) const
 print only keys
 
bool equals (const This &other, double tol=1e-9) const
 check equality
 
KeyVectorkeys ()
 
iterator begin ()
 Iterator at beginning of involved variable keys.
 
iterator end ()
 Iterator at end of involved variable keys.
 

Public Types

using Base = HybridFactor
 
using This = GaussianMixtureFactor
 
using shared_ptr = boost::shared_ptr< This >
 
using sharedFactor = boost::shared_ptr< GaussianFactor >
 
using Factors = DecisionTree< Key, sharedFactor >
 typedef for Decision Tree of Gaussian factors and log-constant.
 
- Public Types inherited from gtsam::HybridFactor
typedef HybridFactor This
 This class.
 
typedef boost::shared_ptr< HybridFactorshared_ptr
 shared_ptr to this class
 
typedef Factor Base
 Our base class.
 
- Public Types inherited from gtsam::Factor
typedef KeyVector::iterator iterator
 Iterator over keys.
 
typedef KeyVector::const_iterator const_iterator
 Const iterator over keys.
 

Friends

class boost::serialization::access
 Serialization function.
 

Additional Inherited Members

- Protected Member Functions inherited from gtsam::Factor
 Factor ()
 Default constructor for I/O.
 
template<typename CONTAINER >
 Factor (const CONTAINER &keys)
 Construct factor from container of keys.
 
template<typename ITERATOR >
 Factor (ITERATOR first, ITERATOR last)
 Construct factor from iterator keys.
 
- Static Protected Member Functions inherited from gtsam::Factor
template<typename CONTAINER >
static Factor FromKeys (const CONTAINER &keys)
 Construct factor from container of keys.
 
template<typename ITERATOR >
static Factor FromIterators (ITERATOR first, ITERATOR last)
 Construct factor from iterator keys.
 
- Protected Attributes inherited from gtsam::HybridFactor
DiscreteKeys discreteKeys_
 
KeyVector continuousKeys_
 Record continuous keys for book-keeping.
 
- Protected Attributes inherited from gtsam::Factor
KeyVector keys_
 The keys involved in this factor.
 

Constructor & Destructor Documentation

◆ GaussianMixtureFactor() [1/2]

gtsam::GaussianMixtureFactor::GaussianMixtureFactor ( const KeyVector continuousKeys,
const DiscreteKeys discreteKeys,
const Factors factors 
)

Construct a new Gaussian mixture factor.

Parameters
continuousKeysA vector of keys representing continuous variables.
discreteKeysA vector of keys representing discrete variables and their cardinalities.
factorsThe decision tree of Gaussian factors stored as the mixture density.

◆ GaussianMixtureFactor() [2/2]

gtsam::GaussianMixtureFactor::GaussianMixtureFactor ( const KeyVector continuousKeys,
const DiscreteKeys discreteKeys,
const std::vector< sharedFactor > &  factors 
)
inline

Construct a new GaussianMixtureFactor object using a vector of GaussianFactor shared pointers.

Parameters
continuousKeysVector of keys for continuous factors.
discreteKeysVector of discrete keys.
factorsVector of gaussian factor shared pointers.

Member Function Documentation

◆ add()

GaussianFactorGraphTree gtsam::GaussianMixtureFactor::add ( const GaussianFactorGraphTree sum) const

Combine the Gaussian Factor Graphs in sum and this while maintaining the original tree structure.

Parameters
sumDecision Tree of Gaussian Factor Graphs indexed by the variables.
Returns
Sum

◆ equals()

bool gtsam::GaussianMixtureFactor::equals ( const HybridFactor lf,
double  tol = 1e-9 
) const
overridevirtual

equals

Reimplemented from gtsam::HybridFactor.

◆ error() [1/2]

double gtsam::GaussianMixtureFactor::error ( const HybridValues values) const
overridevirtual

Compute the log-likelihood, including the log-normalizing constant.

Returns
double

Reimplemented from gtsam::Factor.

◆ error() [2/2]

AlgebraicDecisionTree< Key > gtsam::GaussianMixtureFactor::error ( const VectorValues continuousValues) const

Compute error of the GaussianMixtureFactor as a tree.

Parameters
continuousValuesThe continuous VectorValues.
Returns
AlgebraicDecisionTree<Key> A decision tree with the same keys as the factors involved, and leaf values as the error.

◆ print()

void gtsam::GaussianMixtureFactor::print ( const std::string &  s = "GaussianMixtureFactor\n",
const KeyFormatter formatter = DefaultKeyFormatter 
) const
overridevirtual

print

Reimplemented from gtsam::Factor.


The documentation for this class was generated from the following files: