[Numpy-discussion] Log Arrays

T J tjhnson at gmail.com
Thu May 8 15:55:19 EDT 2008


On 5/8/08, Anne Archibald <peridot.faceted at gmail.com> wrote:
> Is "logarray" really the way to handle it, though? it seems like you
> could probably get away with providing a logsum ufunc that did the
> right thing. I mean, what operations does one want to do on logarrays?
>
> add -> logsum
> subtract -> ?
> multiply -> add
> mean -> logsum/N
> median -> median
> exponentiate to recover normal-space values -> exp
> str -> ?
>

That's about it, as far as my usage goes.  Additionally, I would also
benefit from:

   logdot
   logouter

In addition to the elementwise operations, it would be nice to have

   logsum along an axis
   logprod along an axis
   cumlogsum
   cumlogprod

Whether these are through additional ufuncs or through a subclass is
not so much of an issue for me---either would be a huge improvement to
the current situation.  One benefit of a subclass, IMO, is that it
maintains the feel of non-log arrays.  That is, when I want to
multiply to logarrays, I just do x*y, rather than x+y....but I can
understand arguments that this might not be desirable.



More information about the NumPy-Discussion mailing list