Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
[Caml-list] Re: OCaml speed
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Thorsten Ohl <ohl@h...>
Subject: Re: [Caml-list] Re: complex bigarrays
Xavier Leroy writes:

> while in Fortran some codes use the C representation (one array of
> pairs) while others use a pair of arrays.

>From section of the Fortran standard:
    The values a complex type are ordered pairs of real values.  The
    first real value is called the real second real value is called
    the imaginary part.

and from section of the Fortran standard:

    (1) A nonpointer scalar object of type default integer, default
    real, or default logic occupies a single numeric storage unit;

    (2) A nonpointer scalar object of type double precision real or
    default complex occupies two contiguous numeric storage units;

If you declare

      COMPLEX C(2)

it is layed out as

      Re[C(1)] Im[C(1)] Re[C(2)] Im[C(2)]

Fortran compilers have no freedom here, because they must support

OTOH, there are many numerical libraries (e.g. LAPACK) that
explicitely declare two REAL arrays and use the entries as real and
imaginary parts.  However, this is a library choice and sidesteps
Fortran's COMPLEX type altogether.

Thorsten Ohl, Physics Department, TU Darmstadt -- [<=== PGP public key here]
Bug reports:  FAQ:
To unsubscribe, mail  Archives: