Home Manual Reference Source

References

summary
private

F _apply(transpositions: Iterable, sigma: Array)

Applies a given sequence (in the given order) of transpositions (given as index tuples) to a given permutation.

private

F _bitreversal(array: Array, n: number)

Fills an input array with the bitreversal permutation for input n items.

private

F * _compose(sigma: Array, tau: Array): IterableIterator

Compose two input permutations.

private

F _copy(sigma: Array, n: number, tau: Array)

Copy an input permutation to an output array.

private

F * _cycles(sigma: Array, used: Array): IterableIterator

Computes a cycle decomposition of an input permutation.

private

F _identity(sigma: Array, n: number)

Fills an input array with the identity permutation on input n elements.

private

F _invert(sigma: Array, n: number, tau: Array)

Fills an input array with the inverse tau of the input permutation sigma, that is, the permutation such that compose(sigma, tau) returns identity(sigma.length).

private

F _invertcycles(cycles: Iterable, tau: Array)

Inverts given cycles in a given permutation in-place.

private

F * _itranspositions(sigma: Array, used: Array): IterableIterator

Computes the sequence of transpositions that if applied to sigma result in invert(sigma).

private

F _next(sigma: Array, n: number): Boolean

Updates the input permutation to the next one in-place.

private

F * _permutations(sigma: Array, n: number): IterableIterator

Yields all permutations starting from a given one and ending at the last permutation.

private

F _reverse(sigma: Array, i: number, j: number)

Reverses input permutation in-place from input index i (include) to input index j (excluded).

private

F _transpose(a: number, b: number, sigma: Array)

Transpose elements of input index a and b in the input permutation.

private

F _transposition(a: number, b: number, sigma: Array)

Helper method for transposition.

private

F * _transpositions(cycles: Iterable): IterableIterator

Computes the transposition decomposition of some permutation given its cycle decomposition.

private

F _used(n: number, array: Array)

For a given size n, fills an input array with false.

public

F apply(n: number, transpositions: Iterable): Array

Apply a given sequence (in the given order) of transpositions (given as index tuples) to the identity permutation over input n elements.

public

Returns a newly allocated array containing the bitreversal permutation for input n items.

public

F compose(sigma: Array, tau: Array): Array

Compose two input permutations.

public

F copy(sigma: Array): Array

Make a copy of the input permutation.

public

F cycles(sigma: Array): IterableIterator

Computes a cycle decomposition of the input permutation.

public

Returns the identity permutation of a given size.

public

F invert(sigma: Array): Array

Computes the inverse tau of the input permutation sigma, that is, the permutation such that compose(sigma, tau) returns identity(sigma.length).

public

F itranspositions(sigma: Array): IterableIterator

Computes the sequence of transpositions that if applied to sigma result in invert(sigma).

public

F next(sigma: Array): Array

Computes the permutation that follows the input permutation.

public

Allocates a new permutation of given input size.

public

F * permutations(n: number): IterableIterator

Generate all permutations on n elements.

public

F reverse(sigma: Array)

Reverses input permutation in-place.

public

F reversed(sigma: Array): Array

Outputs a new permutation that is the reverse of the input permutation.

public

F transpose(sigma: Array, a: number, b: number): Array

Creates a copy of the input permutation, applies an input transpose, then returns the result.

public

Outputs the permutation on input n numbers that only transposes two input elements a and b.

public

F transpositions(sigma: Array): IterableIterator

Computes the transposition decomposition of the input permutation as an Iterator.

public

F used(n: number): Array

Generates an helper array of given size (used in _cycle, cycle).