(j3.2006) [Re: Loop fusion vs. vectorization]
Van Snyder
Van.Snyder
Mon Oct 5 18:11:59 EDT 2009
I wrote:
> z = &
> & ( 1.0 - dy ) * (( 1.0 - dx ) * zOld(h) + &
> & dx * zOld(reshape((/h(1,:)+1,h(2,:)/),(/2,size(z)/))) + &
> & dy * (( 1.0 - dx ) * zOld(reshape((/h(1,:),h(2,:)+1/),(/2,size(z)/))) + &
> dx * zOld(reshape((/h(1,:)+1,h(2,:)+1/),(/2,size(z)/))) )
and Bill commented
! More important, compared to
! version 1, I consider version 2 to border on unreadable.
I agree, in this case.
Digressing, in general z(h) is clearer than
(/ ( z(h(1,i),h(2,i),... h(k,i), i=1,n ) /)
where k is the rank of z.
Notice that this is different from z(h(1,:),h(2,:), ..., h(k,:)).
The former is a rank one array of extent n. The latter is a rank k
array of extent (n,n,n,...,n).
Further, z(h) could appear in a variable definition context (other than
an actual argument associated with a dummy argument that doesn't have
intent(in)), while (/ ( z(h(1,i),h(2,i),... h(k,i), i=1,n) /) cannot.
More information about the J3
mailing list