=?UTF-8?B?QXhpcyBhcmd1bWVudHMgZm9yIOKKpSBhbmQg4oqkPw==?=
From
Andrew Sengul@21:1/5 to
All on Fri Sep 11 11:39:08 2020
Has anyone considered implementing axis arguments for ⊥ and ⊤? It would
be nice if you could encode or decode on a chosen axis. For instance,
say that you have an 8-bit RGB image represented by an array of integers
of the shape height×width×3. The first two dimensions are the height and width of the image, the third dimension is 3 units long for the R G B
values.
If you want to count the unique colors in the image, you can do it with
this function:
countColors ← {⍴∪,(3⍴2*8)⊥3 1 2⍉⍵}
You have to permute the array to put the RGB dimension first in order
for the decode to work. What if you could write this instead:
countColors ← {⍴∪,(3⍴2*8)⊥[3]⍵}
Is there a reason this hasn't been implemented? For multidimensional
arguments, there could be a second axis argument to specify which
dimension of the left argument to use as radix vectors for the right
argument: A⊥[3;2]B.
Andrew
--- SoupGate-Win32 v1.05
* Origin: fsxNet Usenet Gateway (21:1/5)