[Numpy-discussion] Fortran was dead ... [was Re: rewriting NumPy code in C or C++ or similar]

Sturla Molden sturla@molden...
Wed Mar 16 07:25:44 CDT 2011

Den 16.03.2011 00:01, skrev Neal Becker:

Here is how Fortran compares:

> * 1-d, 2-d only or N-d??

Any of those.

> * support for slice views?  What exactly kind of support?

Fortran 90 pointers create a view.

real*8, target :: array(n,m)
real*8, pointer :: view

view => array(::2, ::2)

Slicing alone creates a view or new array depending on context.

> * semantics like numpy, that make many operations avoid copy?

Whenever the compiler can  infer that it's safe, i.e. if the same data 
cannot be referenced on lhs and rhs. Otherwise it will make a temporary 

> * what support for arithmetic operations?


> Do views support arithmetic
> operations?


> * expression templates?


> * How's the performance with indexing?  Multi-D indexing?  How about iteration?

Same as C for release builds.

Boundschecking is a compiler dependent option e.g. for debugging.

> * What are the semantics of iterators?  I don't think I've seen 2 libs that
> treat multi-d iterators the same way (and I've tried a lot of them).

do k = 1,size(x)
     x(k) = blabblabla.........
end do


More information about the NumPy-Discussion mailing list