Hi, I think my understanding is somehow incomplete... It's not clear to me why (simplified case)
a[curidx,:] = scalar * a[2-curidx,:] should be faster than a = scalar * b In both cases I thought the scalar multiplication results in a new array (new memory allocated) and then the difference between copying that result into the existing array u[curix,:] or reassining the reference u to that result should be very similar? If anything I would have thought the direct assignment would be quicker since then there is no copying. What am I missing? > This should give you a substantial speedup. Also, I have to say that > this is begging for weave.blitz, which compiles such statements using > templated c++ code to avoid temporaries. It doesn't work on all > systems, but if it does in your case, here's what your code might look > like: If you haven't seen it this page gives useful examples of methods to speed up python code (incuding weave.blitz), which has Hoyt says would be ideal in this case: http://scipy.org/PerformancePython Robin _______________________________________________ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion