PermutationSet

PermutationSet

Represents a set of permutations, providing high-performance algebraic operations. This class uses direct memory access and a global repository for efficient storage and computation.

Constructor

new PermutationSet(ids, isTrustedSortedUniqueopt, isGroupopt)

Source:
Parameters:
Name Type Attributes Default Description
ids Int32Array | Array.<number>

Sorted, unique IDs from the repository.

isTrustedSortedUnique boolean <optional>
false

Skip sort/dedup if true.

isGroup boolean <optional>
false

Whether this set is known to be a mathematical group.

Classes

PermutationSet

Members

indices

Description:
  • Returns the internal Int32Array of sorted, unique permutation IDs. Direct access should be read-only.

Source:

Returns the internal Int32Array of sorted, unique permutation IDs. Direct access should be read-only.

isGroup :boolean

Description:
  • Flag indicating if this set satisfies group axioms.

Source:

Flag indicating if this set satisfies group axioms.

Type:
  • boolean

size :number

Description:
  • The number of elements in the set.

Source:

The number of elements in the set.

Type:
  • number

Methods

calculateOrbit(point) → {Int32Array}

Description:
  • Calculates the Orbit of a point under this group. Orbit(p) = { g(p) | g in G } Implements BFS/Flood Fill without object allocation.

Source:
Parameters:
Name Type Description
point number

The integer point (0..degree-1)

Returns:

Sorted unique array of points in the orbit.

Type
Int32Array

difference(other) → {PermutationSet}

Description:
  • Computes the difference of this set with another set (elements in this set but not in other).

Source:
Parameters:
Name Type Description
other PermutationSet

The other set.

Returns:

A new set representing the difference.

Type
PermutationSet

equals(other) → {boolean}

Description:
  • Checks if equal.

Source:
Parameters:
Name Type Description
other PermutationSet

The other set.

Returns:
Type
boolean

generateGroupFromThis() → {PermutationSet}

Description:
  • Generates a subgroup from this. This method uses an iterative closure approach by repeatedly multiplying the current group by the generators until no new elements are found.

Source:
Throws:

If generators is an unknown type.

Type
Error
Returns:

The fully generated subgroup (isGroup=true).

Type
PermutationSet

get(index) → {number}

Description:
  • Retrieves a permutation ID at a specific index within this set.

Source:
Parameters:
Name Type Description
index number

The 0-based index of the element to retrieve.

Returns:

The permutation ID.

Type
number

intersection(other) → {PermutationSet}

Description:
  • Computes the intersection of this set with another set.

Source:
Parameters:
Name Type Description
other PermutationSet

The other set.

Returns:

A new set representing the intersection.

Type
PermutationSet

inverse() → {PermutationSet}

Description:
  • Vectorized Inverse: G^-1 = { g^-1 | g in G } Computes the inverse of each element in the set.

Source:
Returns:

A new set containing the inverses.

Type
PermutationSet

isAbelian() → {boolean}

Description:
  • Checks if the set forms an Abelian (Commutative) group. Logic: For all g1, g2 in G, g1 * g2 == g2 * g1. Performance: O(|G|^2 * Degree). Optimized with direct memory access.

Source:
Returns:
Type
boolean

isSuperSetOf(other) → {boolean}

Description:
  • Checks if this set is a superset of another set.

Source:
Parameters:
Name Type Description
other PermutationSet

The other set.

Returns:

True if this set contains all elements of other.

Type
boolean

(abstract) multiply(other) → {PermutationSet}

Description:
  • Vectorized Group Multiplication: G * H = { g * h | g in G, h in H } Optimized with direct heap access and loop hoisting. Multiplies this set by another set.

Source:
Parameters:
Name Type Description
other PermutationSet

The other set to multiply by.

Returns:

A new set representing the product.

Type
PermutationSet

rightCosetDecomposition(subgroupH) → {Array.<PermutationSet>}

Description:
  • Decomposes this group G into right cosets of a subgroup H. G = U (H * g_i)

Source:
Parameters:
Name Type Description
subgroupH PermutationSet

The subgroup H to decompose by.

Returns:

An array of disjoint right cosets.

Type
Array.<PermutationSet>

(abstract) slice(start, end) → {PermutationSet}

Description:
  • Creates a lightweight read-only view of a subset.

Source:
Parameters:
Name Type Description
start number

The starting index (inclusive).

end number

The ending index (exclusive).

Returns:

A new set representing the slice.

Type
PermutationSet

toString() → {string}

Description:
  • Returns a string representation of the PermutationSet.

Source:
Returns:

A string in the format "PermSet(ids=[...], isGroup=...)".

Type
string

union(other) → {PermutationSet}

Description:
  • Computes the union of this set with another set.

Source:
Parameters:
Name Type Description
other PermutationSet

The other set.

Returns:

A new set representing the union.

Type
PermutationSet

(static) identity() → {PermutationSet}

Description:
  • Creates a PermutationSet containing only the identity permutation. This set is always considered a group.

Source:
Returns:

A PermutationSet containing only the identity permutation.

Type
PermutationSet