DefaultOrderingFunc in EliminationTraits
parent
a3b177c604
commit
d82fcc0aa9
|
|
@ -62,9 +62,17 @@ template<> struct EliminationTraits<DiscreteFactorGraph>
|
|||
typedef DiscreteBayesTree BayesTreeType; ///< Type of Bayes tree
|
||||
typedef DiscreteJunctionTree JunctionTreeType; ///< Type of Junction tree
|
||||
/// The default dense elimination function
|
||||
static std::pair<boost::shared_ptr<ConditionalType>, boost::shared_ptr<FactorType> >
|
||||
static std::pair<boost::shared_ptr<ConditionalType>,
|
||||
boost::shared_ptr<FactorType> >
|
||||
DefaultEliminate(const FactorGraphType& factors, const Ordering& keys) {
|
||||
return EliminateDiscrete(factors, keys); }
|
||||
return EliminateDiscrete(factors, keys);
|
||||
}
|
||||
/// The default ordering generation function
|
||||
static Ordering DefaultOrderingFunc(
|
||||
const FactorGraphType& graph,
|
||||
boost::optional<const VariableIndex&> variableIndex) {
|
||||
return Ordering::Colamd(*variableIndex);
|
||||
}
|
||||
};
|
||||
|
||||
/* ************************************************************************* */
|
||||
|
|
|
|||
|
|
@ -44,9 +44,16 @@ namespace gtsam {
|
|||
if (orderingType == Ordering::METIS) {
|
||||
Ordering computedOrdering = Ordering::Metis(asDerived());
|
||||
return eliminateSequential(computedOrdering, function, variableIndex);
|
||||
} else {
|
||||
} else if (orderingType == Ordering::COLAMD) {
|
||||
Ordering computedOrdering = Ordering::Colamd(*variableIndex);
|
||||
return eliminateSequential(computedOrdering, function, variableIndex);
|
||||
} else if (orderingType == Ordering::NATURAL) {
|
||||
Ordering computedOrdering = Ordering::Natural(asDerived());
|
||||
return eliminateSequential(computedOrdering, function, variableIndex);
|
||||
} else {
|
||||
Ordering computedOrdering = EliminationTraitsType::DefaultOrderingFunc(
|
||||
asDerived(), variableIndex);
|
||||
return eliminateSequential(computedOrdering, function, variableIndex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -100,9 +107,16 @@ namespace gtsam {
|
|||
if (orderingType == Ordering::METIS) {
|
||||
Ordering computedOrdering = Ordering::Metis(asDerived());
|
||||
return eliminateMultifrontal(computedOrdering, function, variableIndex);
|
||||
} else {
|
||||
} else if (orderingType == Ordering::COLAMD) {
|
||||
Ordering computedOrdering = Ordering::Colamd(*variableIndex);
|
||||
return eliminateMultifrontal(computedOrdering, function, variableIndex);
|
||||
} else if (orderingType == Ordering::NATURAL) {
|
||||
Ordering computedOrdering = Ordering::Natural(asDerived());
|
||||
return eliminateMultifrontal(computedOrdering, function, variableIndex);
|
||||
} else {
|
||||
Ordering computedOrdering = EliminationTraitsType::DefaultOrderingFunc(
|
||||
asDerived(), variableIndex);
|
||||
return eliminateMultifrontal(computedOrdering, function, variableIndex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -54,6 +54,12 @@ namespace gtsam {
|
|||
static std::pair<boost::shared_ptr<ConditionalType>, boost::shared_ptr<FactorType> >
|
||||
DefaultEliminate(const FactorGraphType& factors, const Ordering& keys) {
|
||||
return EliminatePreferCholesky(factors, keys); }
|
||||
/// The default ordering generation function
|
||||
static Ordering DefaultOrderingFunc(
|
||||
const FactorGraphType& graph,
|
||||
boost::optional<const VariableIndex&> variableIndex) {
|
||||
return Ordering::Colamd(*variableIndex);
|
||||
}
|
||||
};
|
||||
|
||||
/* ************************************************************************* */
|
||||
|
|
|
|||
|
|
@ -46,6 +46,12 @@ namespace gtsam {
|
|||
static std::pair<boost::shared_ptr<ConditionalType>, boost::shared_ptr<FactorType> >
|
||||
DefaultEliminate(const FactorGraphType& factors, const Ordering& keys) {
|
||||
return EliminateSymbolic(factors, keys); }
|
||||
/// The default ordering generation function
|
||||
static Ordering DefaultOrderingFunc(
|
||||
const FactorGraphType& graph,
|
||||
boost::optional<const VariableIndex&> variableIndex) {
|
||||
return Ordering::Colamd(*variableIndex);
|
||||
}
|
||||
};
|
||||
|
||||
/* ************************************************************************* */
|
||||
|
|
|
|||
Loading…
Reference in New Issue