Dear Fortran Gurus,
This is quoted from I*l fortran user guide:
> 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
Is such usage of WHERE (specifying array coordinates)
legal in f95? I was trying to optimize code for IA64
(not many f90 compilers for that to choose from)
and I get request for "array-valued operand"
in WHERE see HERE below:
subroutine radial0_f95_1()
integer(i4_kind) :: ir,ie
forall(ir=1:vl, ie=1:n_exps)
rad0(ir,ie) = exps(ie) * r2(ir)
end forall
forall(ir=1:vl, ie=1:n_exps)
where(rad0(ir,ie)<50.0_r8_kind) ! ****** HERE ******
rad0(ir,ie) = norms(ie) * exp( - rad0(ir,ie) )
elsewhere
rad0(ir,ie) = 0.0_r8_kind
endwhere
end forall
end subroutine radial0_f95_1
Thanks for any comments,
Alexei
|