How to LogSumExp.jl

Hi guys
I want to calculate equations like log(a * exp(b1) + c * exp(b2))
I can write: logsumexp([log(a) + b1, log(c) + b2]).

  1. I want to know if this method is stable.

And I know that in scipy, the logsumexp function has parameter โ€œbโ€ to represent [a,c], like the following example:


2)Whether this LogSumExp.jl has similar arguments is like that logsumexp in Scipy

LogExpFunctions.jl (LogExpFunctions ยท LogExpFunctions.jl) should provide a better implementation than LogSumExp.jl. However, neither of them supports the scaling factor b, so you would have to do that yourself as you wrote.

4 Likes

Alsoworth mentioning GitHub - cjdoris/LogarithmicNumbers.jl: A logarithmic number system for Julia.

3 Likes

Thank you very much!