Renamed typedef name Conditional to ConditionalType
parent
d99d047a77
commit
85ed6c306d
|
|
@ -40,13 +40,13 @@ public:
|
|||
|
||||
typedef typename FACTOR::shared_ptr sharedFactor;
|
||||
typedef boost::shared_ptr<EliminationTree<FACTOR> > shared_ptr;
|
||||
typedef gtsam::BayesNet<typename FACTOR::Conditional> BayesNet;
|
||||
typedef gtsam::BayesNet<typename FACTOR::ConditionalType> BayesNet;
|
||||
|
||||
private:
|
||||
|
||||
typedef FastList<sharedFactor> Factors;
|
||||
typedef FastList<shared_ptr> SubTrees;
|
||||
typedef std::vector<typename FACTOR::Conditional::shared_ptr> Conditionals;
|
||||
typedef std::vector<typename FACTOR::ConditionalType::shared_ptr> Conditionals;
|
||||
|
||||
Index key_; /** index associated with root */
|
||||
Factors factors_; /** factors associated with root */
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ FactorBase<KEY>::FactorBase(const FactorBase<KEY>& f) : keys_(f.keys_) {}
|
|||
|
||||
/* ************************************************************************* */
|
||||
template<typename KEY>
|
||||
FactorBase<KEY>::FactorBase(const Conditional& c) : keys_(c.keys()) {}
|
||||
FactorBase<KEY>::FactorBase(const ConditionalType& c) : keys_(c.keys()) {}
|
||||
|
||||
/* ************************************************************************* */
|
||||
template<typename KEY>
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ template<class KEY> class ConditionalBase;
|
|||
* todo: Make NonlinearFactor derive from this too, which requires moving
|
||||
* Combine, eliminate*, permute* and the sorted key invariant to IndexFactor.
|
||||
*
|
||||
* Note that derived classes *must* redefine the Conditional and shared_ptr
|
||||
* Note that derived classes *must* redefine the ConditionalType and shared_ptr
|
||||
* typedefs to refer to the associated conditional and shared_ptr types of the
|
||||
* derived class. See IndexFactor, JacobianFactor, etc. for examples.
|
||||
*/
|
||||
|
|
@ -60,7 +60,7 @@ public:
|
|||
* Typedef to the conditional type obtained by eliminating this factor.
|
||||
* Derived classes must redefine this.
|
||||
*/
|
||||
typedef gtsam::ConditionalBase<Key> Conditional;
|
||||
typedef gtsam::ConditionalBase<Key> ConditionalType;
|
||||
|
||||
/** A shared_ptr to this class. Derived classes must redefine this. */
|
||||
typedef boost::shared_ptr<FactorBase> shared_ptr;
|
||||
|
|
@ -86,7 +86,7 @@ public:
|
|||
FactorBase(const This& f);
|
||||
|
||||
/** Construct from derived type */
|
||||
FactorBase(const Conditional& c);
|
||||
FactorBase(const ConditionalType& c);
|
||||
|
||||
/** Constructor from a collection of keys */
|
||||
template<class KEYITERATOR> FactorBase(KEYITERATOR beginKey, KEYITERATOR endKey) :
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ void GenericSequentialSolver<FACTOR>::replaceFactors(const typename FactorGraph<
|
|||
|
||||
/* ************************************************************************* */
|
||||
template<class FACTOR>
|
||||
typename BayesNet<typename FACTOR::Conditional>::shared_ptr GenericSequentialSolver<FACTOR>::eliminate() const {
|
||||
typename BayesNet<typename FACTOR::ConditionalType>::shared_ptr GenericSequentialSolver<FACTOR>::eliminate() const {
|
||||
return eliminationTree_->eliminate();
|
||||
}
|
||||
|
||||
|
|
@ -73,7 +73,7 @@ typename FactorGraph<FACTOR>::shared_ptr GenericSequentialSolver<FACTOR>::jointF
|
|||
}
|
||||
|
||||
// Eliminate all variables
|
||||
typename BayesNet<typename FACTOR::Conditional>::shared_ptr bayesNet(
|
||||
typename BayesNet<typename FACTOR::ConditionalType>::shared_ptr bayesNet(
|
||||
EliminationTree<FACTOR>::Create(*factors_)->eliminate());
|
||||
|
||||
// Undo the permuation on the original factors and on the structure.
|
||||
|
|
@ -85,7 +85,7 @@ typename FactorGraph<FACTOR>::shared_ptr GenericSequentialSolver<FACTOR>::jointF
|
|||
// Take the joint marginal from the Bayes net.
|
||||
typename FactorGraph<FACTOR>::shared_ptr joint(new FactorGraph<FACTOR>);
|
||||
joint->reserve(js.size());
|
||||
typename BayesNet<typename FACTOR::Conditional>::const_reverse_iterator conditional = bayesNet->rbegin();
|
||||
typename BayesNet<typename FACTOR::ConditionalType>::const_reverse_iterator conditional = bayesNet->rbegin();
|
||||
for(size_t i = 0; i < js.size(); ++i) {
|
||||
joint->push_back((*(conditional++))->toFactor()); }
|
||||
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ public:
|
|||
* Eliminate the factor graph sequentially. Uses a column elimination tree
|
||||
* to recursively eliminate.
|
||||
*/
|
||||
typename BayesNet<typename FACTOR::Conditional>::shared_ptr eliminate() const;
|
||||
typename BayesNet<typename FACTOR::ConditionalType>::shared_ptr eliminate() const;
|
||||
|
||||
/**
|
||||
* Compute the marginal joint over a set of variables, by integrating out
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ pair<BayesNet<IndexConditional>::shared_ptr, IndexFactor::shared_ptr> IndexFacto
|
|||
if(variables.size() < 1)
|
||||
throw invalid_argument("IndexFactor::CombineAndEliminate called on factors with zero total variables.");
|
||||
|
||||
pair<BayesNet<Conditional>::shared_ptr, shared_ptr> result;
|
||||
pair<BayesNet<ConditionalType>::shared_ptr, shared_ptr> result;
|
||||
result.first.reset(new BayesNet<IndexConditional>());
|
||||
FastSet<Index>::const_iterator var;
|
||||
for(var = variables.begin(); result.first->size() < nrFrontals; ++var)
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ namespace gtsam {
|
|||
typedef FactorBase<Index> Base;
|
||||
|
||||
/** Elimination produces an IndexConditional */
|
||||
typedef IndexConditional Conditional;
|
||||
typedef IndexConditional ConditionalType;
|
||||
|
||||
/** Overriding the shared_ptr typedef */
|
||||
typedef boost::shared_ptr<IndexFactor> shared_ptr;
|
||||
|
|
@ -83,7 +83,7 @@ namespace gtsam {
|
|||
/**
|
||||
* Combine and eliminate several factors.
|
||||
*/
|
||||
static std::pair<BayesNet<Conditional>::shared_ptr, shared_ptr> CombineAndEliminate(
|
||||
static std::pair<BayesNet<ConditionalType>::shared_ptr, shared_ptr> CombineAndEliminate(
|
||||
const FactorGraph<This>& factors, size_t nrFrontals=1);
|
||||
|
||||
/** Create a combined joint factor (new style for EliminationTree). */
|
||||
|
|
@ -94,12 +94,12 @@ namespace gtsam {
|
|||
* eliminate the first variable involved in this factor
|
||||
* @return a conditional on the eliminated variable
|
||||
*/
|
||||
boost::shared_ptr<Conditional> eliminateFirst();
|
||||
boost::shared_ptr<ConditionalType> eliminateFirst();
|
||||
|
||||
/**
|
||||
* eliminate the first nrFrontals frontal variables.
|
||||
*/
|
||||
boost::shared_ptr<BayesNet<Conditional> > eliminate(size_t nrFrontals = 1);
|
||||
boost::shared_ptr<BayesNet<ConditionalType> > eliminate(size_t nrFrontals = 1);
|
||||
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -171,7 +171,7 @@ namespace gtsam {
|
|||
// Now that we know which factors and variables, and where variables
|
||||
// come from and go to, create and eliminate the new joint factor.
|
||||
tic(2, "CombineAndEliminate");
|
||||
pair<typename BayesNet<typename FG::FactorType::Conditional>::shared_ptr, typename FG::sharedFactor> eliminated(
|
||||
pair<typename BayesNet<typename FG::FactorType::ConditionalType>::shared_ptr, typename FG::sharedFactor> eliminated(
|
||||
FG::FactorType::CombineAndEliminate(fg, current->frontal.size()));
|
||||
toc(2, "CombineAndEliminate");
|
||||
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ namespace gtsam {
|
|||
typedef typename ClusterTree<FG>::Cluster Clique;
|
||||
typedef typename Clique::shared_ptr sharedClique;
|
||||
|
||||
typedef class BayesTree<typename FG::FactorType::Conditional> BayesTree;
|
||||
typedef class BayesTree<typename FG::FactorType::ConditionalType> BayesTree;
|
||||
|
||||
typedef boost::shared_ptr<JunctionTree<FG> > shared_ptr;
|
||||
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ namespace gtsam {
|
|||
|
||||
enum SolveMethod { SOLVE_QR, SOLVE_PREFER_CHOLESKY };
|
||||
|
||||
typedef GaussianConditional Conditional;
|
||||
typedef GaussianConditional ConditionalType;
|
||||
typedef boost::shared_ptr<GaussianFactor> shared_ptr;
|
||||
|
||||
// Implementing Testable interface
|
||||
|
|
|
|||
|
|
@ -462,7 +462,7 @@ GaussianBayesNet::shared_ptr HessianFactor::splitEliminatedFactor(size_t nrFront
|
|||
|
||||
tic(2, "construct cond");
|
||||
const ublas::scalar_vector<double> sigmas(varDim, 1.0);
|
||||
conditionals->push_back(boost::make_shared<Conditional>(keys.begin()+j, keys.end(), 1, Ab, sigmas));
|
||||
conditionals->push_back(boost::make_shared<ConditionalType>(keys.begin()+j, keys.end(), 1, Ab, sigmas));
|
||||
toc(2, "construct cond");
|
||||
if(debug) conditionals->back()->print("Extracted conditional: ");
|
||||
Ab.rowStart() += varDim;
|
||||
|
|
|
|||
|
|
@ -449,7 +449,7 @@ namespace gtsam {
|
|||
size_t varDim = Ab_(0).size2();
|
||||
Ab_.rowEnd() = Ab_.rowStart() + varDim;
|
||||
const ublas::vector_range<const Vector> sigmas(noiseModel->sigmas(), ublas::range(Ab_.rowStart(), Ab_.rowEnd()));
|
||||
conditionals->push_back(boost::make_shared<Conditional>(keys_.begin()+j, keys_.end(), 1, Ab_, sigmas));
|
||||
conditionals->push_back(boost::make_shared<ConditionalType>(keys_.begin()+j, keys_.end(), 1, Ab_, sigmas));
|
||||
if(debug) conditionals->back()->print("Extracted conditional: ");
|
||||
Ab_.rowStart() += varDim;
|
||||
Ab_.firstBlock() += 1;
|
||||
|
|
|
|||
Loading…
Reference in New Issue