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

Sturla Molden sturla at molden.no
Wed Mar 16 08:25:44 EDT 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 
copy.

> * what support for arithmetic operations?

Any.

> Do views support arithmetic
> operations?

Yes.


> * expression templates?

No.

> * 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



Sturla






More information about the NumPy-Discussion mailing list