[Numpy-discussion] Array views
Sturla Molden
sturla at molden.no
Mon Mar 28 11:01:46 EDT 2011
Den 28.03.2011 14:28, skrev Dag Sverre Seljebotn:
>
> Sure, I realize that it is not standard. I'm mostly wondering whether
> major Fortran compilers support working with strided memory in practice
> (defined as you won't get out-of-memory-errors when passing around huge
> strided array subset).
I'll try to clarify this:
** Most Fortran 90 compilers (and beyond) supports strided memory for
assumed-shape and deferred-shape arrays. That is, arrays declared like
a(:,:), and/or with 'allocatable' or 'pointer' attribute. They are
usually passed as a 'dope array' C struct, i.e. similar to NumPy's
PyArrayObject. These arrays are not a part of Fortran 77, but passing
them to Fortran 77 subroutines is required to work. The compiler is free
to make a local copy if it wants.
** Most Fortran 77 compilers (and beyond) assume explicit-shape and
assumed-size arrays are contiguous blocks of memory. That is, arrays
declared like a(m,n) or a(m,*). They are usually passed as a pointer to
the first element. These are the only type of Fortran arrays f2py supports.
** Most Fortran compilers will make a temporary copy when passing a
non-contiguous array section to a subroutine expecting an explicit-shape
or assumed-shape array.
** All Fortran 2003 compilers will assume a C array is contiguous.
Ok?
Sturla
More information about the NumPy-Discussion
mailing list