numarray - use of fromfunction
lard at tardis.ed.ac.molar.uk
Sun Jul 4 23:33:30 CEST 2004
I'm using numarray to deal with arrays of values in python.
In particular, I'm interested in the fromfunction facility, which lets
you define an array in terms of a function on its coordinates, like this:
return (x-5)**2+(y-5)**2 # distance from (5,5) squared
m = fromfunction(dist, (10,10))
Question is: is there any way to define my function such that it refers
to some values in a different array (or an 'old' copy of this one,
before all the new values are applied)?
For example, suppose I want the array integer at (x, y) to have the
value of value(x-1, y-1)*2 (i.e. 2 times the value to the 'top left'),
is there a way to do this?
More information about the Python-list