Skip to content

Commit

Permalink
switch from DiscreteKeys back to std::set<DiscreteKey>
Browse files Browse the repository at this point in the history
  • Loading branch information
varunagrawal committed Jan 16, 2023
1 parent 64743ef commit 5e1de8c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions gtsam/hybrid/HybridFactorGraph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
namespace gtsam {

/* ************************************************************************* */
DiscreteKeys HybridFactorGraph::discreteKeys() const {
std::set<DiscreteKey> HybridFactorGraph::discreteKeys() const {
std::set<DiscreteKey> keys;
for (auto& factor : factors_) {
if (auto p = boost::dynamic_pointer_cast<DecisionTreeFactor>(factor)) {
Expand All @@ -39,14 +39,14 @@ DiscreteKeys HybridFactorGraph::discreteKeys() const {
}
}
}
return DiscreteKeys(keys.begin(), keys.end());
return keys;
}

/* ************************************************************************* */
KeySet HybridFactorGraph::discreteKeySet() const {
KeySet keys;
DiscreteKeys key_vector = discreteKeys();
std::transform(key_vector.begin(), key_vector.end(),
std::set<DiscreteKey> key_set = discreteKeys();
std::transform(key_set.begin(), key_set.end(),
std::inserter(keys, keys.begin()),
[](const DiscreteKey& k) { return k.first; });
return keys;
Expand Down
2 changes: 1 addition & 1 deletion gtsam/hybrid/HybridFactorGraph.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class HybridFactorGraph : public FactorGraph<Factor> {
/// @{

/// Get all the discrete keys in the factor graph.
DiscreteKeys discreteKeys() const;
std::set<DiscreteKey> discreteKeys() const;

/// Get all the discrete keys in the factor graph, as a set.
KeySet discreteKeySet() const;
Expand Down

0 comments on commit 5e1de8c

Please sign in to comment.