Karim Belabas on Sun, 07 Oct 2012 12:04:30 +0200


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: numtoperm and Factorial Number System


* Mathieu Carbou [2012-10-07 01:56]:
[...]
> I was wondering why in PARI the numtoperm does not match the Nth
> permutation in the factorial number system ?

No particular reason. The code was submitted (by Ilya Zakharevich) and
included essentially "as is".

> Is there a way to use numtoperm to get the good result or I have to code
> a function which decompose the number in the factorial number system by
> myself ?

Not currently. There's a long-standing wishlist item in the Bug Tracking System

  http://pari.math.u-bordeaux1.fr/cgi-bin/bugreport.cgi?bug=899

asking for a lexicographic ordering (aka Lehmer code). If someone has a
GP or C implementation for this, I have no objection to replacing the
current code.

[ The current numtoperm / permtonum code should be modified anyway to
return / accomodate t_VECSMALLs: it's more efficient and permutations are
now represented by t_VECSMALLs anyway. This way they can be inverted,
multiplied, etc. ]

Cheers,

    K.B.
-- 
Karim Belabas, IMB (UMR 5251)  Tel: (+33) (0)5 40 00 26 17
Universite Bordeaux 1          Fax: (+33) (0)5 40 00 69 50
351, cours de la Liberation    http://www.math.u-bordeaux1.fr/~belabas/
F-33405 Talence (France)       http://pari.math.u-bordeaux1.fr/  [PARI/GP]
`