Dag Sverre Seljebotn wrote: > >> Is there a workaround that allows me to store and efficiently access buffer >> data in an extension type? >> > > Is this what you are referring to which is too slow?: > > 1) Store it as plain numpy.ndarray > 2) Copy it to numpy.ndarray[numpy.float_t] inside the local function > before processing > The core routine is called very often, each time, the data is accessed just once. Doing the conversion once for every call would therefore not gain me anything... :-(
> If that is too slow as well, I'm afraid the only solution right now is > to store it as numpy.ndarray and access the data field (i.e. > self.data.data), casted to numpy.float_t*. You must then make sure you > work with a contiguous array: > > if not data.flags['C_CONTIGUOUS']: > data = data.copy() > self.data = data > Ok, that's ugly, but it should work. The array is created within the class, so I have full control. I could then just store an additional class member of pointer type and use that to access the data. Thanks for the help! _______________________________________________ Cython-dev mailing list [email protected] http://codespeak.net/mailman/listinfo/cython-dev
