May be this is of some help. Playing with combinations of mxp it seems that only(?) applying p=: 0 3 1 2 will lead to the same test results. By a small modification of mxp you get the same result:
mxp=: [:C. 1 0;<:@(,~ >:@|.)@>:@+:@i...@-: mxp 4 0 3 1 2 I don't know however if it will work for 6, 8 etc... =@@i Hallo Sherlock, Ric, je schreef op 27-03-09 10:21: > I've been working on the Jacobi's Method article, but have run in to a > problem with the definition of the verb mxp. > > >From the Word document: > > mxp=: [: C. 0: ; <: , (,~ >:@|.)@>:@+:@i.@<:v > mxp 6 > |value error: v > | mxp 6 > mxp1=: [: C. 0: ; <: , (,~ >:@|.)@>:@+:@i.@<: > mxp1 6 > |index error: mxp1 > | mxp1 6 > > > I suspect that the v on the end is a typo, but even then the verb gives an > index error. > > >From the description of what it is supposed to do: > ============================================== > The subverb mxp (make index permutation) takes a positive even integer as > argument and yields a list which is a permutation of the integers from 0 > through one less than the argument. The permutation is such that when applied > repeatedly to a conforming list, none of the successive pairs in the lists > are equal. > =============================================== > > ... I came up with the following but I don't think it's quite right. Any > ideas? > > mxp2=: [: C. 0 ; (,~ <:@|.)@:>:@:+:@i...@-: > mxp 6 > 1 3 0 5 2 4 > > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm > ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
