[Numpy-discussion] Array vectorization in numpy

Mark Wiebe mwwiebe at gmail.com
Wed Jul 20 19:01:33 EDT 2011


On Wed, Jul 20, 2011 at 5:52 PM, srean <srean.list at gmail.com> wrote:

> >> I think this is essential to speed up numpy. Maybe numexpr could handle
> this in the future? Right now the general use of numexpr is result =
> numexpr.evaluate("whatever"), so the same problem seems to be there.
> >>
> >> With this I am not saying that numpy is not worth it, just that for many
> applications (specially with huge matrices/arrays), pre-allocation does make
> a huge difference, especially if we want to attract more people to using
> numpy.
> >
> > The ufuncs and many scipy functions take a "out" parameter where you
> > can specify a pre-allocated array.  It can be a little awkward writing
> > expressions that way, but the capability is there.
>
> This is a slight digression: is there a way to have a out parameter
> like semantics with numexpr. I have always used it as
>
> a[:] = numexpr(expression)
>
> But I dont think numexpr builds the value in place. Is it possible to
> have side-effects with numexpr as opposed to obtaining values, for
> example
>
> "a= a * b + c"
>
> The documentation is not clear about this. Oh and I do not find the
> "out" parameter awkward at all. Its very handy. Furthermore, if I may,
> here is a request that the Blitz++ source be updated. Seems like there
> is a lot of activity on the Blitz++ repository and weave is very handy
> too and can be used as easily as numexpr.
>

In order to make sure the 1.6 nditer supports multithreading, I adapted
numexpr to use it. The branch which does this is here:

http://code.google.com/p/numexpr/source/browse/#svn%2Fbranches%2Fnewiter

This supports out, order, and casting parameters, visible here:

http://code.google.com/p/numexpr/source/browse/branches/newiter/numexpr/necompiler.py#615

It's pretty much ready to go, just needs someone to do the release
management.

-Mark

_______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion at scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20110720/80f3057c/attachment.html>


More information about the NumPy-Discussion mailing list