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

#include <HybridFactor.h>

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

Public Types

typedef HybridFactor This
 This class.
 
typedef std::shared_ptr< HybridFactorshared_ptr
 shared_ptr to this class
 
typedef Factor Base
 Our base class.
 
typedef KeyVector::iterator iterator
 Iterator over keys.
 
typedef KeyVector::const_iterator const_iterator
 Const iterator over keys.
 

Public Member Functions

Standard Constructors
 HybridFactor ()=default
 
 HybridFactor (const KeyVector &keys)
 Construct hybrid factor from continuous keys. More...
 
 HybridFactor (const DiscreteKeys &discreteKeys)
 Construct hybrid factor from discrete keys. More...
 
 HybridFactor (const KeyVector &continuousKeys, const DiscreteKeys &discreteKeys)
 Construct a new Hybrid Factor object. More...
 
Testable
virtual bool equals (const HybridFactor &lf, double tol=1e-9) const
 equals
 
void print (const std::string &s="HybridFactor\, const KeyFormatter &formatter=DefaultKeyFormatter) const override
 print
 
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
 
virtual double error (const HybridValues &c) const
 
size_t size () const
 
Advanced Interface
KeyVectorkeys ()
 
iterator begin ()
 
iterator end ()
 
Testable
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
 

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.
 

Detailed Description

Base class for truly hybrid probabilistic factors

Examples:

a mixture of Gaussian and discrete distributions over a set of variables.

Constructor & Destructor Documentation

◆ HybridFactor() [1/4]

gtsam::HybridFactor::HybridFactor ( )
default

Default constructor creates empty factor

◆ HybridFactor() [2/4]

gtsam::HybridFactor::HybridFactor ( const KeyVector keys)
explicit

Construct hybrid factor from continuous keys.

Parameters
keysVector of continuous keys.

◆ HybridFactor() [3/4]

gtsam::HybridFactor::HybridFactor ( const DiscreteKeys discreteKeys)
explicit

Construct hybrid factor from discrete keys.

Parameters
keysVector of discrete keys.

◆ HybridFactor() [4/4]

gtsam::HybridFactor::HybridFactor ( const KeyVector continuousKeys,
const DiscreteKeys discreteKeys 
)

Construct a new Hybrid Factor object.

Parameters
continuousKeysVector of keys for continuous variables.
discreteKeysVector of keys for discrete variables.

Member Function Documentation

◆ 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()

virtual double gtsam::Factor::error ( const HybridValues c) const
virtualinherited

All factor types need to implement an error function. In factor graphs, this is the negative log-likelihood.

Reimplemented in gtsam::DecisionTreeFactor, gtsam::GaussianMixture, gtsam::HybridConditional, gtsam::MixtureFactor, gtsam::GaussianMixtureFactor, gtsam::SymbolicFactor, gtsam::NonlinearFactor, gtsam::DiscreteFactor, and gtsam::GaussianFactor.

◆ 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: