FUNCTION: Perm2Length - calculate the length of a permutation
CALLING SEQUENCE:
- Perm2Length(perm)
- SG[Perm2Length](perm)
-
PARAMETERS:
- perm = any list denoting a permutation
SYNOPSIS:
- The Perm2Length function calculates the length of the permutation perm,
that is its number of inversions. This is also the minimal length of an
expression of the permutation as a product of simple transpositions,
as well as the sum of the components of its code.
- Whenever there is a conflict between the function name Perm2Length
and another name used in the same session, use the long form
SG['Perm2Length'].
EXAMPLES:
> with(SG):
> perm:=[5,3,2,1,4]:
> Perm2Length(perm);
7
> Perm2Rd(perm);
[4, 3, 2, 1, 3, 2, 3]
> Perm2Code(perm);
[4, 2, 1, 0, 0]
SEE ALSO: Perm2Code Perm2Rd