> On Wed, 20 Sep 2000, W. J. Metzger wrote:
> > How about sumx = sum( real( x, kind(0d0) ) )
>
> I would expect this to create a large temporary array, which
> has got to be a net loss.
>
> It would be great if SUM could accept an optional KIND argument
> which specifies the precision at which the summation is done.
It seems to me that this wouldn't matter. The standard doesn't specify
how things are done internally. One could actually implement, in the
manner of Feynman in WWII, a standard-conforming compiler consisting of
young girls passing coloured cards to each other in a room. In other
words, a good compiler would not create a large temporary array with the
first example, and a bad compiler would with the second.
Of course, to be able to optimise, the compiler must understand what you
are actually trying to do. However, using the DBLE intrinsic on the
argument seems as transparent to me as an optional argument.
Perhaps the compiler writers here can give some more useful comments.
Of course, with DO you specify sequential execution, so this could be a
big disadvantage on a parallel machine. (Again, probably quality of
implementation.)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|