Documentation of 'cc.redberry.core.groups.permutations.PermutationGroup' Java class
PermutationGroup
cc.redberry.core.groups.permutations

Class PermutationGroup

  • All Implemented Interfaces:
    java.lang.Iterable<Permutation>


    public final class PermutationGroup
    extends java.lang.Object
    implements java.lang.Iterable<Permutation>
    Implementation of permutation group; this class provides a number of methods for work wih permutation groups, including membership testing, coset enumeration, searching for centralizers, stabilizers, etc (for details see method summary). The instances of this class are immutable. The iterator returned by this class's iterator() method iterates over all elements of this group.

    Example

    The following example gives a brief overview of the basic usage of PermutationGroup

    //Construct permutation group of degree 13 with two generators (written in one-line notation)
     PermutationGroup pg =  PermutationGroup.createPermutationGroup(
         Permutations.createPermutation(9, 1, 2, 0, 4, 8, 5, 11, 6, 3, 10, 12, 7),
         Permutations.createPermutation(2, 0, 1, 8, 3, 5, 7, 11, 4, 12, 9, 6, 10));
     //this group is transitive
     assert pg.isTransitive();
     //its order = 5616
     System.out.println(pg.order());
     //Create alternating group Alt(13)
     PermutationGroup alt13 = PermutationGroup.alternatingGroup(13);
     //its order = 3113510400
     System.out.println(alt13.order());
     assert alt13.containsSubgroup(pg);
     //Direct product of two groups
     PermutationGroup pp = pg.directProduct(PermutationGroup.symmetricGroup(8));
     //Setwise stabilizer
     PermutationGroup sw = pp.setwiseStabilizer(1, 2, 3, 9, 10, 11, 12, 3, 14, 15, 16, 17, 18);
     assert pp.containsSubgroup(sw);
     //its order = 17280
     System.out.println(sw.order());
     //Center of this stabilizer
     PermutationGroup center = sw.center();
     //it is abelian group
     assert center.isAbelian();
     //generators of center
     System.out.println(center.generators());
     //[+{}, +{{19, 20}}, +{{2, 10}, {3, 9}, {6, 8}, {11, 12}}]
     //orbits of center
     int[][] orbits = center.orbits();
     for (int[] orbit : orbits)
     if (orbit.length != 1)
     System.out.print(Arrays.toString(orbit));
     //[2, 10], [3, 9], [6, 8], [11, 12], [19, 20]
     

    Implementation and complexity

    The implementation is based on base and strong generating set (BSGS), which is constructed using Schreier-Sims algorithm (AlgorithmsBase.SchreierSimsAlgorithm(java.util.ArrayList)). Schreier-Sims algorithm has O(n^6 +k*n^2) complexity (where n is a degree of group), which can be crucial for groups with large bases. Since not all methods require BSGS, the BSGS structure of PermutationGroup is lazy initialized, i.e. its initialization occurs on the first invocation of method that uses BSGS.

    Structural calculations. Generally, all structural calculations have polynomial time complexity. The polynomial-time operations include: calculation of orbits (do not require BSGS); membership testing; calculation of order, base and strong generating set, pointwise stabilizers, union and direct product of groups; tests for commutativity, transitivity, Alt(n) and Sym(n) testing; calculation of normal closure and derived subgroup.

    Backtrack search. On the other hand, the algorithms that use backtrack search methods have exponential complexity in the worst case, which also hardly depends on the input. This algorithms include: calculation of setwise stabilizers, intersections of groups, coset representatives, centralizers. The exception is the calculation of center of group which is always polynomial.

    Since:
    1.1.6
    See Also:
    Permutation, AlgorithmsBase, AlgorithmsBacktrack, BacktrackSearch
    • Method Detail

      • createPermutationGroup

        public static PermutationGroup createPermutationGroup(Permutation... generators)
        Creates permutation group with a given generating set.
        Parameters:
        generators - generating set
      • createPermutationGroup

        public static PermutationGroup createPermutationGroup(java.util.List<Permutation> generators)
        Creates permutation group with a given generating set.
        Parameters:
        generators - generating set
      • createPermutationGroupFromBSGS

        public static PermutationGroup createPermutationGroupFromBSGS(java.util.List<BSGSElement> bsgs)
        Creates permutation group with a given base and strong generating set.
        Parameters:
        bsgs - base and strong generating set
      • symmetricGroup

        public static PermutationGroup symmetricGroup(int degree)
        Creates symmetric group of specified degree. BSGS structure of symmetric group will be constructed in O(n^2) time.
        Parameters:
        degree - degree
        Returns:
        symmetric group of specified degree
        See Also:
        AlgorithmsBase.createSymmetricGroupBSGS(int)
      • antisymmetricGroup

        public static PermutationGroup antisymmetricGroup(int degree)
        Creates symmetric group of specified degree, where all odd permutations are antisymmetries. BSGS structure of symmetric group will be constructed in O(n^2) time.
        Parameters:
        degree - degree
        Returns:
        antisymmetric group of specified degree
        See Also:
        AlgorithmsBase.createSymmetricGroupBSGS(int)
      • alternatingGroup

        public static PermutationGroup alternatingGroup(int degree)
        Creates alternating group of specified degree. BSGS structure of alternating group will be constructed in O(n^2) time.
        Parameters:
        degree - degree
        Returns:
        alternating group of specified degree
        See Also:
        AlgorithmsBase.createAlternatingGroupBSGS(int)
      • getPositionsInOrbits

        public int[] getPositionsInOrbits()
        Returns positions of points in array of orbits, i.e. for each point orbits()[getPositionsInOrbits()[point]] - is its orbit.
        Returns:
        positions of points in array of orbits
      • generators

        public java.util.List<Permutation> generators()
        Returns an unmodifiable list of group generators.
        Returns:
        unmodifiable list of group generators
      • degree

        public int degree()
        Returns the natural degree of this group, i.e. the largest point moved by this group plus one.
        Returns:
        the largest point moved by this group plus one
      • orbit

        public int[] orbit(int point)
        Returns the orbit of specified point.
        Parameters:
        point - point
        Returns:
        orbit of specified point
      • orbitSize

        public int orbitSize(int point)
        Returns size of orbit of specified point.
        Parameters:
        point - point
        Returns:
        size of orbit of specified point
      • orbit

        public int[] orbit(int... points)
        Returns the orbit of specified set of points.
        Parameters:
        points - set of points
        Returns:
        orbit of specified set of points
      • orbits

        public int[][] orbits()
        Returns an array of all orbits.
        Returns:
        an array of all orbits
      • indexOfOrbit

        public int indexOfOrbit(int point)
        Returns an index of orbit of this point in the array of all orbits returned by method orbits(), i.e. orbits()[indexOfOrbit(point)] is orbit of specified point, or -1 if point >= degree().
        Parameters:
        point - point
        Returns:
        index of orbit of this point in the array of all orbits or -1 if point >= degree()
      • isTransitive

        public boolean isTransitive()
        Returns true if this group is transitive under the action on the set of its moved points and false otherwise.
        Returns:
        true if this group is transitive under the action on the set of its moved points and false otherwise
      • isTransitive

        public boolean isTransitive(int from,
                                    int to)
        Returns true if this group acts transitively on the array [from, from + 1,...,to-1] and false if not.
        Returns:
        true if this group acts transitively on the array [from, from + 1,...,to-1] and false if not
      • isTrivial

        public boolean isTrivial()
        Returns true if this group is trivial and false otherwise.
        Returns:
        true if this group is trivial and false otherwise
      • isAbelian

        public boolean isAbelian()
        Returns true if this group is abelian and false otherwise.
        Returns:
        true if this group is abelian and false otherwise.
      • union

        public PermutationGroup union(Permutation... generators)
        Extends this group with specified generators, i.e. returns a union of this group and a group generated by specified generators.
        Parameters:
        generators - new generators
        Returns:
        a group generated by this and specified generators
      • union

        public PermutationGroup union(java.util.List<Permutation> generators)
        Extends this group with specified generators, i.e. returns a union of this group and a group generated by specified generators.
        Parameters:
        generators - new generators
        Returns:
        a group generated by this and specified generators
      • getBSGS

        public java.util.List<BSGSElement> getBSGS()
        Returns base and strong generating set of this group.
        Returns:
        base and strong generating set of this group
      • getBase

        public int[] getBase()
        Returns base of this group.
        Returns:
        base of this group
      • order

        public java.math.BigInteger order()
        Returns the order of this group, i.e. the number of permutations in this group.
        Returns:
        the order of this group
      • ordering

        public InducedOrdering ordering()
        Returns an ordering on Ω(degree) induced by a base of this group.
        Returns:
        ordering on Ω(degree) induced by a base of this group
      • membershipTest

        public boolean membershipTest(Permutation permutation)
        Returns true if specified permutation is member of this group and false otherwise.
        Parameters:
        permutation - permutation
        Returns:
        true if specified permutation is member of this group and false otherwise
      • membershipTest

        public boolean membershipTest(java.util.Collection<Permutation> permutations)
        Returns true if all specified permutations are members of this group and false otherwise.
        Parameters:
        permutations - permutations
        Returns:
        true if all specified permutations are members of this group and false otherwise
        See Also:
        membershipTest(Permutation)
      • randomElement

        public Permutation randomElement()
        Returns uniformly distributed random permutation from this group.
        Returns:
        uniformly distributed random permutation from this group
      • randomElement

        public Permutation randomElement(org.apache.commons.math3.random.RandomGenerator generator)
        Returns uniformly distributed random permutation from this group.
        Parameters:
        generator - random generator to be used in generation of random permutation
        Returns:
        uniformly distributed random permutation from this group
      • getBSGSCandidate

        public java.util.ArrayList<BSGSCandidateElement> getBSGSCandidate()
        Returns a mutable copy of base and strong generating set.
        Returns:
        a mutable copy of base and strong generating set
      • isSymmetric

        public boolean isSymmetric()
        Returns true if this group is natural symmetric group and false otherwise.
        Returns:
        true is this group is natural symmetric group and false otherwise
      • isAlternating

        public boolean isAlternating()
        Returns true is this group is natural alternating group Alt(degree) and false otherwise.
        Returns:
        true is this group is natural alternating group Alt(degree) and false otherwise
      • isRegular

        public boolean isRegular()
        Returns true if this group is regular (transitive and its order equals to degree) and false otherwise,
        Returns:
        true if this group is regular and false otherwise
      • pointwiseStabilizer

        public PermutationGroup pointwiseStabilizer(int... set)
        Calculates a pointwise stabilizer of specified set of points.
        Parameters:
        set - set of points
        Returns:
        pointwise stabilizer of specified set of points.
      • pointwiseStabilizerRestricted

        public PermutationGroup pointwiseStabilizerRestricted(int... set)
        Calculates a group which isomorphic to a pointwise stabilizer of specified set but acts on points that are not stabilized, i.e. the degree of the resulting group equal to this.degree() - set.length (under the assumption that set contains distinct points).
        Parameters:
        set - set of points
        Returns:
        pointwise stabilizer of specified set of points that acts on points which not contained in specified set
      • normalClosureOf

        public PermutationGroup normalClosureOf(PermutationGroup subgroup)
        Calculates normal closure of specified subgroup. The algorithm follows NORMALCLOSURE (randomized version) described in Sec. 3.3.2 in [Holt05].
        Parameters:
        subgroup - subgroup of this
        Returns:
        normal closure
      • commutator

        public PermutationGroup commutator(PermutationGroup group)
        Returns a commutator of this group with specified group.
        Parameters:
        group - permutation group
        Returns:
        commutator of this and specified group
      • derivedSubgroup

        public PermutationGroup derivedSubgroup()
        Returns a derived subgroup, i.e. commutator subgroup of this with itself.
        Returns:
        derived subgroup, i.e. commutator subgroup of this with itself
      • setwiseStabilizer

        public PermutationGroup setwiseStabilizer(int... set)
        Calculates a setwise stabilizer of specified set of points.
        Parameters:
        set - set of points
        Returns:
        setwise stabilizer of specified set of points.
      • containsSubgroup

        public boolean containsSubgroup(PermutationGroup subgroup)
        Returns true if specified group is a subgroup of this.
        Parameters:
        subgroup - permutation group
        Returns:
        true if specified group is a subgroup of this
      • leftCosetRepresentatives

        public Permutation[] leftCosetRepresentatives(PermutationGroup subgroup)
        Returns a set of left coset representatives of a given subgroup in this group (by definition, left coset of subgroup K have a form g*K); each representative is minimal in its coset under the ordering returned by this.ordering(). The number of these representatives is equals to this.order().divide(subgroup.order()).
        Parameters:
        subgroup - a subgroup of this group
        Returns:
        set of left coset representatives
        See Also:
        AlgorithmsBacktrack.leftCosetRepresentatives(java.util.List, java.util.List)
      • union

        public PermutationGroup union(PermutationGroup group)
        Returns a union of this and specified group, i.e. group which is generated by union of generators of this and specified group.
        Parameters:
        group - permutation group
        Returns:
        union of this and specified group
      • intersection

        public PermutationGroup intersection(PermutationGroup oth)
        Returns an intersection of this group with specified group.
        Parameters:
        oth - permutation group
        Returns:
        intersections of groups
      • directProduct

        public PermutationGroup directProduct(PermutationGroup group)
        Returns direct product of this group and specified group. This product is organized as follows: the initial segment of each permutation is equal to permutation taken from this, while the rest is taken from specified group.
        Parameters:
        group - another group
        Returns:
        direct product this × other
      • mapping

        public Permutation mapping(int from,
                                   int to)
        Returns some permutation that maps point from onto point to or null if no such permutation exists.
        Parameters:
        from - from point
        to - to point
        Returns:
        some permutation that maps point from onto point to or null if no such permutation exists
      • mapping

        public BacktrackSearch mapping(int[] from,
                                       int[] to)
        Returns an output port of permutations that preserves specified mapping between points. To be precise: for each permutation p returned by BacktrackSearch.take() and for all i ∈ {0..from.length}, it is guaranteed to be p.newIndexOf(from[i]) == to[i].

        Example:

        The following code
        Permutation perm1 = Permutations.createPermutation(8, new int[][]{{1, 2, 3}});
         Permutation perm2 = Permutations.createPermutation(8, new int[][]{{3, 4, 5, 6, 7}});
         PermutationGroup pg = PermutationGroup.createPermutationGroup(perm1, perm2);
         BacktrackSearch mappings = pg.mapping(new int[]{7, 2, 1, 3}, new int[]{5, 3, 6, 1});
         Permutation perm;
         while ((perm = mappings.take()) != null)
         System.out.println(perm);
         
        will produce 3 permutations (in cycles notation):
            +{{1, 6, 2, 3}, {5, 7}}
            +{{1, 6, 7, 5, 4, 2, 3}}
            +{{1, 6, 4, 7, 5, 2, 3}}
        Parameters:
        from - points from
        to - points to
        Returns:
        output port of permutations that preserves specified mapping between points
        Throws:
        java.lang.IllegalArgumentException - if from.length != to.length
      • iterator

        public java.util.Iterator<Permutation> iterator()
        Returns an iterator over all elements in this group.
        Specified by:
        iterator in interface java.lang.Iterable<Permutation>
        Returns:
        iterator over all elements in this group
      • centralizerOf

        public PermutationGroup centralizerOf(Permutation permutation)
        Computes centralizer of specified permutation.
        Parameters:
        permutation - permutation
        Returns:
        centralizer of specified element
      • centralizerOf

        public PermutationGroup centralizerOf(PermutationGroup subgroup)
        Computes centralizer of specified subgroup.
        Parameters:
        subgroup - a subgroup of this
        Returns:
        centralizer of specified subgroup
      • center

        public PermutationGroup center()
        Computes center of this group.
        Returns:
        center of this group
      • conjugate

        public PermutationGroup conjugate(Permutation permutation)
        Returns the conjugate permutation group of this with the specified permutation (this ^ permutation).
        Parameters:
        permutation - some permutation
        Returns:
        conjugate permutation group of this with the specified permutation
      • equals

        public boolean equals(java.lang.Object obj)
        Returns true if specified group is equals to this group, i.e. it is isomorphic and acts same on the Ω(degree).
        Overrides:
        equals in class java.lang.Object
        Parameters:
        obj - permutation group
        Returns:
        true if specified group has the same order and all its generators are contained in this group
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • toStringJava

        public java.lang.String toStringJava()
        Returns string to directly paste into Java code.
        Returns:
        Java code for this permutation group

DataMelt 3.0 © DataMelt by jWork.ORG

Ads help maintain this website.