36 struct ChainedVector {
40 ChainedVector(
const T&
c) { result.push_back(c); }
47 operator Result() {
return result; }
50 const SymbolicFactorGraph simpleTestGraph1 {
51 std::make_shared<SymbolicFactor>(0,1),
52 std::make_shared<SymbolicFactor>(0,2),
53 std::make_shared<SymbolicFactor>(1,4),
54 std::make_shared<SymbolicFactor>(2,4),
55 std::make_shared<SymbolicFactor>(3,4)};
57 const SymbolicBayesNet simpleTestGraph1BayesNet {
58 std::make_shared<SymbolicConditional>(0,1,2),
59 std::make_shared<SymbolicConditional>(1,2,4),
60 std::make_shared<SymbolicConditional>(2,4),
61 std::make_shared<SymbolicConditional>(3,4),
62 std::make_shared<SymbolicConditional>(4)};
64 const SymbolicFactorGraph simpleTestGraph2 {
65 std::make_shared<SymbolicFactor>(0,1),
66 std::make_shared<SymbolicFactor>(0,2),
67 std::make_shared<SymbolicFactor>(1,3),
68 std::make_shared<SymbolicFactor>(1,4),
69 std::make_shared<SymbolicFactor>(2,3),
70 std::make_shared<SymbolicFactor>(4,5)};
73 const SymbolicFactorGraph simpleChain {
74 std::make_shared<SymbolicFactor>(1,0),
75 std::make_shared<SymbolicFactor>(0,2),
76 std::make_shared<SymbolicFactor>(2,3)};
82 SymbolicBayesTree __simpleChainBayesTree() {
84 result.insertRoot(std::make_shared<SymbolicBayesTreeClique>(
85 std::make_shared<SymbolicConditional>(
87 result.addClique(std::make_shared<SymbolicBayesTreeClique>(
88 std::make_shared<SymbolicConditional>(
90 result.roots().front());
94 const SymbolicBayesTree simpleChainBayesTree = __simpleChainBayesTree();
106 const SymbolicFactorGraph asiaGraph = {
107 std::make_shared<SymbolicFactor>(_T_),
108 std::make_shared<SymbolicFactor>(_S_),
109 std::make_shared<SymbolicFactor>(_T_, _E_,
_L_),
110 std::make_shared<SymbolicFactor>(
_L_, _S_),
111 std::make_shared<SymbolicFactor>(_S_,
_B_),
112 std::make_shared<SymbolicFactor>(_E_,
_B_),
113 std::make_shared<SymbolicFactor>(_E_, _X_)};
115 const SymbolicBayesNet asiaBayesNet = {
116 std::make_shared<SymbolicConditional>(_T_, _E_,
_L_),
117 std::make_shared<SymbolicConditional>(_X_, _E_),
118 std::make_shared<SymbolicConditional>(_E_,
_B_,
_L_),
119 std::make_shared<SymbolicConditional>(_S_, _B_,
_L_),
120 std::make_shared<SymbolicConditional>(
_L_,
_B_),
121 std::make_shared<SymbolicConditional>(_B_)};
126 using Children = ChainedVector<sharedClique>;
127 using Keys = ChainedVector<Key>;
129 inline sharedClique LeafClique(
const Keys::Result&
keys,
131 return std::make_shared<SymbolicBayesTreeClique>(
132 std::make_shared<SymbolicConditional>(
136 inline sharedClique NodeClique(
const Keys::Result& keys,
138 const Children::Result& children) {
139 sharedClique clique = LeafClique(keys, nrFrontals);
140 clique->children.assign(children.begin(), children.end());
141 for (
auto&& child : children) child->parent_ = clique;
147 SymbolicBayesTree __asiaBayesTree() {
149 result.insertRoot(LeafClique({_E_,
_L_,
_B_}, 3));
150 result.addClique(LeafClique({_S_,
_B_,
_L_}, 1), result.roots().front());
151 result.addClique(LeafClique({_T_, _E_, _L_}, 1), result.roots().front());
152 result.addClique(LeafClique({_X_, _E_}, 1), result.roots().front());
156 const SymbolicBayesTree asiaBayesTree = __asiaBayesTree();
159 const Ordering asiaOrdering{_X_, _T_, _S_, _E_,
_L_,
_B_};
static SymbolicConditional FromKeys(const CONTAINER &keys, size_t nrFrontals)
ptrdiff_t DenseIndex
The index type for Eigen objects.
std::shared_ptr< This > shared_ptr
FastVector< Key > KeyVector
Define collection type once and for all - also used in wrappers.
internal::enable_if< internal::valid_indexed_view_overload< RowIndices, ColIndices >::value &&internal::traits< typename EIGEN_INDEXED_VIEW_METHOD_TYPE< RowIndices, ColIndices >::type >::ReturnAsIndexedView, typename EIGEN_INDEXED_VIEW_METHOD_TYPE< RowIndices, ColIndices >::type >::type operator()(const RowIndices &rowIndices, const ColIndices &colIndices) EIGEN_INDEXED_VIEW_METHOD_CONST
An easy way to control which allocator is used for Fast* collections.
std::uint64_t Key
Integer nonlinear key type.