Documentation
¶
Overview ¶
Package perm.
Index ¶
- func All(k int) <-chan Perm
- func AllEven(k int) <-chan Perm
- func AllOdd(k int) <-chan Perm
- func CyclicInequivalent(k int) <-chan Perm
- func MirrorCyclicInequivalent(k int) <-chan Perm
- type Perm
- func (p Perm) AllLeftShifts() <-chan Perm
- func (p Perm) AllRightShifts() <-chan Perm
- func (p Perm) Inversions() int64
- func (p Perm) Len() int
- func (p Perm) Mirror() Perm
- func (p Perm) ShiftLeft() Perm
- func (p Perm) ShiftRight() Perm
- func (p Perm) Shuffle() Perm
- func (p Perm) Sign() int
- func (p Perm) Sort() Perm
- func (p Perm) String() string
- func (p Perm) Swap(i, j int)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AllEven ¶
AllEven function returns a channel receiving all even permutations of a given length.
func CyclicInequivalent ¶
CyclicInequivalent function returns a channel that receives all of the cyclic-inequivalent permutations of a given length.
func MirrorCyclicInequivalent ¶
MirrorCyclicInequivalent function returns a channel that receives all of the mirror- and cyclic-inequivalent permutations of a given length.
Types ¶
type Perm ¶
type Perm []int
A Perm type represents a collection of objects labeled by integers.
func (Perm) AllLeftShifts ¶
AllLeftShifts method returns a channel that receives all of the cyclic left shifts of a given permutation.
func (Perm) AllRightShifts ¶
AllRightShifts method returns a channel that receives all of the cyclic right shifts of a given permutation.
func (Perm) Inversions ¶
Inversions method returns the number of inversions in a given permutation.
func (Perm) Mirror ¶
Mirror method returns a permutation made by completely inverting a given permutation.
func (Perm) ShiftLeft ¶
ShiftLeft method returns a permutation made by cyclically-shifting all elements of a given permutation to the left.
func (Perm) ShiftRight ¶
ShiftRight method returns a permutation made by cyclically-shifting all elements of a given permutation to the right.
func (Perm) Shuffle ¶
Shuffle method returns a permutation made by randomly shuffling a given permutation.
func (Perm) Sign ¶
Sign method returns 1 if a given permutation has an even number of inversions, -1 otherwise.