Sorry, left out the step to translate i.9 into index pairs; you'll need the column max for this: COLMAX=: 3 (2$COLMAX)#: i.9 0 0 0 1 0 2 1 0 1 1 1 2 2 0 2 1 2 2
And you'd need to translate the resulting index pairs back to vector indexes: NUMCOLS=: 3 NUMROWS=: 3 NUMCOLS #. &> (NUMROWS-1) fliptp2D&.><"1 (2$COLMAX)#: i.9 2 5 8 1 4 7 0 3 6 On Mon, Jan 28, 2013 at 3:51 PM, Brian Schott <[email protected]>wrote: > On Mon, Jan 28, 2013 at 3:26 PM, Devon McCormick <[email protected]> > wrote: > > So you want a mapping like this (top to bottom row): > > (([: , [: |. |:),:~[:,]) ,&.>/~ i. 3 > > +---+---+---+---+---+---+---+---+---+ > > |0 0|0 1|0 2|1 0|1 1|1 2|2 0|2 1|2 2| > > +---+---+---+---+---+---+---+---+---+ > > |0 2|1 2|2 2|0 1|1 1|2 1|0 0|1 0|2 0| > > +---+---+---+---+---+---+---+---+---+ > > Yes, I think the above is a correct mapping in the second row. > > > > > For any starting coordinate, > > fliptp2D=: 4 : '({:y),x-{.y' > > > > So, > > 2 fliptp2D &.> ,,&.>/~ i. 3 > > +---+---+---+---+---+---+---+---+---+ > > |0 2|1 2|2 2|0 1|1 1|2 1|0 0|1 0|2 0| > > +---+---+---+---+---+---+---+---+---+ > > > > where the left argument is the row max. > > > > Yes, but my real inputs are i. 9, not index pairs. > > > > > On Mon, Jan 28, 2013 at 3:10 PM, Brian Schott <[email protected] > >wrote: > > > > -- > (B=) > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm > -- Devon McCormick, CFA ^me^ at acm. org is my preferred e-mail ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
