Re: Automatically transform or expand do loop in a subroutine



On Jan 31, 7:06 am, nos...@xxxxxxxxxxxxx (Richard Maine) wrote:
yaqi <yaqiw...@xxxxxxxxx> wrote:
I want to save computing time as much as I can.

...

do i=1,d
c = c + i
end do

The "obvious" way to save a lot of computing time here is to replace the
loop with

c = c + d*i


certainly not. c = c + d*(d+1)/2, more likely :)

<rest snipped>
.