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

Robert Kern robert.kern@gmail....
Fri Jun 20 14:19:41 CDT 2008

On Fri, Jun 20, 2008 at 14:13, Gael Varoquaux
<gael.varoquaux@normalesup.org> wrote:
> 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 believe the numpy-Cython SoC project intended to address just that.
I haven't kept up since the initial proposal, though.

Robert Kern

"I have come to believe that the whole world is an enigma, a harmless
enigma that is made terrible by our own mad attempt to interpret it as
though it had an underlying truth."
 -- Umberto Eco

More information about the Numpy-discussion mailing list