[Numpy-discussion] vectorized version of logsumexp? (from scipy.maxentropy)

Charles R Harris charlesr.harris at gmail.com
Sat Oct 17 14:59:41 EDT 2009


On Sat, Oct 17, 2009 at 12:40 PM, Neal Becker <ndbecker2 at gmail.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.

Chuck
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20091017/0687a14c/attachment.html>


More information about the NumPy-Discussion mailing list