revert DiscreteFactorGraph::product

release/4.3a0
Varun Agrawal 2024-12-08 16:18:42 -05:00
parent 1c14a56f5d
commit b325150b37
2 changed files with 5 additions and 10 deletions

View File

@ -64,15 +64,10 @@ namespace gtsam {
}
/* ************************************************************************* */
DiscreteFactor::shared_ptr DiscreteFactorGraph::product() const {
sharedFactor result = this->at(0);
for (size_t i = 1; i < this->size(); ++i) {
const sharedFactor factor = this->at(i);
if (factor) {
// Predicated on the fact that all discrete factors are of a single type
// so there is no type-conversion happening which can be expensive.
result = result->operator*(factor);
}
DecisionTreeFactor DiscreteFactorGraph::product() const {
DecisionTreeFactor result;
for (const sharedFactor& factor : *this) {
if (factor) result = result * (*factor);
}
return result;
}

View File

@ -147,7 +147,7 @@ class GTSAM_EXPORT DiscreteFactorGraph
DiscreteKeys discreteKeys() const;
/** return product of all factors as a single factor */
DiscreteFactor::shared_ptr product() const;
DecisionTreeFactor product() const;
/**
* Evaluates the factor graph given values, returns the joint probability of