/* ---------------------------------------------------------------------------- * GTSAM Copyright 2010, Georgia Tech Research Corporation, * Atlanta, Georgia 30332-0415 * All Rights Reserved * Authors: Frank Dellaert, et al. (see THANKS for the full author list) * See LICENSE for the license information * -------------------------------------------------------------------------- */ /** * @file IndexFactor.h * @brief * @author Richard Roberts * @created Oct 17, 2010 */ #pragma once #include #include namespace gtsam { class IndexConditional; class IndexFactor : public FactorBase { public: typedef IndexFactor This; typedef FactorBase Base; typedef IndexConditional Conditional; typedef boost::shared_ptr shared_ptr; /** Copy constructor */ IndexFactor(const This& f) : Base(static_cast(f)) {} /** Construct from derived type */ IndexFactor(const IndexConditional& c); /** Constructor from a collection of keys */ template IndexFactor(KeyIterator beginKey, KeyIterator endKey) : Base(beginKey, endKey) {} /** Default constructor for I/O */ IndexFactor() {} /** Construct unary factor */ IndexFactor(Index j) : Base(j) {} /** Construct binary factor */ IndexFactor(Index j1, Index j2) : Base(j1, j2) {} /** Construct ternary factor */ IndexFactor(Index j1, Index j2, Index j3) : Base(j1, j2, j3) {} /** Construct 4-way factor */ IndexFactor(Index j1, Index j2, Index j3, Index j4) : Base(j1, j2, j3, j4) {} /** Create a combined joint factor (new style for EliminationTree). */ static shared_ptr Combine(const FactorGraph& factors, const FastMap >& variableSlots); template static shared_ptr Combine(const FACTORGRAPHTYPE& factorGraph, const VariableIndex& variableIndex, const std::vector& factors, const std::vector& variables, const std::vector >& variablePositions) { return Base::Combine(factorGraph, variableIndex, factors, variables, variablePositions); } /** * eliminate the first variable involved in this factor * @return a conditional on the eliminated variable */ boost::shared_ptr eliminateFirst(); /** * eliminate the first nrFrontals frontal variables. */ boost::shared_ptr > eliminate(size_t nrFrontals = 1); }; }