Like this? ]mm=. >:i. 4 4 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
0 _1 _2 _1|."(0 1)mm 1 2 3 4 8 5 6 7 11 12 9 10 16 13 14 15 This (|."(0 1)) applies the scalars (rank 0) on the left to the vectors (rank 1) on the right. On 12/7/07, Robert O'Boyle <[EMAIL PROTECTED]> wrote: > > I'd like to rotate the rows of a matrix, X, independently. For instance, I > have an arbitrary matrix > > > > 1 2 3 4 > > 5 6 7 8 > > 9 10 11 12 > > 13 14 15 16 > > > > Which I'd like to become > > > > 1 2 3 4 > > 8 5 6 7 > > 11 12 9 10 > > 14 15 16 13 > > > > I seem to recall that this could be done relatively easily in APL but > can't > find the equivalent primitive command in J. ie. 0 1 2 3 verb X which > shifts > rows of X 0, 1, 2 and 3 places. The rotate verb, |. , appears to only > allow > shifts by axis. I've looked through the forum archive and couldn't find > what > I wanted either. > > > > Have I missed something? Can this be done as inputs to a primitive verb in > J? > > > > Bob > > > > ---------------------------------------------------------------------- > 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
