Perm
Class Perm
Permutations (from dictionary or cycle representation)
Examples (three times the same permutation:
Perm({1:4, 2:3, 3:2, 4:1})
Perm("(1,4)(2,3)")
Perm([[1,4],[2,3]])
Overview:
Perm (p)
Operator | Meaning |
x == y | |
x[i] | |
x * y | |
x != y | |
str(x) |
Method | Meaning |
check () | check for consistency |
cycles () | Cycle representation |
fromVector (v) | Generation from vector v with argument/value pairs. |
inverse () | inverse permutation |
inversions () | Inversion number (count of "swapped pairs") |
members () | List of the permuted elements |
odd () | odd permutation? |
reduce () | removes fixed points |
sign () | signum |
Constructor
Usage: Perm(p)
Usage: x == y
Usage: x[i]
product of two Permutations (left first, then right!)
Usage: x * y
Description:
Usage: x != y
Object representation as string (as cycles)
Usage: str(x)
Description:
p.check()
Usage: self.check()
Description:
check for consistency
p.cycles()
Usage: self.cycles()
Description:
Cycle representation
p.fromVector(v)
Usage: self.fromVector(v)
Description:
Generation from vector v with argument/value pairs.
Example: p.fromVector([[1,4],[2,3]])
p.inverse()
Usage: self.inverse()
Description:
inverse permutation
p.inversions()
Usage: self.inversions()
Description:
Inversion number (count of "swapped pairs")
p.members()
Usage: self.members()
Description:
List of the permuted elements
p.odd()
Usage: self.odd()
Description:
odd permutation? (bool)
p.reduce()
Usage: self.reduce()
Description:
removes fixed points
p.sign()
Usage: self.sign()
Description:
signum
1 for even, -1 for odd permutations