caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Thorsten Ohl <ohl@hep.tu-darmstadt.de>
To: caml-list@inria.fr
Cc: Xavier Leroy <xavier.leroy@inria.fr>
Subject: Re: [Caml-list] Re: complex bigarrays
Date: Thu, 8 Nov 2001 16:35:52 +0100	[thread overview]
Message-ID: <15338.42584.498751.200158@heplix4.ikp.physik.tu-darmstadt.de> (raw)
In-Reply-To: <20011108102833.A9260@pauillac.inria.fr>

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 4.3.1.3 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 14.6.3.1 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
EQUIVALENCE and COMMON aliasing.

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 -- ohl@hep.tu-darmstadt.de
http://heplix.ikp.physik.tu-darmstadt.de/~ohl/ [<=== PGP public key here]
-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs  FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr  Archives: http://caml.inria.fr


  parent reply	other threads:[~2001-11-08 15:35 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-11-06  9:05 [Caml-list] Re: OCaml speed Rolf Wester
2001-11-06 10:44 ` Markus Mottl
2001-11-08  9:28 ` [Caml-list] Re: complex bigarrays Xavier Leroy
2001-11-08 14:59   ` Rolf Wester
2001-11-08 15:35   ` Thorsten Ohl [this message]
     [not found]     ` <81DA66D2-D46E-11D5-82F9-003065BDAA76@mac.com>
2001-11-08 17:56       ` Thorsten Ohl
2001-11-08 18:12         ` Joerg Czeranski
2001-11-08 18:20         ` Ken Rose
2001-11-08 18:35         ` David McClain
2001-11-08 23:13 David Gurr

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=15338.42584.498751.200158@heplix4.ikp.physik.tu-darmstadt.de \
    --to=ohl@hep.tu-darmstadt.de \
    --cc=caml-list@inria.fr \
    --cc=xavier.leroy@inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).