[Numpy-discussion] Array views

Sturla Molden sturla at molden.no
Sun Mar 27 14:54:52 EDT 2011


Den 26.03.2011 19:31, skrev Christopher Barker:

> To understand all this, you'll need to study up a bit on how numpy
> arrays lay out and access the memory that they use: they use a concept
> of "strided" memory. It's very powerful and flexible, but most other
> numeric libs can't use those same data structures.

With the ISO C bindings in Fortran 2003, we can get a Fortran pointer 
from a C pointer. This means it is actually possible to pass "strided 
memory" from NumPy to Fortran libraries in a portable way. A Fortran 
pointer is more similar to a NumPy view array than a C pointer. If I am 
not mistaken, fwrap can generate the boiler-plate Cython and Fortran code.

Sturla







More information about the NumPy-Discussion mailing list