Thanks, this is what I was looking for. I'd missed the rank conjunction to
modify the verb. 


-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Devon McCormick
Sent: December 7, 2007 10:58 AM
To: Programming forum
Subject: Re: [Jprogramming] Rotating elements of a matrix

I got the last element of the left argument wrong.  Getting it right makes
me think maybe
you mean something more general like

   (13 : '(-i.#y)|."0 1 y')mm
1 2 3 4
8 5 6 7
11 12 9 10
14 15 16 13

This aligns the elements of the minor diagonal as the last column of the
result.


On 12/7/07, Devon McCormick <[EMAIL PROTECTED]> wrote:
>
> 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
>



-- 
Devon McCormick, CFA
^me^ at acm.
org is my
preferred e-mail
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to