[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [math] Proposal: logsumexp


Thank you for your interest in the "Commons Math" library.
However, you should be aware that some of its functionality is in the
process of being transferred to more focused components:
 * Commons Numbers
 * Commons RNG
 * Commons Statistics
 * Commons Geometry

In particular, a method such as you describe could perhaps have its
place in the "commons-numbers-arrays" module of "Numbers".[1]


[1] https://git1-us-west.apache.org/repos/asf?p=commons-numbers.git;a=tree;f=commons-numbers-arrays/src/main/java/org/apache/commons/numbers/arrays

On Fri, 16 Nov 2018 15:56:45 -0500, Ahmed Fasih wrote:
Hello friends, I'm new to Java, and to Apache Commons Math, and I'm
porting some code to Java. One useful function that's available in
Scipy is `logsumexp`:


In a nutshell, given a list of values in the log domain, the function
numerically-stably sums them, yielding the result still in the log

This is useful for me because I need to add and subtract the results
of the log-Gamma function (via your `Gamma.logGamma`). For
*subtraction,* Scipy's `logsumexp` can accept a *second* list giving
the scalars to apply to each value (e.g., +1, -1), and returns both
the magnitude *and* sign of the result.

I would like feedback on adding `logsumexp` to Apache Commons Math. I
have ported the Python version, from


to Java, which lives at:


As mentioned above, I'm a beginner, and am experimenting with Java 8
Collections, etc., so I am embarrassed by my mixing of `List` and
plain arrays in this last link above. Assuming that you think it would be a good addition to Math, I'm totally open to suggestions to improve
the API.

Many thanks,


To unsubscribe, e-mail: dev-unsubscribe@xxxxxxxxxxxxxxxxxx
For additional commands, e-mail: dev-help@xxxxxxxxxxxxxxxxxx