return DiscreteValues directly
parent
aba691d3d6
commit
69b5e7d527
|
|
@ -119,7 +119,7 @@ DiscreteFactor::shared_ptr TableDistribution::max(const Ordering& keys) const {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ************************************************************************ */
|
/* ************************************************************************ */
|
||||||
uint64_t TableDistribution::argmax() const {
|
DiscreteValues TableDistribution::argmax() const {
|
||||||
uint64_t maxIdx = 0;
|
uint64_t maxIdx = 0;
|
||||||
double maxValue = 0.0;
|
double maxValue = 0.0;
|
||||||
|
|
||||||
|
|
@ -132,7 +132,7 @@ uint64_t TableDistribution::argmax() const {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return maxIdx;
|
return table_.findAssignments(maxIdx);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ****************************************************************************/
|
/* ****************************************************************************/
|
||||||
|
|
|
||||||
|
|
@ -145,7 +145,7 @@ class GTSAM_EXPORT TableDistribution : public DiscreteConditional {
|
||||||
*
|
*
|
||||||
* @return maximizing assignment for the variables.
|
* @return maximizing assignment for the variables.
|
||||||
*/
|
*/
|
||||||
uint64_t argmax() const;
|
DiscreteValues argmax() const;
|
||||||
|
|
||||||
/// @}
|
/// @}
|
||||||
/// @name Advanced Interface
|
/// @name Advanced Interface
|
||||||
|
|
|
||||||
|
|
@ -47,8 +47,7 @@ DiscreteValues HybridBayesTree::discreteMaxProduct(
|
||||||
const DiscreteFactorGraph& dfg) const {
|
const DiscreteFactorGraph& dfg) const {
|
||||||
TableFactor product = TableProduct(dfg);
|
TableFactor product = TableProduct(dfg);
|
||||||
|
|
||||||
uint64_t maxIdx = TableDistribution(product).argmax();
|
DiscreteValues assignment = TableDistribution(product).argmax();
|
||||||
DiscreteValues assignment = product.findAssignments(maxIdx);
|
|
||||||
return assignment;
|
return assignment;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue