Classes | Public Types | Protected Attributes | Private Types | List of all members
gtsam::Conditional< FACTOR, DERIVEDCONDITIONAL > Class Template Reference

#include <Conditional.h>

Classes

struct  ConstFactorRangeIterator
 

Public Types

typedef std::pair< typename FACTOR::const_iterator, typename FACTOR::const_iterator > ConstFactorRange
 
typedef ConstFactorRangeIterator Frontals
 
typedef ConstFactorRangeIterator Parents
 

Public Member Functions

Testable
void print (const std::string &s="Conditional", const KeyFormatter &formatter=DefaultKeyFormatter) const
 
bool equals (const This &c, double tol=1e-9) const
 
Standard Interface
virtual ~Conditional ()
 
size_t nrFrontals () const
 
size_t nrParents () const
 
Key firstFrontalKey () const
 
Frontals frontals () const
 
Parents parents () const
 
virtual double logProbability (const HybridValues &c) const
 
virtual double evaluate (const HybridValues &c) const
 
double operator() (const HybridValues &x) const
 Evaluate probability density, sugar. More...
 
virtual double negLogConstant () const
 All conditional types need to implement this as the negative log of the normalization constant to make it such that error>=0. More...
 

Protected Member Functions

Standard Constructors
 Conditional ()
 
 Conditional (size_t nrFrontals)
 

Protected Attributes

size_t nrFrontals_
 

Private Types

typedef Conditional< FACTOR, DERIVEDCONDITIONAL > This
 Typedef to this class. More...
 

Private Member Functions

Serialization
FACTOR & asFactor ()
 
const FACTOR & asFactor () const
 

Advanced Interface

FACTOR::const_iterator beginFrontals () const
 
FACTOR::const_iterator endFrontals () const
 
FACTOR::const_iterator beginParents () const
 
FACTOR::const_iterator endParents () const
 
size_tnrFrontals ()
 
FACTOR::iterator beginFrontals ()
 
FACTOR::iterator endFrontals ()
 
FACTOR::iterator beginParents ()
 
FACTOR::iterator endParents ()
 
template<class VALUES >
static bool CheckInvariants (const DERIVEDCONDITIONAL &conditional, const VALUES &x)
 

Detailed Description

template<class FACTOR, class DERIVEDCONDITIONAL>
class gtsam::Conditional< FACTOR, DERIVEDCONDITIONAL >

Definition at line 63 of file Conditional.h.

Member Typedef Documentation

◆ ConstFactorRange

template<class FACTOR , class DERIVEDCONDITIONAL >
typedef std::pair<typename FACTOR::const_iterator, typename FACTOR::const_iterator> gtsam::Conditional< FACTOR, DERIVEDCONDITIONAL >::ConstFactorRange

A mini implementation of an iterator range, to share const views of frontals and parents.

Definition at line 77 of file Conditional.h.

◆ Frontals

template<class FACTOR , class DERIVEDCONDITIONAL >
typedef ConstFactorRangeIterator gtsam::Conditional< FACTOR, DERIVEDCONDITIONAL >::Frontals

View of the frontal keys (call frontals())

Definition at line 96 of file Conditional.h.

◆ Parents

template<class FACTOR , class DERIVEDCONDITIONAL >
typedef ConstFactorRangeIterator gtsam::Conditional< FACTOR, DERIVEDCONDITIONAL >::Parents

View of the separator keys (call parents())

Definition at line 99 of file Conditional.h.

◆ This

template<class FACTOR , class DERIVEDCONDITIONAL >
typedef Conditional<FACTOR,DERIVEDCONDITIONAL> gtsam::Conditional< FACTOR, DERIVEDCONDITIONAL >::This
private

Typedef to this class.

Definition at line 71 of file Conditional.h.

Constructor & Destructor Documentation

◆ Conditional() [1/2]

template<class FACTOR , class DERIVEDCONDITIONAL >
gtsam::Conditional< FACTOR, DERIVEDCONDITIONAL >::Conditional ( )
inlineprotected

Empty Constructor to make serialization possible

Definition at line 106 of file Conditional.h.

◆ Conditional() [2/2]

template<class FACTOR , class DERIVEDCONDITIONAL >
gtsam::Conditional< FACTOR, DERIVEDCONDITIONAL >::Conditional ( size_t  nrFrontals)
inlineprotected

Constructor

Definition at line 109 of file Conditional.h.

◆ ~Conditional()

template<class FACTOR , class DERIVEDCONDITIONAL >
virtual gtsam::Conditional< FACTOR, DERIVEDCONDITIONAL >::~Conditional ( )
inlinevirtual

Definition at line 128 of file Conditional.h.

Member Function Documentation

◆ asFactor() [1/2]

template<class FACTOR , class DERIVEDCONDITIONAL >
FACTOR& gtsam::Conditional< FACTOR, DERIVEDCONDITIONAL >::asFactor ( )
inlineprivate

Definition at line 231 of file Conditional.h.

◆ asFactor() [2/2]

template<class FACTOR , class DERIVEDCONDITIONAL >
const FACTOR& gtsam::Conditional< FACTOR, DERIVEDCONDITIONAL >::asFactor ( ) const
inlineprivate

Definition at line 234 of file Conditional.h.

◆ beginFrontals() [1/2]

template<class FACTOR , class DERIVEDCONDITIONAL >
FACTOR::iterator gtsam::Conditional< FACTOR, DERIVEDCONDITIONAL >::beginFrontals ( )
inline

Mutable iterator pointing to first frontal key.

Definition at line 195 of file Conditional.h.

◆ beginFrontals() [2/2]

template<class FACTOR , class DERIVEDCONDITIONAL >
FACTOR::const_iterator gtsam::Conditional< FACTOR, DERIVEDCONDITIONAL >::beginFrontals ( ) const
inline

Iterator pointing to first frontal key.

Definition at line 180 of file Conditional.h.

◆ beginParents() [1/2]

template<class FACTOR , class DERIVEDCONDITIONAL >
FACTOR::iterator gtsam::Conditional< FACTOR, DERIVEDCONDITIONAL >::beginParents ( )
inline

Mutable iterator pointing to the first parent key.

Definition at line 201 of file Conditional.h.

◆ beginParents() [2/2]

template<class FACTOR , class DERIVEDCONDITIONAL >
FACTOR::const_iterator gtsam::Conditional< FACTOR, DERIVEDCONDITIONAL >::beginParents ( ) const
inline

Iterator pointing to the first parent key.

Definition at line 186 of file Conditional.h.

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

  • evaluate >= 0.0
  • evaluate(x) == conditional(x)
  • exp(logProbability(x)) == evaluate(x)
  • negLogConstant() = -log(normalizationConstant())
  • error >= 0.0
  • logProbability(x) == -(negLogConstant() + error(x))
Parameters
conditionalThe conditional to test, as a reference to the derived type.
Template Parameters
VALUESHybridValues, or a more narrow type like DiscreteValues.

Definition at line 69 of file Conditional-inst.h.

◆ endFrontals() [1/2]

template<class FACTOR , class DERIVEDCONDITIONAL >
FACTOR::iterator gtsam::Conditional< FACTOR, DERIVEDCONDITIONAL >::endFrontals ( )
inline

Mutable iterator pointing past the last frontal key.

Definition at line 198 of file Conditional.h.

◆ endFrontals() [2/2]

template<class FACTOR , class DERIVEDCONDITIONAL >
FACTOR::const_iterator gtsam::Conditional< FACTOR, DERIVEDCONDITIONAL >::endFrontals ( ) const
inline

Iterator pointing past the last frontal key.

Definition at line 183 of file Conditional.h.

◆ endParents() [1/2]

template<class FACTOR , class DERIVEDCONDITIONAL >
FACTOR::iterator gtsam::Conditional< FACTOR, DERIVEDCONDITIONAL >::endParents ( )
inline

Mutable iterator pointing past the last parent key.

Definition at line 204 of file Conditional.h.

◆ endParents() [2/2]

template<class FACTOR , class DERIVEDCONDITIONAL >
FACTOR::const_iterator gtsam::Conditional< FACTOR, DERIVEDCONDITIONAL >::endParents ( ) const
inline

Iterator pointing past the last parent key.

Definition at line 189 of file Conditional.h.

◆ equals()

template<class FACTOR , class DERIVEDCONDITIONAL >
bool gtsam::Conditional< FACTOR, DERIVEDCONDITIONAL >::equals ( const This c,
double  tol = 1e-9 
) const

check equality

Definition at line 41 of file Conditional-inst.h.

◆ 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::GaussianConditional, gtsam::DiscreteConditional, gtsam::SymbolicConditional, gtsam::HybridGaussianConditional, and gtsam::HybridConditional.

Definition at line 55 of file Conditional-inst.h.

◆ firstFrontalKey()

template<class FACTOR , class DERIVEDCONDITIONAL >
Key gtsam::Conditional< FACTOR, DERIVEDCONDITIONAL >::firstFrontalKey ( ) const
inline

Convenience function to get the first frontal key

Definition at line 137 of file Conditional.h.

◆ frontals()

template<class FACTOR , class DERIVEDCONDITIONAL >
Frontals gtsam::Conditional< FACTOR, DERIVEDCONDITIONAL >::frontals ( ) const
inline

return a view of the frontal keys

Definition at line 145 of file Conditional.h.

◆ 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::GaussianConditional, gtsam::DiscreteConditional, gtsam::SymbolicConditional, gtsam::HybridGaussianConditional, and gtsam::HybridConditional.

Definition at line 48 of file Conditional-inst.h.

◆ negLogConstant()

template<class FACTOR , class DERIVEDCONDITIONAL >
double gtsam::Conditional< FACTOR, DERIVEDCONDITIONAL >::negLogConstant
virtual

All conditional types need to implement this as the negative log of the normalization constant to make it such that error>=0.

Returns
double

Definition at line 62 of file Conditional-inst.h.

◆ nrFrontals() [1/2]

template<class FACTOR , class DERIVEDCONDITIONAL >
size_t& gtsam::Conditional< FACTOR, DERIVEDCONDITIONAL >::nrFrontals ( )
inline

Mutable version of nrFrontals

Definition at line 192 of file Conditional.h.

◆ nrFrontals() [2/2]

template<class FACTOR , class DERIVEDCONDITIONAL >
size_t gtsam::Conditional< FACTOR, DERIVEDCONDITIONAL >::nrFrontals ( ) const
inline

return the number of frontals

Definition at line 131 of file Conditional.h.

◆ nrParents()

template<class FACTOR , class DERIVEDCONDITIONAL >
size_t gtsam::Conditional< FACTOR, DERIVEDCONDITIONAL >::nrParents ( ) const
inline

return the number of parents

Definition at line 134 of file Conditional.h.

◆ operator()()

template<class FACTOR , class DERIVEDCONDITIONAL >
double gtsam::Conditional< FACTOR, DERIVEDCONDITIONAL >::operator() ( const HybridValues x) const
inline

Evaluate probability density, sugar.

Definition at line 163 of file Conditional.h.

◆ parents()

template<class FACTOR , class DERIVEDCONDITIONAL >
Parents gtsam::Conditional< FACTOR, DERIVEDCONDITIONAL >::parents ( ) const
inline

return a view of the parent keys

Definition at line 148 of file Conditional.h.

◆ print()

template<class FACTOR , class DERIVEDCONDITIONAL >
void gtsam::Conditional< FACTOR, DERIVEDCONDITIONAL >::print ( const std::string &  s = "Conditional< FACTOR, DERIVEDCONDITIONAL >",
const KeyFormatter formatter = DefaultKeyFormatter 
) const

print with optional formatter

Definition at line 30 of file Conditional-inst.h.

Member Data Documentation

◆ nrFrontals_

template<class FACTOR , class DERIVEDCONDITIONAL >
size_t gtsam::Conditional< FACTOR, DERIVEDCONDITIONAL >::nrFrontals_
protected

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

Definition at line 67 of file Conditional.h.


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


gtsam
Author(s):
autogenerated on Fri Nov 1 2024 03:51:15