simplify empty separator check
parent
113492f8b5
commit
32317d4416
|
|
@ -348,16 +348,12 @@ discreteElimination(const HybridGaussianFactorGraph &factors,
|
||||||
#if GTSAM_HYBRID_TIMING
|
#if GTSAM_HYBRID_TIMING
|
||||||
gttic_(EliminateDiscrete);
|
gttic_(EliminateDiscrete);
|
||||||
#endif
|
#endif
|
||||||
// Check if separator is empty
|
// Check if separator is empty.
|
||||||
Ordering allKeys(dfg.keyVector());
|
// This is the same as checking if the number of frontal variables
|
||||||
Ordering separator;
|
// is the same as the number of variables in the DiscreteFactorGraph.
|
||||||
std::set_difference(allKeys.begin(), allKeys.end(), frontalKeys.begin(),
|
|
||||||
frontalKeys.end(),
|
|
||||||
std::inserter(separator, separator.begin()));
|
|
||||||
|
|
||||||
// If the separator is empty, we have a clique of all the discrete variables
|
// If the separator is empty, we have a clique of all the discrete variables
|
||||||
// so we can use the TableFactor for efficiency.
|
// so we can use the TableFactor for efficiency.
|
||||||
if (separator.size() == 0) {
|
if (frontalKeys.size() == dfg.keys().size()) {
|
||||||
// Get product factor
|
// Get product factor
|
||||||
TableFactor product = TableProduct(dfg);
|
TableFactor product = TableProduct(dfg);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue