Just for context, what the Intel Fortran manual actually says is this:
---
The following example, which is not expressible using array syntax, sets
diagonal elements of an array to 1:
REAL, DIMENSION(N, N) :: A
FORALL (I=1:N) A(I, I) = 1
Consider the following:
FORALL(I = 1:N, J = 1:N, A(I, J) .NE. 0.0) B(I, J) = 1.0 / A(I, J)
This statement takes the reciprocal of each nonzero element of array
A(1:N, 1:N) and assigns it to the corresponding element of array B.
Elements of A that are zero do not have their reciprocal taken, and no
assignments are made to corresponding elements of B.
Every array assignment statement and WHERE statement can be written as a
FORALL statement, but some FORALL statements cannot be written using
just array syntax. For example, the preceding FORALL statement is
equivalent to the following:
WHERE(A /= 0.0) B = 1.0 / A
It is also equivalent to:
FORALL (I = 1:N, J = 1:N)
WHERE(A(I, J) .NE. 0.0) B(I, J) = 1.0/A(I, J)
END FORALL
---
It then goes on to show an example that cannot be written using array
syntax.
Now, I'll agree that this last bit is nonsense and I have asked the
writers to fix it (probably by omitting the alternative), but the
fragment originally quoted was out of context - you need the preceding
text in order to understand it.
Steve Lionel
Intel
|