Intel® Fortran Compiler Classic and Intel® Fortran Compiler Developer Guide and Reference

ID 767251
Date 7/13/2023
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

Implied-Shape Specifications

An implied-shape array is a named constant that takes its shape from the constant expression in its declaration. An implied-shape specification takes the following form:

([dl:] du [, [dl:] du] ...)

dl

Is a specification expression indicating the lower bound of the dimension. The expression can have a positive, negative, or zero value. If necessary, the value is converted to integer type.

If the lower bound is not specified, it is assumed to be 1.

du

Is the upper bound of the dimension or *.

The constant expression in the implied-shape declaration must be an array.

The rank of the array must be the same as the rank of the constant expression in its declaration.

The extent of each dimension of an implied-shape array is the same as the extent of the corresponding dimension of the constant expression.

The value of the upper bound is 1 less than the sum of the lower bound and the extent.

Examples

The following examples show implied-shape specifications:

  INTEGER, PARAMETER :: R(*) = [1,2,3]
  ! means SHAPE (R) is [3]

  integer, parameter :: x (0:*,1:*) = reshape ( [1,2,3,4], [2,2] )
  ! means dimensions of X are 0 to 1 and 1 to 2

  REAL :: M (2:*, -1:*)
  PARAMETER (M = RESHAPE ([R,R], [3,2]))
  ! means dimensions of M are 2 to 4 and -1 to 0

  integer, parameter :: Y (0:*,1:2) = reshape ( [1,2,3,4], [2,2] )
  ! means dimensions of Y are 0 to 1 and 1 to 2