Re: what is this statement doing
- From: Catherine Rees Lay <catherine.news@xxxxxxxxxxxxxx>
- Date: Wed, 10 Oct 2007 11:17:23 +0100
aeroguy wrote:
I have this problem? Can someone help me understand what is being done
in the following equivalence statement
EQUIVALENCE(V(1),TEMP(1,1))
definitions for V and TEMP is as follows
DOUBLE PRECISION :: V(25000) ! Yes big array
DOUBLE PRECISION :: TEMP(600,10)
i mean which memory location is being refereced.
what should be the fortran 90 equivalent statement for this
The EQUIVALENCE statement says that that the first element of each array is in the same memory location. Because the arrays are guaranteed to be contiguous in memory, that means that so are the second elements, and the third, and so on... effectively you have two superposed arrays. Since both arrays are double precision, this allows you to reference the same memory either with V (using a one-dimensional index) or with TEMP (using a two-dimensional index).
This is perfectly good Fortran 90. If the different indexing methods are what you want to do, then there's no need to change it. If it was done originally to save space by reusing the storage, rather than to give the programmer two different way to refer to the same storage, you might want to dynamically allocate the arrays instead, as and when you need them.
Catherine.
--
Catherine Rees Lay
Polyhedron Software Ltd. Registered Office: Linden House,
93 High St, Standlake, Witney, OX29 7RH, United Kingdom.
Registered in England No.2541693. Vat Reg No. GB 537 3214 57
.
- References:
- what is this statement doing
- From: aeroguy
- what is this statement doing
- Prev by Date: Re: CVF 6.6C Error Message - Negation of '/NoF66' switch not allowed
- Next by Date: Re: what is this statement doing
- Previous by thread: what is this statement doing
- Next by thread: Re: what is this statement doing
- Index(es):
Relevant Pages
|