Public Types | Private Types | List of all members
gtsam::BayesNet< CONDITIONAL > Class Template Reference

#include <BayesNet.h>

Inheritance diagram for gtsam::BayesNet< CONDITIONAL >:
Inheritance graph
[legend]

Public Types

typedef std::shared_ptr< CONDITIONAL > sharedConditional
 A shared pointer to a conditional. More...
 
- Public Types inherited from gtsam::FactorGraph< CONDITIONAL >
typedef FastVector< sharedFactor >::const_iterator const_iterator
 
typedef CONDITIONAL FactorType
 factor type More...
 
typedef FastVector< sharedFactor >::iterator iterator
 
typedef std::shared_ptr< CONDITIONAL > sharedFactor
 Shared pointer to a factor. More...
 
typedef sharedFactor value_type
 

Public Member Functions

Testable
void print (const std::string &s="BayesNet", const KeyFormatter &formatter=DefaultKeyFormatter) const override
 
Graph Display
void dot (std::ostream &os, const KeyFormatter &keyFormatter=DefaultKeyFormatter, const DotWriter &writer=DotWriter()) const
 Output to graphviz format, stream version. More...
 
std::string dot (const KeyFormatter &keyFormatter=DefaultKeyFormatter, const DotWriter &writer=DotWriter()) const
 Output to graphviz format string. More...
 
void saveGraph (const std::string &filename, const KeyFormatter &keyFormatter=DefaultKeyFormatter, const DotWriter &writer=DotWriter()) const
 output to file with graphviz format. More...
 
HybridValues methods
double logProbability (const HybridValues &x) const
 
double evaluate (const HybridValues &c) const
 
- Public Member Functions inherited from gtsam::FactorGraph< CONDITIONAL >
 FactorGraph (std::initializer_list< std::shared_ptr< DERIVEDFACTOR >> sharedFactors)
 
virtual ~FactorGraph ()=default
 
void reserve (size_t size)
 
IsDerived< DERIVEDFACTOR > push_back (std::shared_ptr< DERIVEDFACTOR > factor)
 Add a factor directly using a shared_ptr. More...
 
IsDerived< DERIVEDFACTOR > push_back (const DERIVEDFACTOR &factor)
 
IsDerived< DERIVEDFACTOR > emplace_shared (Args &&... args)
 Emplace a shared pointer to factor of given type. More...
 
IsDerived< DERIVEDFACTOR > add (std::shared_ptr< DERIVEDFACTOR > factor)
 add is a synonym for push_back. More...
 
std::enable_if< std::is_base_of< FactorType, DERIVEDFACTOR >::value, This >::typeoperator+= (std::shared_ptr< DERIVEDFACTOR > factor)
 Append factor to factor graph. More...
 
std::enable_if< std::is_base_of< FactorType, DERIVEDFACTOR >::value, This >::typeoperator, (std::shared_ptr< DERIVEDFACTOR > factor)
 Overload comma operator to allow for append chaining. More...
 
HasDerivedElementType< ITERATOR > push_back (ITERATOR firstFactor, ITERATOR lastFactor)
 
HasDerivedValueType< ITERATOR > push_back (ITERATOR firstFactor, ITERATOR lastFactor)
 Push back many factors with an iterator (factors are copied) More...
 
HasDerivedElementType< CONTAINER > push_back (const CONTAINER &container)
 
HasDerivedValueType< CONTAINER > push_back (const CONTAINER &container)
 Push back non-pointer objects in a container (factors are copied). More...
 
void add (const FACTOR_OR_CONTAINER &factorOrContainer)
 
Thisoperator+= (const FACTOR_OR_CONTAINER &factorOrContainer)
 
std::enable_if< std::is_base_of< This, typename CLIQUE::FactorGraphType >::value >::type push_back (const BayesTree< CLIQUE > &bayesTree)
 
FactorIndices add_factors (const CONTAINER &factors, bool useEmptySlots=false)
 
bool equals (const This &fg, double tol=1e-9) const
 Check equality up to tolerance. More...
 
size_t size () const
 
bool empty () const
 
const sharedFactor at (size_t i) const
 
sharedFactorat (size_t i)
 
std::shared_ptr< F > at (size_t i)
 
const std::shared_ptr< F > at (size_t i) const
 Const version of templated at method. More...
 
const sharedFactor operator[] (size_t i) const
 
sharedFactoroperator[] (size_t i)
 
const_iterator begin () const
 
const_iterator end () const
 
sharedFactor front () const
 
sharedFactor back () const
 
double error (const HybridValues &values) const
 
iterator begin ()
 
iterator end ()
 
virtual void resize (size_t size)
 
void remove (size_t i)
 
void replace (size_t index, sharedFactor factor)
 
iterator erase (iterator item)
 
iterator erase (iterator first, iterator last)
 
void dot (std::ostream &os, const KeyFormatter &keyFormatter=DefaultKeyFormatter, const DotWriter &writer=DotWriter()) const
 Output to graphviz format, stream version. More...
 
std::string dot (const KeyFormatter &keyFormatter=DefaultKeyFormatter, const DotWriter &writer=DotWriter()) const
 Output to graphviz format string. More...
 
void saveGraph (const std::string &filename, const KeyFormatter &keyFormatter=DefaultKeyFormatter, const DotWriter &writer=DotWriter()) const
 output to file with graphviz format. More...
 
size_t nrFactors () const
 
KeySet keys () const
 
KeyVector keyVector () const
 
bool exists (size_t idx) const
 

Protected Member Functions

Protected Constructors
 BayesNet ()
 
template<typename ITERATOR >
 BayesNet (ITERATOR firstConditional, ITERATOR lastConditional)
 
 BayesNet (std::initializer_list< sharedConditional > conditionals)
 
- Protected Member Functions inherited from gtsam::FactorGraph< CONDITIONAL >
bool isEqual (const FactorGraph &other) const
 Check exact equality of the factor pointers. Useful for derived ==. More...
 
 FactorGraph ()
 
 FactorGraph (ITERATOR firstFactor, ITERATOR lastFactor)
 
 FactorGraph (const CONTAINER &factors)
 

Private Types

typedef FactorGraph< CONDITIONAL > Base
 

Additional Inherited Members

- Protected Attributes inherited from gtsam::FactorGraph< CONDITIONAL >
FastVector< sharedFactorfactors_
 

Detailed Description

template<class CONDITIONAL>
class gtsam::BayesNet< CONDITIONAL >

A BayesNet is a tree of conditionals, stored in elimination order.

Definition at line 35 of file BayesNet.h.

Member Typedef Documentation

◆ Base

template<class CONDITIONAL >
typedef FactorGraph<CONDITIONAL> gtsam::BayesNet< CONDITIONAL >::Base
private

Definition at line 37 of file BayesNet.h.

◆ sharedConditional

template<class CONDITIONAL >
typedef std::shared_ptr<CONDITIONAL> gtsam::BayesNet< CONDITIONAL >::sharedConditional

A shared pointer to a conditional.

Definition at line 41 of file BayesNet.h.

Constructor & Destructor Documentation

◆ BayesNet() [1/3]

template<class CONDITIONAL >
gtsam::BayesNet< CONDITIONAL >::BayesNet ( )
inlineprotected

Default constructor as an empty BayesNet

Definition at line 48 of file BayesNet.h.

◆ BayesNet() [2/3]

template<class CONDITIONAL >
template<typename ITERATOR >
gtsam::BayesNet< CONDITIONAL >::BayesNet ( ITERATOR  firstConditional,
ITERATOR  lastConditional 
)
inlineprotected

Construct from iterator over conditionals

Definition at line 52 of file BayesNet.h.

◆ BayesNet() [3/3]

template<class CONDITIONAL >
gtsam::BayesNet< CONDITIONAL >::BayesNet ( std::initializer_list< sharedConditional conditionals)
inlineprotected

Constructor that takes an initializer list of shared pointers. BayesNet<SymbolicConditional> bn = {make_shared<SymbolicConditional>(), ...};

Definition at line 60 of file BayesNet.h.

Member Function Documentation

◆ dot() [1/2]

template<class CONDITIONAL >
std::string gtsam::BayesNet< CONDITIONAL >::dot ( const KeyFormatter keyFormatter = DefaultKeyFormatter,
const DotWriter writer = DotWriter() 
) const

Output to graphviz format string.

Definition at line 75 of file BayesNet-inst.h.

◆ dot() [2/2]

template<class CONDITIONAL >
void gtsam::BayesNet< CONDITIONAL >::dot ( std::ostream &  os,
const KeyFormatter keyFormatter = DefaultKeyFormatter,
const DotWriter writer = DotWriter() 
) const

Output to graphviz format, stream version.

Definition at line 45 of file BayesNet-inst.h.

◆ evaluate()

template<class CONDITIONAL >
double gtsam::BayesNet< CONDITIONAL >::evaluate ( const HybridValues c) const

Definition at line 104 of file BayesNet-inst.h.

◆ logProbability()

template<class CONDITIONAL >
double gtsam::BayesNet< CONDITIONAL >::logProbability ( const HybridValues x) const

Definition at line 94 of file BayesNet-inst.h.

◆ print()

template<class CONDITIONAL >
void gtsam::BayesNet< CONDITIONAL >::print ( const std::string &  s = "BayesNet< CONDITIONAL >",
const KeyFormatter formatter = DefaultKeyFormatter 
) const
overridevirtual

print out graph

Reimplemented from gtsam::FactorGraph< CONDITIONAL >.

Definition at line 31 of file BayesNet-inst.h.

◆ saveGraph()

template<class CONDITIONAL >
void gtsam::BayesNet< CONDITIONAL >::saveGraph ( const std::string &  filename,
const KeyFormatter keyFormatter = DefaultKeyFormatter,
const DotWriter writer = DotWriter() 
) const

output to file with graphviz format.

Definition at line 84 of file BayesNet-inst.h.


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


gtsam
Author(s):
autogenerated on Sun Dec 22 2024 04:23:31