This is the mail archive of the
gsl-discuss@sourceware.cygnus.com
mailing list for the GSL project.
Re: simple permutation generation
- To: Mark Galassi <rosalia@cygnus.com>
- Subject: Re: simple permutation generation
- From: Ryszard Czerminski <ryszard@moldyn.com>
- Date: Tue, 6 Apr 1999 10:25:22 -0400 (EDT)
- cc: gsl-discuss@sourceware.cygnus.com
Python does have such capability
script
#!/usr/bin/env python
from RandomArray import permutation
for i in range(9):
p = permutation(13)
print 'p=',p
produces
p= [10 3 11 1 0 9 6 4 12 2 5 7 8]
p= [ 6 12 9 5 3 8 2 1 11 10 7 4 0]
p= [ 0 4 6 8 1 11 12 9 3 10 5 7 2]
p= [ 3 6 8 1 12 9 4 2 10 0 11 5 7]
p= [ 3 5 12 10 1 0 4 8 7 2 9 6 11]
p= [ 7 0 3 6 1 10 2 11 8 5 9 12 4]
p= [ 6 7 12 3 1 5 8 10 4 11 2 9 0]
p= [10 8 7 4 5 3 0 11 1 6 2 12 9]
p= [ 9 6 11 10 8 5 12 4 2 3 0 1 7]
Relevant python code is in NumPy extension
http://www.python.org (Python at LLNL).
If you do not find anything to better suite
your needs, and if I can be of any help with this
let me know.
R
Ryszard Czerminski phone : (617)354-3124 x 10
Moldyn, Inc. fax : (617)491-4522
955 Massachusetts Avenue e-mail: ryszard@moldyn.com
Cambridge MA, 02139-3180 http://www.moldyn.com
On Tue, 6 Apr 1999, Mark Galassi wrote:
>
> Amigos, does anyone know of a simple library to generate permutations
> of (1..n)?