XL Fortran for AIX 8.1

Language Reference

+---------------------------------Fortran 95---------------------------------+

FORALL (Construct)

Purpose

The FORALL (Construct) statement is the first statement of the FORALL construct.

Format



>>-+----------------------------+--FORALL--+---------------+---><
   '-FORALL_construct_name-- : -'          '-forall_header-'
 
 

forall_header



>>-(--forall_triplet_spec_list--+---------------------+--)-----><
                                '-,--scalar_mask_expr-'
 
 

forall_triplet_spec



>>-index_name-- = --subscript-- : --subscript------------------->
 
>--+-------------+---------------------------------------------><
   '- : --stride-'
 
 

scalar_mask_expr
is a scalar logical expression

subscript, stride
are both scalar integer expressions

Rules

Any procedures that are referenced in the mask expression of forall_header (including one referenced by a defined operation or assignment) must be pure.

The index_name must be a scalar integer variable. The scope of index_name is the whole FORALL construct.

In forall_triplet_spec_list, neither a subscript nor a stride can contain a reference to any index_name in the forall_triplet_spec_list. Evaluation of any expression in forall_header must not affect evaluation of any other expression in forall_header.

Given the following forall_triplet_spec:

     index1 = s1:s2:s3

The maximum number of index values is determined by:

     max = INT((s2-s1+s3)/s3)

If the stride (s3 above) is not specified, a value of 1 is assumed. If max <= 0 for any index, forall_assignment is not executed. For example:

     index1 = 2:10:3    !  The index values are 2,5,8.
                        !  max = floor(((10-2)/3)+1) = 3.
 
     index2 = 6:2:-1    !  The index values are 6,5,4,3,2.
     index2 = 6:2       !  No index values.

If the mask expression is omitted, a value of .TRUE. is assumed.

Examples

POSITIVE: FORALL (X=1:100,A(X)>0)
  I(X)=I(X)+J(X)
  J(X)=J(X)-I(X+1)
END FORALL POSITIVE

Related Information

+-----------------------------End of Fortran 95------------------------------+


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]