Use of array_copy in gasdev_v


ydw
03-29-2006, 12:37 AM
In subroutine gasdev_v (NR/F90 pp. 1152-3) a call is made to array_copy. On p. 1153 it is explained that array_copy is used "since we don't know in advance the length of the array returned by pack." Of course the length could be found by counting the number of true elements in the mask. So what is the reason for which the authors did not instead write the more transparent

nn=count(mask(ng:n))
v1(ng:ng+nn-1)=pack(v1(ng:n),mask(ng:n))

in place of the call to array_copy (as they did on the immediately following lines to pack v2 and rsq once nn is known)?