Numarray newbie question

Colin J. Williams cjw at sympatico.ca
Thu Mar 31 17:22:53 EST 2005


ChinStrap wrote:
> I know there are probably alternatives for this with the standard
> library, but I think that would kill the speed I get with numarray:
> 
> Say I have two 2-dimensional numarrays (x_mat and y_mat, say), and a
> function f(x,y) that I would like to evaluate at every index.
> Basically I want to be able to say f(x_mat,y_mat) and have it return a
> numarray with the same shape and element wise evaluation of f.  I know,
> I want a ufunc, but they look scary to write my own. Are there any
> functions that do this? Or is writing ufuncs easier than it seems?
> 
> Thanks,
> -Chris Neff
> 
numarray has a fixed set of ufuncs.  Section 5.1 of the docs.

Section 5.3 points to a method for writing the f(i, j).


Unfortunately, it appears to require that f be written in C and assumes 
that the user operating system has a compiler, which windows, in 
general, does not.

It would be good if f could be written in Python.

Colin W.



More information about the Python-list mailing list