next up previous contents
Next: Whole Array Expressions Up: Arrays Previous: Array Element Ordering

 

Array Syntax

Using the earlier declarations, references can be made to:

Care must be taken when referring to different sections of the same array on both sides of an assignment statement, for example,

    DO i = 2,15
     A(i) = A(i) + A(i-1)
    END DO

is not the same as

    A(2:15) = A(2:15) + A(1:14)

in the first case, a general element i of A has the value,

    A(i) = A(i) + A(i-1) + ... + A(2) + A(1)

but in the vectorised statement it has the valuegif,

    A(i) = A(i) + A(i-1)

In summary both scalars and arrays can be thought of as objects. (More or less) the same operations can be performed on each with the array operations being performed in parallel. It is not possible to have a scalar on the LHS of an assignment and a non scalar array reference on the RHS unless that section is an argument to a reduction function.

Return to corresponding overview page gif


next up previous contents
Next: Whole Array Expressions Up: Arrays Previous: Array Element Ordering

©University of Liverpool, 1997
Wed May 28 20:20:27 BST 1997
Not for commercial use.