Algorithm 380: in-situ transposition of a rectangular matrix [F1]

where [el indicates integer par t of e. I t is more convenient to work in terms of index I1, taking values from 0 to K = m X n 1, which gives the expression I2 = m X I1 -K X [I1/n] and the value in A ( I i + I ) must be moved to A(I2+1) . By repeating this formula we find tha t the t ransposition consists of a series of " loops" , I1 --~ I2 ~ 13 -~ . ~ I1. We also note tha t this process is symmetric . For example, if I is the smallest value in a loop then K -I is the largest value of a loop, although both these values may in fact belong to the same loop. This is a special case of a more general result , which may be s ta ted as follows: T h e o r e m . I f 11 ~ 12 -+ 13 . . . ~ 11 i s a loop, then (K--I1) --~ (K--12) --~ (K--I3) . . . -+ (K-/1) i s also a loop. C o m m e n t s on Theorem. This may be two representat ions of the same loop or i t may describe a " symmet r i c" pair of loops. For a 2 X 8 matr ix the process generates the following loops, w h e r e K = 2 X 8 1 = 15. (a) I 1 ~ 2--~ 4 ~ 8--~ 1 K I 14-~ 7--~ 11 -~ 13 -~ 14