GTSAM  4.0.2
C++ library for smoothing and mapping (SAM)
Public Types | Protected Attributes | List of all members
gtsam::GaussianMixtureFactor Class Reference

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. More...

#include <GaussianMixtureFactor.h>

Inheritance diagram for gtsam::GaussianMixtureFactor:
Inheritance graph
[legend]
Collaboration diagram for gtsam::GaussianMixtureFactor:
Collaboration graph
[legend]

Public Types

using Base = HybridFactor
 
using This = GaussianMixtureFactor
 
using shared_ptr = std::shared_ptr< This >
 
using sharedFactor = std::shared_ptr< GaussianFactor >
 
using Factors = DecisionTree< Key, sharedFactor >
 typedef for Decision Tree of Gaussian factors and log-constant.
 
typedef KeyVector::iterator iterator
 Iterator over keys.
 
typedef KeyVector::const_iterator const_iterator
 Const iterator over keys.
 

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. More...
 
 GaussianMixtureFactor (const KeyVector &continuousKeys, const DiscreteKeys &discreteKeys, const std::vector< sharedFactor > &factors)
 Construct a new GaussianMixtureFactor object using a vector of GaussianFactor shared pointers. More...
 
Testable
bool equals (const HybridFactor &lf, double tol=1e-9) const override
 equals
 
void print (const std::string &s="GaussianMixtureFactor\, const KeyFormatter &formatter=DefaultKeyFormatter) const override
 print
 
Testable
bool equals (const This &other, double tol=1e-9) const
 check equality
 
virtual void printKeys (const std::string &s="Factor", const KeyFormatter &formatter=DefaultKeyFormatter) const
 print only keys
 
Standard Interface
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.
 
Standard Interface
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
 
const_iterator end () const
 
size_t size () const
 
Advanced Interface
KeyVectorkeys ()
 
iterator begin ()
 
iterator end ()
 

Static Protected Member Functions

Standard Constructors
template<typename CONTAINER >
static Factor FromKeys (const CONTAINER &keys)
 
template<typename ITERATOR >
static Factor FromIterators (ITERATOR first, ITERATOR last)
 

Protected Attributes

DiscreteKeys discreteKeys_
 
KeyVector continuousKeys_
 Record continuous keys for book-keeping.
 
KeyVector keys_
 The keys involved in this factor.
 

Standard API

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. More...
 
AlgebraicDecisionTree< Keyerror (const VectorValues &continuousValues) const
 Compute error of the GaussianMixtureFactor as a tree. More...
 
double error (const HybridValues &values) const override
 Compute the log-likelihood, including the log-normalizing constant. More...
 
GaussianFactorGraphTreeoperator+= (GaussianFactorGraphTree &sum, const GaussianMixtureFactor &factor)
 Add MixtureFactor to a Sum, syntactic sugar.
 

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.

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

◆ begin() [1/2]

const_iterator gtsam::Factor::begin ( ) const
inlineinherited

Iterator at beginning of involved variable keys

◆ begin() [2/2]

iterator gtsam::Factor::begin ( )
inlineinherited

Iterator at beginning of involved variable keys

◆ end() [1/2]

const_iterator gtsam::Factor::end ( ) const
inlineinherited

Iterator at end of involved variable keys

◆ end() [2/2]

iterator gtsam::Factor::end ( )
inlineinherited

Iterator at end of involved variable keys

◆ error() [1/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.

◆ error() [2/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.

◆ FromIterators()

template<typename ITERATOR >
static Factor gtsam::Factor::FromIterators ( ITERATOR  first,
ITERATOR  last 
)
inlinestaticprotectedinherited

Construct factor from iterator keys. This is called internally from derived factor static factor methods, as a workaround for not being able to call the protected constructors above.

◆ FromKeys()

template<typename CONTAINER >
static Factor gtsam::Factor::FromKeys ( const CONTAINER &  keys)
inlinestaticprotectedinherited

Construct factor from container of keys. This is called internally from derived factor static factor methods, as a workaround for not being able to call the protected constructors above.

◆ keys()

KeyVector& gtsam::Factor::keys ( )
inlineinherited
Returns
keys involved in this factor

◆ size()

size_t gtsam::Factor::size ( ) const
inlineinherited
Returns
the number of variables involved in this factor

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