- #1

- 103

- 0

But applying this to the nested do-loop I am working with isn't so straightforward.Treating a row-major array as a column-major array is the same as transposing it. Because performing a transpose requires data movement, and is quite difficult to do in-place for non-square matrices, such transpositions are rarely performed explicitly. For example, software libraries for linear algebra, such as the BLAS, typically provide options to specify that certain matrices are to be interpreted in transposed order to avoid the necessity of data movement.

Code:

```
! ncol = 666
! nmu = 18
! ncomp = 4
do 120 j=1,ncol
do 130 i=1,nmu
temppp = 0.
temppm = 0.
do 140 k=1,ncomp
temppp = temppp + (bcomp(k)/btotal)*betatP(i,j,k)
temppm = temppm + (bcomp(k)/btotal)*betatM(i,j,k)
140 continue
totlpp(i,j) = temppp
totlpm(i,j) = temppm
130 continue
120 continue
```

betaP and betaM should have dimensions (k,i,j) for this to be column-major, but I'm not sure how to go about changing the computations to do so.

Any ideas?