update HybridNonlinearFactorGraph::restrict to ignore empty discrete factors
parent
d2d1e2c7b0
commit
4a7cf4cc40
|
@ -237,12 +237,16 @@ HybridNonlinearFactorGraph HybridNonlinearFactorGraph::restrict(
|
||||||
if (auto hf = dynamic_pointer_cast<HybridFactor>(f)) {
|
if (auto hf = dynamic_pointer_cast<HybridFactor>(f)) {
|
||||||
result.push_back(hf->restrict(discreteValues));
|
result.push_back(hf->restrict(discreteValues));
|
||||||
} else if (auto df = dynamic_pointer_cast<DiscreteFactor>(f)) {
|
} else if (auto df = dynamic_pointer_cast<DiscreteFactor>(f)) {
|
||||||
result.push_back(df->restrict(discreteValues));
|
// In the case where all the values have been selected, we ignore the
|
||||||
|
// factor since it doesn't add any information
|
||||||
|
if (df->discreteKeys().size() > 0) {
|
||||||
|
result.push_back(df->restrict(discreteValues));
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
result.push_back(f); // Everything else is just added as is
|
result.push_back(f); // Everything else is just added as is
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue