[Numpy-discussion] vectorized version of logsumexp? (from scipy.maxentropy)
Charles R Harris
Sat Oct 17 13:59:41 CDT 2009
On Sat, Oct 17, 2009 at 12:40 PM, Neal Becker <email@example.com> wrote:
> Somewhat offtopic, but is there a generalization of the logsumexp shortcut
> to more than 2 variables?
> IIRC, it's this for 2 variables:
> log (exp (a) + exp (b)) = max (a,b) + log (1 + exp (-abs (a-b)))
logaddexp.reduce will apply it along array rows. The reduce loop could
probably be optimized a bit using the methods that Dale used to optimize the
reduce case for add. Hmm, the reduce loop would need to be implemented for
the generic loops. The logaddexp case could possibly be optimized further by
writing a specialized loop for the reduce case.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the NumPy-Discussion