add explanatory comments
parent
2702854c18
commit
2e4ae8ca0a
|
@ -215,6 +215,7 @@ namespace gtsam {
|
|||
EliminateDiscrete(const DiscreteFactorGraph& factors,
|
||||
const Ordering& frontalKeys) {
|
||||
gttic(product);
|
||||
// `product` is scaled later to prevent underflow.
|
||||
DiscreteFactor::shared_ptr product = factors.product();
|
||||
gttoc(product);
|
||||
|
||||
|
@ -224,6 +225,9 @@ namespace gtsam {
|
|||
gttoc(sum);
|
||||
|
||||
// Normalize/scale to prevent underflow.
|
||||
// We divide both `product` and `sum` by `max(sum)`
|
||||
// since it is faster to compute and when the conditional
|
||||
// is formed by `product/sum`, the scaling term cancels out.
|
||||
gttic(scale);
|
||||
DiscreteFactor::shared_ptr denominator = sum->max(sum->size());
|
||||
product = product->operator/(denominator);
|
||||
|
|
Loading…
Reference in New Issue