Add full elimination

release/4.3a0
Fan Jiang 2022-03-12 12:42:58 -05:00
parent 53551e051d
commit 095f6ad7cc
2 changed files with 20 additions and 5 deletions

View File

@ -70,17 +70,19 @@ class HybridFactorGraph : public FactorGraph<HybridFactor>, public Eliminateable
public:
HybridFactorGraph() = default;
/** Construct from container of factors (shared_ptr or plain objects) */
template <class CONTAINER>
explicit HybridFactorGraph(const CONTAINER& factors) : Base(factors) {}
// /** Construct from container of factors (shared_ptr or plain objects) */
// template <class CONTAINER>
// explicit HybridFactorGraph(const CONTAINER& factors) : Base(factors) {}
/** Implicit copy/downcast constructor to override explicit template container
* constructor */
* constructor. In BayesTree this is used for:
* `cachedSeparatorMarginal_.reset(*separatorMarginal)`
* */
template <class DERIVEDFACTOR>
HybridFactorGraph(const FactorGraph<DERIVEDFACTOR>& graph) : Base(graph) {}
using FactorGraph::add;
/// Add a factor directly using a shared_ptr.
void add(JacobianFactor &&factor);
};

View File

@ -73,6 +73,19 @@ TEST(HybridFactorGraph, eliminateMultifrontal) {
GTSAM_PRINT(*result.second);
}
TEST(HybridFactorGraph, eliminateFullMultifrontal) {
HybridFactorGraph hfg;
DiscreteKey x(X(1), 2);
hfg.add(JacobianFactor(X(0), I_3x3, Z_3x1));
hfg.add(HybridDiscreteFactor(DecisionTreeFactor(x, {2, 8})));
auto result = hfg.eliminateMultifrontal();
GTSAM_PRINT(*result);
}
/* ************************************************************************* */
int main() {
TestResult tr;