B. Symmetries of the Square | Index << >> |
pm ← {⍵∘.=⍳≢⍵} ⍝ permutation to matrix mp ← ⍳∘1⍤1 ⍝ matrix to permutation p x 6 3 2 1 5 4 0 96 84 59 5 19 47 36 pm p 0 0 0 0 0 0 1 x[p] 0 0 0 1 0 0 0 36 5 59 84 47 19 96 0 0 1 0 0 0 0 0 1 0 0 0 0 0 (pm p)+.×x 0 0 0 0 0 1 0 36 5 59 84 47 19 96 0 0 0 0 1 0 0 1 0 0 0 0 0 0 mp pm p 6 3 2 1 5 4 0 |