Re: Improving multi-dimension array access performance



Ron Shepard wrote:
(snip)

I'm not exactly sure what you mean by "isn't possible", but the following loop structure accomplishes a matrix-matrix product and steps through all three arrays with the innermost loops corresponding to the left-most index.

do i = 1, n1
do j = 1, n2
bji = b(j,i)
do k = 1, n3
c(k,i) = c(k,i) + a(k,j) * bji
enddo
enddo
enddo

I did now try this one. It is significantly (about 20%)
slower than the more usual order summing into a temporary
variable. (Which should be in a register with a good
compiler.) Don't forget to zero c at the appropriate
point.

That compares with about 5% slower for assumed shape.

-- glen

.