Karim Belabas on Mon, 08 Oct 2012 23:08:57 +0200


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

Re: numtoperm and Factorial Number System


* Joerg Arndt [2012-10-07 18:21]:
> Please ask Max Alekseyev!
> IIRC he such code, even for multiset-permutations.

I was toying with the idea to also add two functions 

- randomperm(n): return a random permutation in S_n

- forperm(n, s, expr): evaluate expr where the formal variable s runs over
  elements in S_n [ in lexicographic order, say ? ]

Are there obvious applications of numtoperm() / permtonum() besides the
ones that would be covered by these two [ in a more efficient way than
the current numtoperm(random(n!)) and for(i=1,n!, s = numtoperm(i)...) ] ?

> While we are at combinatorial generation,
> are there plans for other types of objects
> (e.g. partitions, and set partitions)?

No plan so far -- besides a forpartition() iterator --, but why not ?
If you have code, please share it ... :-)

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]
`