06.03.2014 Views

Intel Fortran Language Reference - NCI National Facility

Intel Fortran Language Reference - NCI National Facility

Intel Fortran Language Reference - NCI National Facility

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

3 <strong>Intel</strong> <strong>Fortran</strong> <strong>Language</strong> <strong>Reference</strong><br />

Each array section inherits the type, kind type parameter, and certain attributes (INTENT,<br />

PARAMETER, and TARGET) of the parent array. An array section cannot inherit the POINTER<br />

attribute.<br />

If an array (or array component) is of type character, it can be followed by a substring range in<br />

parentheses. Consider the following declaration:<br />

CHARACTER(LEN=15) C(10,10)<br />

In this case, an array section referenced as C(:,:) (1:3) is an array of shape (10,10), whose elements<br />

are substrings of length 3 of the corresponding elements of C.<br />

The following shows valid references to array sections. Note that the syntax (/.../) denotes an<br />

array constructor (see “Array Constructors”):<br />

REAL, DIMENSION(20) :: B<br />

...<br />

PRINT *, B(2:20:5) ! The section consists of elements<br />

! B(2), B(7), B(12), and B(17)<br />

K = (/3, 1, 4/)<br />

B(K) = 0.0<br />

! Section B(K) is a rank-one array with shape (3) and<br />

! size 3. (0.0 is assigned to B(1), B(3), and B(4).)<br />

Subscript Triplets<br />

A subscript triplet is a set of three values representing the lower bound of the array section, the<br />

upper bound of the array section, and the increment (stride) between them. It takes the following<br />

form:<br />

[first-bound] : [last-bound] [:stride]<br />

first-bound<br />

Is a scalar integer (or other numeric) expression representing the first value in the subscript<br />

sequence. If omitted, the declared lower bound of the dimension is used.<br />

last-bound<br />

Is a scalar integer (or other numeric) expression representing the last value in the subscript<br />

sequence. If omitted, the declared upper bound of the dimension is used.<br />

When indicating sections of an assumed-size array, this subscript must be specified.<br />

stride<br />

Is a scalar integer (or other numeric) expression representing the increment between successive<br />

subscripts in the sequence. It must have a nonzero value. If it is omitted, it is assumed to be 1.<br />

The stride has the following effects:<br />

3-42

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

Saved successfully!

Ooh no, something went wrong!