[Numpy-discussion] Right way of looping throught ndarrays using Cython
Gael Varoquaux
gael.varoquaux at normalesup.org
Fri Jun 20 15:13:35 EDT 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