I think that, for some distribution, the computation of log(p) is more
accurate. This was a feature request from not long ago.
Just pasting the method below:
public double logProbability(int x) {
return FastMath.log(probability(x));
}
So it retrieves the probability of the index and uses FastMath to compute
the log. We could do:
FastMath(distribution.probability(x));
It just seems a bit over engineered to have something this trivial in the
API, unless I'm missing something.
This is the default implementation. For some distributions there is a more
efficient way to compute the logProbability directly, and for these
distributions the method is overridden (e.g. GeometricDistribution,
BinomialDistribution, ...).
Otherwise one would have to call probability(x) first, which in many cases
involves calling exp(...) and then compute the log of it, which is just a
waste of cpu.
So I guess my question is "Why is there value in having this as part of the public
API of AbstractIntegerDistribution?". Not really a big deal, but it just seems like
it's an implementation detail.
Ole
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org