numarray - use of fromfunction
Alex Hunsley
lard at tardis.ed.ac.molar.uk
Sun Jul 4 17:33:30 EDT 2004
More information about the Python-list mailing list
Sun Jul 4 17:33:30 EDT 2004
- Previous message (by thread): Install MySQLdb for Python win32 need Visual Studio 6
- Next message (by thread): iterator over a numarray?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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:
def dist(x,y):
return (x-5)**2+(y-5)**2 # distance from (5,5) squared
m = fromfunction(dist, (10,10))
print m
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?
alex
- Previous message (by thread): Install MySQLdb for Python win32 need Visual Studio 6
- Next message (by thread): iterator over a numarray?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list