GTSAM
4.0.2
C++ library for smoothing and mapping (SAM)
|
Implementation of a discrete conditional mixture factor. More...
#include <MixtureFactor.h>
Public Types | |
using | Base = HybridFactor |
using | This = MixtureFactor |
using | shared_ptr = std::shared_ptr< MixtureFactor > |
using | sharedFactor = std::shared_ptr< NonlinearFactor > |
using | Factors = DecisionTree< Key, sharedFactor > |
typedef for DecisionTree which has Keys as node labels and NonlinearFactor as leaf nodes. | |
typedef KeyVector::iterator | iterator |
Iterator over keys. | |
typedef KeyVector::const_iterator | const_iterator |
Const iterator over keys. | |
Public Member Functions | |
MixtureFactor (const KeyVector &keys, const DiscreteKeys &discreteKeys, const Factors &factors, bool normalized=false) | |
Construct from Decision tree. More... | |
template<typename FACTOR > | |
MixtureFactor (const KeyVector &keys, const DiscreteKeys &discreteKeys, const std::vector< std::shared_ptr< FACTOR >> &factors, bool normalized=false) | |
Convenience constructor that generates the underlying factor decision tree for us. More... | |
AlgebraicDecisionTree< Key > | error (const Values &continuousValues) const |
Compute error of the MixtureFactor as a tree. More... | |
double | error (const Values &continuousValues, const DiscreteValues &discreteValues) const |
Compute error of factor given both continuous and discrete values. More... | |
double | error (const HybridValues &values) const override |
Compute error of factor given hybrid values. More... | |
size_t | dim () const |
Get the dimension of the factor (number of rows on linearization). Returns the dimension of the first component factor. More... | |
GaussianFactor::shared_ptr | linearize (const Values &continuousValues, const DiscreteValues &discreteValues) const |
std::shared_ptr< GaussianMixtureFactor > | linearize (const Values &continuousValues) const |
Linearize all the continuous factors to get a GaussianMixtureFactor. | |
double | nonlinearFactorLogNormalizingConstant (const sharedFactor &factor, const Values &values) const |
void | print (const std::string &s="", const KeyFormatter &keyFormatter=DefaultKeyFormatter) const override |
print to stdout More... | |
bool | equals (const HybridFactor &other, double tol=1e-9) const override |
Check equality. | |
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 DiscreteKeys & | discreteKeys () const |
Return the discrete keys for this factor. | |
const KeyVector & | continuousKeys () 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 KeyVector & | keys () const |
Access the factor's involved variable keys. | |
const_iterator | begin () const |
const_iterator | end () const |
size_t | size () const |
Advanced Interface | |
KeyVector & | keys () |
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. | |
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 NonlinearFactor type of measurement.
This class stores all factors as HybridFactors which can then be typecast to one of (NonlinearFactor, GaussianFactor) which can then be checked to perform the correct operation.
|
inline |
Construct from Decision tree.
keys | Vector of keys for continuous factors. |
discreteKeys | Vector of discrete keys. |
factors | Decision tree with of shared factors. |
normalized | Flag indicating if the factor error is already normalized. |
|
inline |
Convenience constructor that generates the underlying factor decision tree for us.
Here it is important that the vector of factors has the correct number of elements based on the number of discrete keys and the cardinality of the keys, so that the decision tree is constructed appropriately.
FACTOR | The type of the factor shared pointers being passed in. Will be typecast to NonlinearFactor shared pointers. |
keys | Vector of keys for continuous factors. |
discreteKeys | Vector of discrete keys. |
factors | Vector of nonlinear factors. |
normalized | Flag indicating if the factor error is already normalized. |
|
inlineinherited |
Iterator at beginning of involved variable keys
|
inlineinherited |
Iterator at beginning of involved variable keys
|
inline |
Get the dimension of the factor (number of rows on linearization). Returns the dimension of the first component factor.
|
inlineinherited |
Iterator at end of involved variable keys
|
inlineinherited |
Iterator at end of involved variable keys
|
inline |
Compute error of the MixtureFactor as a tree.
continuousValues | The continuous values for which to compute the error. |
|
inline |
|
inlineoverridevirtual |
Compute error of factor given hybrid values.
values | The continuous Values and the discrete assignment. |
Reimplemented from gtsam::Factor.
|
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.
|
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.
|
inlineinherited |
|
inline |
Linearize specific nonlinear factors based on the assignment in discreteValues.
|
inline |
If the component factors are not already normalized, we want to compute their normalizing constants so that the resulting joint distribution is appropriately computed. Remember, this is the negative normalizing constant for the measurement likelihood (since we are minimizing the negative log-likelihood).
|
inlineoverridevirtual |
|
inlineinherited |