[SciPy-user] Loopless square 2d arrays with radially symmetric functions
Wed Mar 25 09:58:11 CDT 2009
I use a lot of radially symmetric arrays in my code and I would like to know
if there is a more efficient method for creating these arrays than the
nested for-loops i am currently using.
For example, to create a Gaussian I would currently do this (Python 2.5,
p = scipy.zeros((256,256))
for i in xrange(256):
for j in xrange(256):
p[i,j] = exp(-0.01*( (i-128.)**2. - (j-128.)**2.) )
and my question is whether there is a more efficient 'loopless' method (i.e
involving no for-loops) ?
Thanks in advance
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the SciPy-user