32 template<
class CLIQUE>
class BayesTree;
48 template<
class DERIVED,
class FACTORGRAPH>
133 const std::string&
s =
"",
144 inline bool isRoot()
const {
return parent_.expired(); }
153 derived_ptr
parent()
const {
return parent_.lock(); }
163 BayesNetType
shortcut(
const derived_ptr& root, Eliminate
function = EliminationTraitsType::DefaultEliminate)
const;
166 FactorGraphType
separatorMarginal(Eliminate
function = EliminationTraitsType::DefaultEliminate)
const;
169 FactorGraphType
marginal2(Eliminate
function = EliminationTraitsType::DefaultEliminate)
const;
178 std::lock_guard<std::mutex> marginalLock(cachedSeparatorMarginalMutex_);
196 std::lock_guard<std::mutex> marginalLock(cachedSeparatorMarginalMutex_);
197 cachedSeparatorMarginal_ = {};
202 #ifdef GTSAM_ENABLE_BOOST_SERIALIZATION 204 friend class boost::serialization::access;
205 template<
class ARCHIVE>
206 void serialize(ARCHIVE & ar,
const unsigned int ) {
207 if(!parent_.lock()) {
210 ar & BOOST_SERIALIZATION_NVP(is_root);
211 ar & BOOST_SERIALIZATION_NVP(conditional_);
213 ar & BOOST_SERIALIZATION_NVP(parent_);
215 ar & BOOST_SERIALIZATION_NVP(children);
FACTORGRAPH FactorGraphType
Typedefs for easier changing of types.
std::mutex cachedSeparatorMarginalMutex_
std::string serialize(const T &input)
serializes to a string
FactorGraphType::Eliminate Eliminate
void deleteCachedShortcutsNonRecursive()
BayesTreeCliqueBase(const BayesTreeCliqueBase &c)
Shallow copy constructor.
std::optional< FactorGraphType > cachedSeparatorMarginal_
This stores the Cached separator marginal P(S)
std::weak_ptr< This > weak_ptr
std::vector< T, typename internal::FastDefaultVectorAllocator< T >::type > FastVector
std::weak_ptr< DerivedType > derived_weak_ptr
EliminationTraitsType::BayesNetType BayesNetType
bool equals(const DERIVED &other, double tol=1e-9) const
BayesTreeCliqueBase(const sharedConditional &conditional)
std::shared_ptr< DerivedType > derived_ptr
virtual ~BayesTreeCliqueBase()
static const KeyFormatter DefaultKeyFormatter
const std::optional< FactorGraphType > & cachedSeparatorMarginal() const
void setEliminationResult(const typename FactorGraphType::EliminationResult &eliminationResult)
virtual void print(const std::string &s="", const KeyFormatter &keyFormatter=DefaultKeyFormatter) const
size_t numCachedSeparatorMarginals() const
std::function< EliminationResult(const FactorGraphType &, const Ordering &)> Eliminate
The function type that does a single dense elimination step on a subgraph.
derived_ptr parent() const
std::pair< std::shared_ptr< ConditionalType >, std::shared_ptr< _FactorType > > EliminationResult
std::shared_ptr< ConditionalType > sharedConditional
std::shared_ptr< This > shared_ptr
Array< double, 1, 3 > e(1./3., 0.5, 2.)
FastVector< derived_ptr > children
EliminationTraits< FACTORGRAPH > EliminationTraitsType
std::function< std::string(Key)> KeyFormatter
Typedef for a function to format a key, i.e. to convert it to a string.
A thin wrapper around std::vector that uses a custom allocator.
BayesNetType shortcut(const derived_ptr &root, Eliminate function=EliminationTraitsType::DefaultEliminate) const
void deleteCachedShortcuts()
FactorGraphType separatorMarginal(Eliminate function=EliminationTraitsType::DefaultEliminate) const
FactorGraphType marginal2(Eliminate function=EliminationTraitsType::DefaultEliminate) const
sharedConditional conditional_
BayesTreeCliqueBase()
Default constructor.
BayesTreeCliqueBase & operator=(const BayesTreeCliqueBase &c)
Shallow copy assignment constructor.
KeyVector shortcut_indices(const derived_ptr &B, const FactorGraphType &p_Cp_B) const
BayesTreeCliqueBase< DERIVED, FACTORGRAPH > This
KeyVector separator_setminus_B(const derived_ptr &B) const
Calculate set for shortcut calculations.
FastVector< Key > KeyVector
Define collection type once and for all - also used in wrappers.
const sharedConditional & conditional() const
BayesNetType::ConditionalType ConditionalType
FactorGraphType::FactorType FactorType