02.07.2013 Views

HP Fortran Programmer's Reference

HP Fortran Programmer's Reference

HP Fortran Programmer's Reference

SHOW MORE
SHOW LESS

Create successful ePaper yourself

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

<strong>HP</strong> <strong>Fortran</strong> statements<br />

DIMENSION (statement and attribute)<br />

290<br />

DIMENSION<br />

ALLOCATABLE<br />

COMMON<br />

POINTER<br />

TARGET<br />

The array-spec (see Syntax, above) determines the category of the array being declared.<br />

“Array declarations” on page 57, describes these categories as:<br />

Explicit-shape array<br />

Assumed-shape array<br />

Assumed-size array<br />

Deferred-shape array<br />

Examples<br />

! These 2 declaration statements are equivalent.<br />

REAL a (20,2), b (20,2), c (20,2)<br />

REAL, DIMENSION (20,2) :: a, b, c<br />

DIMENSION x(100), y(100) ! x and y are 1-dimensional<br />

! lower bounds specified for jj (if not given, they default to 1)<br />

INTEGER jj (0:100, -1:1)<br />

! l is a 4-dimensional, allocatable, deferred shape logical array<br />

LOGICAL l<br />

ALLOCATABLE l(:,:,:,:)<br />

COMPLEX s ! s has explicit shape and<br />

TARGET :: s(10,2) ! the target attribute<br />

DOUBLE PRECISION d<br />

! d has 5 dimensions and is declared in common<br />

COMMON /stuff/ d(2,3,5,9,8)<br />

! arr1 is an adjustable array, arr2 an automatic array<br />

SUBROUTINE calc(arr1, ib1, ib2)<br />

REAL, DIMENSION (ib1, ib2) :: arr1, arr2<br />

! arr3 is a deferred-shape array with the pointer attribute<br />

REAL, POINTER, DIMENSION(:,:) :: arr3<br />

! all three arrays have explicit shape; array specifier (10,10)<br />

Chapter 10

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

Saved successfully!

Ooh no, something went wrong!