Hello everyone!
I am trying to solve some exercises and i have this curious! exercise...
Which program is faster:
a)sum=0
do i=1, n
do j=1,m
sum=sum+a(i,j)
enddo
enddo
b) sum=0
do j=1,m
do i=1,n
sum=sum+b(i,j)
enddo
enddo
Does anybody knows this answer? In MHO these programs seem to run equal times but if you know that they do not, could you please explain me why?
Best Regards
jlmp
I am trying to solve some exercises and i have this curious! exercise...
Which program is faster:
a)sum=0
do i=1, n
do j=1,m
sum=sum+a(i,j)
enddo
enddo
b) sum=0
do j=1,m
do i=1,n
sum=sum+b(i,j)
enddo
enddo
Does anybody knows this answer? In MHO these programs seem to run equal times but if you know that they do not, could you please explain me why?
Best Regards
jlmp