Is there an explicit map between Anagram
index and inverse Anagram index:

   Ai: (index,#) -> index

so that it does not expand the index into vector 
to calculate (purely scalar).

Model:

   Ai=: A.@/:@(A. i.)~"0
   4 Ai i.!4
0 1 2 4 3 5 6 7 12 18 13 19 8 10 14 20 16 22 9 11 15 21 17 23

Using it,
   ([EMAIL PROTECTED] A.~ # Ai A.) 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:

>    p=: ?~23
>    /:p
> 0 20 3 7 6 19 11 12 8 10 1 15 2 5 21 14 9 4 13 18 16 17 22
>    |.&.>&.C. 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: Roger Hui <[EMAIL PROTECTED]>
> Date: Sunday, September 9, 2007 9:06
> Subject: Re: [Jprogramming] inverse permutation vector
> To: Programming forum <[email protected]>
> 
> > 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
> 



       
____________________________________________________________________________________
Be a better Heartthrob. Get better relationship answers from someone who knows. 
Yahoo! Answers - Check it out. 
http://answers.yahoo.com/dir/?link=list&sid=396545433
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to