Re: http://www.jsoftware.com/help/dictionary/dccapdot.htm

states: "the cycles are disjoint and exhaustive (i.e., the atoms of the
boxed elements together form a permutation vector); "

However we have:

   C. < 3 1
0 3 2 1

but the atoms of the boxes elements are 3 and 1, which together do not form
the permutation vector 
0 3 2 1

I was expecting this to be required:
   C. ( < 0; 2 ; 3 1 )
|domain error
|       C.(<0;2;3 1)

It seems like this must be the proper algorithm for unrolling a box of
cycle(s):

- cycle_rep =: < 3 1
- r =: monadic_raze cycle_rep
- perm_vector =: ( ( max r ) - 1 ) $ _1   NB. fill with -1 for starters
- any holes in the razed cycle_rep are "cycles of length 1" and can simply
fill in the value at the index as the value. In this case 0 goes to position
0 and 2 goes to position 2
- any remaining holes are filled in by unrolling the boxed cycles. In this
case, we just have 3 1, so we put 1 at index 3 and 3 and index 1


-- 
View this message in context: 
http://www.nabble.com/C.-%3C-3-1----NB.-the-cycles-are-not-exhaustive-tf4823734s24193.html#a13801098
Sent from the J General mailing list archive at Nabble.com.

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to