|
| Math.Combinat.Permutations |
|
|
|
|
| Description |
| Permutations. See:
Donald E. Knuth: The Art of Computer Programming, vol 4, pre-fascicle 2B.
|
|
| Synopsis |
|
|
|
|
| Types
|
|
|
| Standard notation for permutations. Internally it is an array of the integers [1..n].
| Instances | |
|
|
|
| Disjoint cycle notation for permutations. Internally it is [[Int]].
| Instances | |
|
|
|
|
|
|
|
| Assumes that the input is a permutation of the numbers [1..n].
|
|
|
|
|
| Checks whether the input is a permutation of the numbers [1..n].
|
|
|
| Checks the input.
|
|
|
| Returns n, where the input is a permutation of the numbers [1..n]
|
|
| Disjoint cycles
|
|
|
|
|
|
|
| This is compatible with Maple's convert(perm,'disjcyc').
|
|
|
|
|
|
|
|
|
| Plus 1 or minus 1.
|
|
|
|
| Permutation groups
|
|
|
Action of a permutation on a set. If our permutation is
encoded with the sequence [p1,p2,...,pn], then in the
two-line notation we have
( 1 2 3 ... n )
( p1 p2 p3 ... pn )
We adopt the convention that permutations act on the left
(as opposed to Knuth, where they act on the right).
Thus,
permute pi1 (permute pi2 set) == permute (pi1 `multiply` pi2) set
The second argument should be an array with bounds (1,n).
The function checks the array bounds.
|
|
|
| The list should be of length n.
|
|
|
| Multiplies two permutations together. See permute for our
conventions.
|
|
|
| The inverse permutation.
|
|
|
| The trivial permutation.
|
|
| Simple permutations
|
|
|
| A synonym for permutationsNaive
|
|
|
|
|
| Permutations of [1..n] in lexicographic order, naive algorithm.
|
|
|
|
|
| # = n!
|
|
| Random permutations
|
|
|
| A synonym for randomPermutationDurstenfeld.
|
|
|
|
|
| A synonym for randomCyclicPermutationSattolo.
|
|
|
|
|
| Generates a uniformly random permutation of [1..n].
Durstenfeld's algorithm (see http://en.wikipedia.org/wiki/Knuth_shuffle).
|
|
|
| Generates a uniformly random cyclic permutation of [1..n].
Sattolo's algorithm (see http://en.wikipedia.org/wiki/Knuth_shuffle).
|
|
| Multisets
|
|
|
| Generates all permutations of a multiset.
The order is lexicographic. A synonym for fasc2B_algorithm_L
|
|
|
| # = \frac { (sum_i n_i) ! } { \prod_i (n_i !) }
|
|
| fasc2B_algorithm_L :: (Eq a, Ord a) => [a] -> [[a]] | Source |
|
| Generates all permutations of a multiset
(based on "algorithm L" in Knuth; somewhat less efficient).
The order is lexicographic.
|
|
| Produced by Haddock version 2.6.1 |