10.07.2015 Views

PGI Fortran Reference manual - The Portland Group

PGI Fortran Reference manual - The Portland Group

PGI Fortran Reference manual - The Portland Group

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>Fortran</strong> Statements3.4. ARRAY<strong>The</strong> ARRAY attribute defines the number of dimensions in an array that may be defined and thenumber of elements and bounds in each dimension. [Not in PVF]CMFSyntaxARRAY [::] array-name (array-spec) [, array-name (array-spec) ] ...array-nameis the symbolic name of an array.array-specis a valid array specification, either explicit-shape, assumed-shape, deferred-shape, or assumedsize (refer to <strong>Fortran</strong> Arrays, for details on array specifications).DescriptionARRAY can be used in a subroutine as a synonym for DIMENSION to establish an argument asan array, and in this case the declarator can use expressions formed from integer variables andconstants to establish the dimensions (adjustable arrays).<strong>The</strong>se integer variables must be either arguments or declared in COMMON; they cannot be local. Further,in this case, the function of ARRAY statement is merely to supply a mapping of the argument to thesubroutine code, and not to allocate storage.<strong>The</strong> typing of the array in an ARRAY statement is defined by the initial letter of the array namein the same way as variable names, unless overridden by an IMPLICIT or type declarationstatement. Arrays may appear in type declaration and COMMON statements but the array namecan appear in only one array declaration.ExampleREAL, ARRAY(3:10):: ARRAY_ONEINTEGER, ARRAY(3,-2:2):: ARRAY_TWOThis specifies ARRAY_ONE as a vector having eight elements with the lower bound of 3 and theupper bound of 10.ARRAY_TWO as a matrix of two dimensions having fifteen elements. <strong>The</strong> first dimension hasthree elements and the second has five with bounds from -2 to 2.<strong>PGI</strong> <strong>Fortran</strong> <strong>Reference</strong> Guide 44

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!