/** * @file GenericSequentialSolver.h * @brief * @author Richard Roberts * @created Oct 21, 2010 */ #pragma once #include #include #include #include namespace gtsam { template class GenericSequentialSolver { protected: // Store the original factors for computing marginals FactorGraph factors_; // Column structure of the factor graph VariableIndex<> structure_; // Elimination tree that performs elimination. typename EliminationTree::shared_ptr eliminationTree_; public: /** * Construct the solver for a factor graph. This builds the elimination * tree, which already does some of the symbolic work of elimination. */ GenericSequentialSolver(const FactorGraph& factorGraph); /** * Eliminate the factor graph sequentially. Uses a column elimination tree * to recursively eliminate. */ typename BayesNet::shared_ptr eliminate() const; /** * Compute the marginal Gaussian density over a variable, by integrating out * all of the other variables. This function returns the result as a factor. */ typename FACTOR::shared_ptr marginal(Index j) const; /** * Compute the marginal joint over a set of variables, by integrating out * all of the other variables. This function returns the result as a factor * graph. */ typename FactorGraph::shared_ptr joint(const std::vector& js) const; }; }