[Numpy-discussion] On my Cython/NumPy project

Dag Sverre Seljebotn dagss at student.matnat.uio.no
Sat Jun 21 15:09:45 EDT 2008


Fernando Perez wrote:
> On Fri, Jun 20, 2008 at 11:50 PM, Dag Sverre Seljebotn
> <dagss at student.matnat.uio.no> wrote:
>> Since there's been a lot of Cython discussion lately I thought I'd speak
>> up and start a thread specifically for my project.
>
> Thanks for coming over for the discussion!
>
>> The code above the under the hood acquires a buffer and uses it for
>> efficient access. arr[5], arr[5,6,7], arr[2:4,...] and in general
>> anything
>> but two simple indices will be passed to Python, while arr[i, j] will be
>> passed to the buffer.
>
> Just so I understand correctly: do you mean that in general only 2
> indices are supported 'natively', or that for an n-dim array, only
> *exactly n* indices are supported natively and other approaches are
> delegated to pure python?

That is the idea. At least for NumPy, all the other cases will generate
new arrays, so they tend to be a different kind of operations. One can
look into improving slicing efficiency etc. later.

Dag Sverre




More information about the NumPy-Discussion mailing list