Numarray newbie question

ChinStrap caneff at
Tue Mar 29 18:56:50 CEST 2005

Oh well. I am downloading all the things to build it, but in the mean
time I just did:

        def get_y_mat(x_ind,y_ind):

            return self.y_min + y_ind*self.dy

        def get_x_mat(x_ind,y_ind):

            return self.x_min + x_ind*self.dx


        def fxy(x_ind,y_ind):
            x=self.x_min + x_ind*self.dx
            y=self.y_min + y_ind*self.dx
            return f(x,y)

        def vxy(x_ind,y_ind):
            x=self.x_min + x_ind*self.dx
            y=self.y_min + y_ind*self.dx
            return v(x,y)


As you can see I am just repeating calculations in fxy and vxy that I
have already done for x_mat and y_mat.  This is still faster than

self.f_mat = array([f(x,y) for x in x_mat for y in y_mat],matshape)

by a noticable amount.

More information about the Python-list mailing list