Broadcasting, by itself, should not be creating large arrays in memory. It
uses stride tricks to make the array appear larger, while simply reusing
the same memory block. This is why it is so valuable because it doesn't
make a copy.
Now, what may be happening is that the resulting calculation from
I think I figured out my own question. I guess that the broadcasting
approach is generating a very large 2D array in memory, which takes a bit
of extra time. I gathered this from reading the last example on the
following site:
http://wiki.scipy.org/EricsBroadcastingDoc
I tried this again with a muc
Hello all,
I have a question about the performance of broadcasting versus Python for
loops. I have the following sample code that approximates some simulation
I'd like to do:
## Test Code ##
import numpy as np
def lorentz(x, pos, inten, hwhm):
return inten*( hwhm**2 / ( (x - pos)**2 + hwh