There is an isomorphism between integer permutation vectors
and boolean permutation matrices under {= and i."1&1 .
Therefore:

(/:p) -: |:&.(({=) :. (i."1&1)) p

http://www.jsoftware.com/jwiki/Essays/Symmetries_of_the_Square



----- Original Message -----
From: Oleg Kobchenko <[EMAIL PROTECTED]>
Date: Sunday, September 9, 2007 0:16
Subject: Re: [Jprogramming] inverse permutation vector
To: Programming forum <[email protected]>

> Also
> 
>    (i. [EMAIL PROTECTED]) p
> 0 20 3 7 6 19 11 12 8 10 1 15 2 5 21 14 9 4 13 18 16 17 22
> 
> Variation
> 
>    [EMAIL PROTECTED]@]`]`]}~ p
> 0 20 3 7 6 19 11 12 8 10 1 15 2 5 21 14 9 4 13 18 16 17 22
> 
> 
> --- Roger Hui <[EMAIL PROTECTED]> wrote:
> 
> > Another solution.  Both are well-known in APL circles.
> > 
> >    ] p=: ?~23
> > 0 10 12 2 17 13 4 3 8 16 9 6 7 18 15 11 20 21 19 5 1 14 22
> >    /: p
> > 0 20 3 7 6 19 11 12 8 10 1 15 2 5 21 14 9 4 13 18 16 17 22
> >    p}~i.#p
> > 0 20 3 7 6 19 11 12 8 10 1 15 2 5 21 14 9 4 13 18 16 17 22
> > 
> > 
> > 
> > ----- Original Message -----
> > From: bill lam <[EMAIL PROTECTED]>
> > Date: Saturday, September 8, 2007 20:01
> > Subject: Re: [Jprogramming] inverse permutation vector
> > To: Programming forum <[email protected]>
> > 
> > > Raul Miller wrote:
> > > > ipv=: /: pv
> > > 
> > > Thank you, I didn't realize that is so simple.
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to