⊤
and ⊥
with higher-rank arguments
Each digit position is represented as a major cell:
⎕←m←2 2 2 2 ⊤ 3 1 4
0 0 0 ← × 2×2×2×1
0 0 1 ← × 2×2×1
1 0 0 ← × 2×1
1 1 0 ← × 1
↑ ↑ ↑
3 1 4
3 = (0,0,1,1)2
1 = (0,0,0,1)2
4 = (0,1,0,0)2
Having the numbers be “vertical” may seem surprising, but it is because, if we compute the digit weights…
⎕←w←⌽×\⌽1↓2 2 2 2,1
8 4 2 1
… we can use dot product/matrix multiplication (which traditional mathematics defines as summing the products of columns from the left with rows from the right) to compute the total values:
w +.× m
3 1 4
Mixed-radix example (100 and 1440 minutes in days,hours,minutes):
⎕←m←7 24 60 ⊤ 100 1440
0 1 ← × 24×60×1
1 0 ← × 60×1
40 0 ← × 1
↑ ↑
100└1440
⌽×\⌽1↓7 24 60,1
1440 60 1
1440 60 1 +.× m
100 1440
With a matrix left argument, each column represents a radix and we do an outer product-like operation, combining all radices with all numbers:
(3 2⍴10 16)⊤128 256
┌─1 2┐ ← × 10×10×1
│┌0 1│┐← × 16×16×1
││ ││
├│2 5┤│← × 10×1
│├8 0│┤← × 16×1
││ ││
└│8 6┘│← × 1
└0 0─┘← × 1
↑ ↑
128 256
128 = (1,2,8)10
256 = (2,5,6)10
128 = (0,8,0)16
256 = (1,0,0)16
Again here, we have the first major cell (a layer of the rank-3 result) represent all the highest-valued digits, 10×10×1 and 16×16×1 for each of the 100 and 200 parts of 128 and 256.