Q. Example on Multi-statement FORALL construct?
The subsequent statements set every element of matrix X to sum of its indices.
FORALL (i=1:m, j=1:n) X(i,j) = i+j
and the below statement sets upper right triangle of matrix Y to zero .
FORALL (i=1:n, j=1:n, i
Multi-statement FORALL construct:
Multi-statement FORALL is shorthand for series of single statement FORALLs. The syntax for FORALL is
FORALL (index-spec-list [,mask])
Body
END FORALL
Nesting of FORALL is allowed.