gtsam 4.2
gtsam
Loading...
Searching...
No Matches
gtsam::Conditional< FACTOR, DERIVEDCONDITIONAL > Class Template Reference

Serialization

class boost::serialization::access
 Serialization function.

Advanced Interface

FACTOR::const_iterator beginFrontals () const
 Iterator pointing to first frontal key.
FACTOR::const_iterator endFrontals () const
 Iterator pointing past the last frontal key.
FACTOR::const_iterator beginParents () const
 Iterator pointing to the first parent key.
FACTOR::const_iterator endParents () const
 Iterator pointing past the last parent key.
size_t & nrFrontals ()
 Mutable version of nrFrontals.
FACTOR::iterator beginFrontals ()
 Mutable iterator pointing to first frontal key.
FACTOR::iterator endFrontals ()
 Mutable iterator pointing past the last frontal key.
FACTOR::iterator beginParents ()
 Mutable iterator pointing to the first parent key.
FACTOR::iterator endParents ()
 Mutable iterator pointing past the last parent key.
template<class VALUES>
static bool CheckInvariants (const DERIVEDCONDITIONAL &conditional, const VALUES &x)
 Check invariants of this conditional, given the values x.

Public Member Functions

Testable
void print (const std::string &s="Conditional", const KeyFormatter &formatter=DefaultKeyFormatter) const
 print with optional formatter
bool equals (const This &c, double tol=1e-9) const
 check equality
Standard Interface
size_t nrFrontals () const
 return the number of frontals
size_t nrParents () const
 return the number of parents
Key firstFrontalKey () const
 Convenience function to get the first frontal key.
Frontals frontals () const
 return a view of the frontal keys
Parents parents () const
 return a view of the parent keys
virtual double logProbability (const HybridValues &c) const
 All conditional types need to implement a logProbability function, for which exp(logProbability(x)) = evaluate(x).
virtual double evaluate (const HybridValues &c) const
 All conditional types need to implement an evaluate function, that yields a true probability.
double operator() (const HybridValues &x) const
 Evaluate probability density, sugar.
virtual double logNormalizationConstant () const
 All conditional types need to implement a log normalization constant to make it such that error>=0.
double normalizationConstant () const
 Non-virtual, exponentiate logNormalizationConstant.

Public Types

typedef boost::iterator_range< typename FACTOR::const_iterator > Frontals
 View of the frontal keys (call frontals()).
typedef boost::iterator_range< typename FACTOR::const_iterator > Parents
 View of the separator keys (call parents()).

Protected Member Functions

Standard Constructors
 Conditional ()
 Empty Constructor to make serialization possible.
 Conditional (size_t nrFrontals)
 Constructor.

Protected Attributes

size_t nrFrontals_
 The first nrFrontal variables are frontal and the rest are parents.

Member Function Documentation

◆ CheckInvariants()

template<class FACTOR, class DERIVEDCONDITIONAL>
template<class VALUES>
bool gtsam::Conditional< FACTOR, DERIVEDCONDITIONAL >::CheckInvariants ( const DERIVEDCONDITIONAL & conditional,
const VALUES & x )
static

Check invariants of this conditional, given the values x.

It tests:

Parameters
conditionalThe conditional to test, as a reference to the derived type.
Template Parameters
VALUESHybridValues, or a more narrow type like DiscreteValues.

◆ evaluate()

template<class FACTOR, class DERIVEDCONDITIONAL>
double gtsam::Conditional< FACTOR, DERIVEDCONDITIONAL >::evaluate ( const HybridValues & c) const
virtual

All conditional types need to implement an evaluate function, that yields a true probability.

The default implementation just exponentiates logProbability.

Reimplemented in gtsam::DiscreteConditional, gtsam::GaussianConditional, gtsam::GaussianMixture, gtsam::HybridConditional, and gtsam::SymbolicConditional.

◆ logNormalizationConstant()

template<class FACTOR, class DERIVEDCONDITIONAL>
double gtsam::Conditional< FACTOR, DERIVEDCONDITIONAL >::logNormalizationConstant ( ) const
virtual

All conditional types need to implement a log normalization constant to make it such that error>=0.

Reimplemented in gtsam::DiscreteConditional, gtsam::GaussianConditional, gtsam::GaussianMixture, and gtsam::HybridConditional.

◆ logProbability()

template<class FACTOR, class DERIVEDCONDITIONAL>
double gtsam::Conditional< FACTOR, DERIVEDCONDITIONAL >::logProbability ( const HybridValues & c) const
virtual

All conditional types need to implement a logProbability function, for which exp(logProbability(x)) = evaluate(x).

Reimplemented in gtsam::DiscreteConditional, gtsam::GaussianConditional, gtsam::GaussianMixture, gtsam::HybridConditional, and gtsam::SymbolicConditional.


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