Permutation: Table jump...

Reorder by jumping columnwise to next row over the permutation indices layed out like a table with jumpSize columns.

Settings

Jump size
defines how many indices to jump over, i.e. the number of columns in the "table".
First
The first new position.

Example 1

Consider the identity permutation of 14 elements layed out like a table with jumpSize = 4 columns.

     1 2 3 4
     5 6 7 8
     9 10 11 12
    13 14

1. Table jump: 4, 1 will result in the permutation (1, 5, 9, 13, 2, 6, 10, 14, 3, 7, 11, 4, 8, 12)

2. Table jump: 4, 2 will result in the permutation (2, 6, 10, 14, 3, 7, 11, 4, 8, 12, 1, 5. 9, 13)

3. Table jump: 4, 5 will result in the permutation (5, 9, 13, 2, 6, 10, 14, 3, 7, 11, 4, 8, 12, 1)

4. Table jump: 4, 12 will result in the permutation (12, 1, 5, 9, 13, 2, 6, 10, 14, 3, 7, 11, 4, 8)

Example 2

Consider the identity permutation of 14 elements layed out like a table with jumpSize = 7 columns.

     1 2 3 4 5 6 7
     8 9 10 11 12 13 14

1. Table jump: 7, 1 will result in the permutation (1, 8, 2, 9, 3, 10, 4, 11, 5, 12, 6, 13, 7, 14)


© djmw 20191211