SG::ListPerm --
generates all permutations
Call(s)
SG::ListPerm(l)
SG::ListPerm(n <,type,code,level> <,>)
Parametersn | - | degree of a symmetric group (positive integer) |
l | - | a list of values |
Optionscode | - | codes instead of permutations |
level | - | by level in the permutohedron |
| - | only counts objects |
type=lexic,cixel,vexillary,dominant,grassmannian | - |
IntroductionThe SG::ListPerm function generates permutations.
If the first argument is a list or a set l, it generates
all distinct permutations of the elements of l.
If the first argument is an integer, say n, then the
function returns the list of all permutations of the symmetric
group of degree n. In this case, using n=0 is also
allowed.
or SG::ListPerm(n, lexic) returns all
permutations in lexicographic or reverse lexicographic order.
SG::ListPerm(n, cixel)
returns a list of lists. First list
contains all permutations with 0 inversion, second one contains
all permutations with 1 inversion, ..., last one contains all
permutations with n*(n-1)/2 inversions.
SG::ListPerm(n, hold(level))
, where SG::ListPerm(n, type)type is either
dominant, grassmannian or vexillary, returns
the list of all dominant, grassmannian or vexillary permutations
of the symmetric group of degree n. Vexillary
permutations are generated using an algorithm due to J. West.
When the first argument is an integer, one can use another
argument code, to produce Lehmer codes instead of
permutations. When generating dominant permutations, it is
faster to produce codes. One can also add the argument nb
to count instead of producing permutations.
Example 1>> muEC::SG::ListPerm([1,1,3,3]);
[[1, 1, 3, 3], [1, 3, 1, 3], [1, 3, 3, 1], [3, 1, 1, 3],
[3, 1, 3, 1], [3, 3, 1, 1]]
>> muEC::SG::ListPerm(3, cixel);
[[3, 2, 1], [2, 3, 1], [3, 1, 2], [1, 3, 2], [2, 1, 3],
[1, 2, 3]]
>> muEC::SG::ListPerm(3, hold(level));
[[[1, 2, 3]], [[1, 3, 2], [2, 1, 3]], [[3, 1, 2], [2, 3, 1]],
[[3, 2, 1]]]
>> muEC::SG::ListPerm(3, hold(level), code);
[[[0, 0, 0]], [[0, 1, 0], [1, 0, 0]], [[2, 0, 0], [1, 1, 0]],
[[2, 1, 0]]]
>> muEC::SG::ListPerm(4, vexillary, nb);
23
>> muEC::SG::ListPerm(5, vexillary, nb, hold(level));
[1, 4, 6, 11, 16, 18, 18, 15, 9, 4, 1]
>> muEC::SG::ListPerm(5, nb, hold(level));
[1, 4, 9, 15, 20, 22, 20, 15, 9, 4, 1]
Related FunctionsMuPAD Combinat, an open source algebraic combinatorics package