Help / Release / J 6.01 / ^: New Inverses

From J Wiki
Jump to navigation Jump to search


>> << Pri JfC LJ Phr Dic Voc !: Rel NuVoc wd Help Release



^:

New Inverses

initial writing: 2005-11-10
last updated: 2005-11-10


If p is an integer permutation vector and m=: ({=) p is the corresponding boolean permutation matrix, then (p{A) -: m +/ .* A for a conformable numeric array A .

The table of inverses has been extended so that {= and i."1&1 are inverses of each other. These convert between integer permutation vectors and boolean permutation matrices. Thus:

   ] p=: ?.~ 11
5 6 10 7 1 8 4 0 9 3 2

   |:&.({=) p
7 4 10 9 6 0 1 3 5 8 2
   /: p
7 4 10 9 6 0 1 3 5 8 2

   ] m=: 'a' = > ;:'bacon about supra strap scant'
0 1 0 0 0
1 0 0 0 0
0 0 0 0 1
0 0 0 1 0
0 0 1 0 0
   \:&.(i."1&1) m
0 0 1 0 0
0 0 0 1 0
0 0 0 0 1
1 0 0 0 0
0 1 0 0 0
   |.@|: m   NB. rotate counterclockwise by 90 degrees
0 0 1 0 0
0 0 0 1 0
0 0 0 0 1
1 0 0 0 0
0 1 0 0 0

>> << Pri JfC LJ Phr Dic Voc !: Rel NuVoc wd Help Release