[Numpy-discussion] (cumsum, broadcast) in (numexpr, weave)

srean srean.list at gmail.com
Tue Jun 21 15:35:17 EDT 2011


Hi All,

 is there a fast way to do cumsum with numexpr ? I could not find it,
but the functions available in numexpr does not seem to be
exhaustively documented, so it is possible that I missed it. Do not
know if 'sum' takes special arguments that can be used.

To try another track, does numexpr operators have something like the
'out' parameter for ufuncs ? If it is so, one could perhaps use
add( a[0:-1], a[1,:], out = a[1,:) provided it is possible to preserve
the sequential semantics.

Another option is to use weave which does have cumsum. However my code
requires  expressions which implement broadcast. That leads to my next
question, does repeat or concat return a copy or a view. If they avoid
copying, I could perhaps use repeat to simulate efficient
broadcasting. Or will it make a copy of that array anyway ?. I would
ideally like to use numexpr because I make heavy use of transcendental
functions and was hoping to exploit the VML library.

Thanks for the help

-- srean



More information about the NumPy-Discussion mailing list