[Numpy-discussion] Right way of looping throught ndarrays using Cython

Gael Varoquaux gael.varoquaux@normalesup....
Fri Jun 20 14:13:35 CDT 2008


On Fri, Jun 20, 2008 at 02:07:08PM -0500, Robert Kern wrote:
> > Does somebody have a example of fast looping through ndarrays using
> > modern Cython idioms?

> If you're using normal Python indexing, then that's where all your
> time is being spent. You need to grab the actual .data pointer and do
> C indexing to get speed. Can you show us the code you are timing?

That is indeed what I was thinking. There is no way of doing this appart
by using the point-style indexing? I guess I am trying to find the best
(as in most readable) way of doing this. This is for teaching, not
production, so I am very much interested in having something simple.

I am attaching my test file.

Cheers,

Gaël


More information about the Numpy-discussion mailing list