Next:
About this document Up: FORALL-ELSEFORALL Construct Previous: Interpretation of the

Scalarization of the FORALL-ELSEFORALL Construct

A forall-construct of the form:

FORALL ( v=l:u:s, mask ) a(l:u:s) = rhs1 ELSEFORALL a(l:u:s) = rhs2 END FORALL is equivalent to the following standard Fortran 90 code:

!evaluate subscript and stride expressions in any order

templ = l tempu = u temps = s

!then evaluate the masks

DO v1=templ,tempu,temps tempmask(v) = mask(v) END DO

!then evaluate the first block of statements

DO v=templ,tempu,temps IF (tempmask(v)) THEN temprhs1(v) = rhs1 END IF END DO DO v1=templ,tempu,temps IF (tempmask(v)) THEN a(v)=temprhs1(v) END IF END DO

!then evaluate the second block of statements

DO v=templ,tempu,temps IF (not.tempmask(v)) THEN temprhs2(v) = rhs2 END IF END DO DO v1=templ,tempu,temps IF (.not.tempmask(v)) THEN a(v)=temprhs2(v) END IF END DO

paula@erc.msstate.edu
Thu May 5 15:11:02 CDT 1994