John wrote:
> Here are a couple of ways of finding the inverse of a permutation.
Don't forget the obvious:
DATA -: (2 1; 0 1) C.^:_1 (2 1; 0 1) C. DATA =: i. 10
1
(-: ]&.:( (2 1; 0 1)&C.) ) i. 10
1
(2 1; 0 1)&C. b. _1
(/:@((2 1;0 1)&C.)@([EMAIL PROTECTED]) { ]) :.((2 1;0 1)&C.)
DATA -: (/:@((2 1;0 1)&C.)@([EMAIL PROTECTED]) { ]) (2 1; 0 1) C.
DATA
1
So, instead of recording the output of m C. i.N and using that to invert the
results of C. , record m and use m C.^:_1 ] .
-Dan
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm