[Jprogramming] inverse permutation vector

Roger Hui rhui000 at shaw.ca
Sun Sep 9 11:08:34 HKT 2007


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 <bbill.lam at gmail.com>
Date: Saturday, September 8, 2007 20:01
Subject: Re: [Jprogramming] inverse permutation vector
To: Programming forum <programming at jsoftware.com>

> Raul Miller wrote:
> > ipv=: /: pv
> 
> Thank you, I didn't realize that is so simple.


More information about the Programming mailing list