[Numpy-discussion] timeit one big vs many little a[ogrid] = f(ogrid)

denis bzowy denis-bz-py@t-online...
Tue Sep 15 11:05:50 CDT 2009


Added: an inline grid

    y,x = np.ogrid[ j:j+n, k:k+n ]
    a[ j:j+n, k:k+n ] = f(x,y)

is 3* faster than a[y,x] = f(x,y) for 256x256,
about the same for little 8x8 squares (on mac ppc.)

So ogrids are not "objects" -- you can't

    g = xxgrid[j:j+n, k:k+n]
    ...
    use g, pass it just like inline.

(Does anyone know of and use a small clean Grid class in C++ ?
Graphics libs have had window-to-viewport since day 1:
always there, iron out silly errors, maybe heavy.)





More information about the NumPy-Discussion mailing list