discreteKeys method
parent
4cba05a2f7
commit
785b39d3c0
|
|
@ -43,11 +43,25 @@ namespace gtsam {
|
||||||
/* ************************************************************************* */
|
/* ************************************************************************* */
|
||||||
KeySet DiscreteFactorGraph::keys() const {
|
KeySet DiscreteFactorGraph::keys() const {
|
||||||
KeySet keys;
|
KeySet keys;
|
||||||
for(const sharedFactor& factor: *this)
|
for (const sharedFactor& factor : *this) {
|
||||||
if (factor) keys.insert(factor->begin(), factor->end());
|
if (factor) keys.insert(factor->begin(), factor->end());
|
||||||
|
}
|
||||||
return keys;
|
return keys;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ************************************************************************* */
|
||||||
|
DiscreteKeys DiscreteFactorGraph::discreteKeys() const {
|
||||||
|
DiscreteKeys result;
|
||||||
|
for (auto&& factor : *this) {
|
||||||
|
if (auto p = boost::dynamic_pointer_cast<DecisionTreeFactor>(factor)) {
|
||||||
|
DiscreteKeys factor_keys = p->discreteKeys();
|
||||||
|
result.insert(result.end(), factor_keys.begin(), factor_keys.end());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
/* ************************************************************************* */
|
/* ************************************************************************* */
|
||||||
DecisionTreeFactor DiscreteFactorGraph::product() const {
|
DecisionTreeFactor DiscreteFactorGraph::product() const {
|
||||||
DecisionTreeFactor result;
|
DecisionTreeFactor result;
|
||||||
|
|
|
||||||
|
|
@ -114,6 +114,9 @@ class GTSAM_EXPORT DiscreteFactorGraph
|
||||||
/** Return the set of variables involved in the factors (set union) */
|
/** Return the set of variables involved in the factors (set union) */
|
||||||
KeySet keys() const;
|
KeySet keys() const;
|
||||||
|
|
||||||
|
/// Return the DiscreteKeys in this factor graph.
|
||||||
|
DiscreteKeys discreteKeys() const;
|
||||||
|
|
||||||
/** return product of all factors as a single factor */
|
/** return product of all factors as a single factor */
|
||||||
DecisionTreeFactor product() const;
|
DecisionTreeFactor product() const;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue