I have a function that rotates a vector v
of length 9 by offset
in groups of 3:
∇ r ← offset rot3 v
r ← , offset ⌽ 3 3 ⍴ v
∇
It seems to work:
2 rot3 ⍳ 9
3 1 2 6 4 5 9 7 8
And then a function that rotates a 9x9 matrix m
horizontally by offset
in groups of 3:
∇ r ← offset rot3h m
r ← ⊃ offset rot3¨ ,/ m
∇
This seems to work, too:
a ← 2 rot3h 9 9 ⍴ ⍳ 81
a
3 1 2 6 4 5 9 7 8
12 10 11 15 13 14 18 16 17
21 19 20 24 22 23 27 25 26
30 28 29 33 31 32 36 34 35
39 37 38 42 40 41 45 43 44
48 46 47 51 49 50 54 52 53
57 55 56 60 58 59 63 61 62
66 64 65 69 67 68 72 70 71
75 73 74 78 76 77 81 79 80
⍴ a
9 9
Now I want to build a vector that contains a given matrix rotated by 1, 2 and 3 (which is the identity, but nevermind):
So I tried this (thinking: "Make the outer product of two vectors, the first containing 1, 2 and 3; the second containing a"):
a ← 9 9 ⍴ ⍳ 81
1 2 3 ∘.rot3h ⊂a
Unfortunately, the result of this is:
a ← 9 9 ⍴ ⍳ 81
1 2 3 ∘.rot3h ⊂a
2 3 1 5 6 4 8 9 7 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
11 12 10 14 15 13 17 18 16
20 21 19 23 24 22 26 27 25
29 30 28 32 33 31 35 36 34
38 39 37 41 42 40 44 45 43
47 48 46 50 51 49 53 54 52
56 57 55 59 60 58 62 63 61
65 66 64 68 69 67 71 72 70
74 75 73 77 78 76 80 81 79
Could someone please explain me where my reasoning went haywire?