A little more polish:
   flipidm=: - =/&i. ]
   flipidm 4
0 0 0 1
0 0 1 0
0 1 0 0
1 0 0 0

> From: Lippu Esa
> Sent: Friday, 20 August 2010 22:51
> 
> flipidm=...@-=/i.
> 
> flipidm 4
> 0 0 0 1
> 0 0 1 0
> 0 1 0 0
> 1 0 0 0
> 
> Esa
> 
> -----Original Message-----
> From: [email protected]
> [mailto:[email protected]] On Behalf Of Stefano
> Lanzavecchia
> Sent: 20. elokuuta 2010 13:49
> To: 'Programming forum'
> Subject: Re: [Jprogramming] Creating a matrix (some polish required)
> 
> Once you know how to build the identity matrix (several ways on
> http://www.jsoftware.com/help/phrases/special_matrices.htm) you reverse
> it
> (http://www.jsoftware.com/help/dictionary/d231.htm) and that's it.
> 
> > -----Original Message-----
> > From: [email protected] [mailto:programming-
> > [email protected]] On Behalf Of Alex Gian
> > Sent: Friday, August 20, 2010 12:41 PM
> > To: Programming forum
> > Subject: [Jprogramming] Creating a matrix (some polish required)
> >
> > The "flipped" identity matrix is quite interesting. (Basically it's
> the
> identity
> > matrix flipped or mirrored about either the vertical or horizontal
> axis.
> IOW,
> > for a 3x3:
> > 0 0 1
> > 0 1 0
> > 1 0 0
> > I don't know if it has any special name, I stumbled on it by chance
> while
> > messing around with a simple FSA for a puzzle game.
> > Pre-multiplying by this matrix flips any same size matrix vertically,
> post-
> > multiplying flips it horizontally.  Its square is obviously the
> identity
> matrix.
> >
> > Now, I have created this matrix on various systems, (e.g. HP/RPL,
> Scheme,
> TI-
> > Basic), usually - if an id matrix is provided - just by reversing its
> rows,
> > otherwise just by starting off with the vector, say,
> > 0 0 0 1, and then rotating the "1" each time and appending that
> vector
> to
> a
> > string, which is eventually converted to a matrix.
> >
> > I can do this using loops and explicit coding, but am looking for any
> > suggestions to make it into a J one-liner, such that:
> > flipidm 4
> >   0 0 0 1
> >   0 0 1 0
> >   0 1 0 0
> >   1 0 0 0
> >
> > Hope my explanation was clear enough,
> > TIA
> >
> >
> >
> > ---------------------------------------------------------------------
> -
> > For information about J forums see
> http://www.jsoftware.com/forums.htm
> 
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
> ----------------------------------------------------------------------
> 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