fix empty keys case

release/4.3a0
Varun Agrawal 2024-12-31 20:45:11 -05:00
parent ffa40f7101
commit ab47adeb18
1 changed files with 5 additions and 1 deletions

View File

@ -254,7 +254,11 @@ DecisionTreeFactor TableFactor::toDecisionTreeFactor() const {
// If no keys, then return empty DecisionTreeFactor
if (dkeys.size() == 0) {
return DecisionTreeFactor(dkeys, AlgebraicDecisionTree<Key>());
AlgebraicDecisionTree<Key> tree;
if (sparse_table_.size() != 0) {
tree = AlgebraicDecisionTree<Key>(sparse_table_.coeff(0));
}
return DecisionTreeFactor(dkeys, tree);
}
std::vector<double> table;