Charles Greathouse on Mon, 08 Oct 2012 15:52:44 +0200 |
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
Re: numtoperm and Factorial Number System |
Probably it would be best to allow choosing permutation type with a flag, e.g. 0 = default, 1 = lexicographic, 2 = Zakharevich. None of my code at present depends on the type but perhaps some does. In any case there could be speed implications, especially if the existing code is faster (but some applications require lexicographic order). Charles Greathouse Analyst/Programmer Case Western Reserve University On Sun, Oct 7, 2012 at 12:21 PM, Joerg Arndt <arndt@jjj.de> wrote: > Please ask Max Alekseyev! > IIRC he such code, even for multiset-permutations. > > While we are at combinatorial generation, > are there plans for other types of objects > (e.g. partitions, and set partitions)? > > Best regards, jj > > > * Karim Belabas <Karim.Belabas@math.u-bordeaux1.fr> [Oct 07. 2012 18:03]: >> * 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] >> ` >