>> 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. _______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion