cc.redberry.core.groups.permutations
Class PermutationOneLineShort
- java.lang.Object
-
- cc.redberry.core.groups.permutations.PermutationOneLineShort
-
- All Implemented Interfaces:
- Permutation, java.lang.Comparable<Permutation>
public final class PermutationOneLineShort extends java.lang.Object implements Permutation
The implementation ofPermutationbased on the one-line notation. The instances of this class are immutable. This class represents permutations of the degree not larger thanShort.MAX_VALUE.The implementation is based on
short[]array in one-line notation and provides O(1) complexity forimageOf(int)and O(degree) complexity for composition.When multiplying instances of this by permutations of degree larger than
Short.MAX_VALUE, the new instance with enlarged array capacity will be constructed and returned (i.e.PermutationOneLineInt).
-
-
Constructor Summary
Constructors Constructor and Description PermutationOneLineShort(boolean antisymmetry, short... permutation)Creates permutation with antisymmetry property from given array in one-line notation and boolean value of antisymmetry (truemeans antisymmetry)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description booleanantisymmetry()Returns true if this permutation is antisymmetry and false otherwise.Permutationcommutator(Permutation p)Returns commutator of this and specified permutation, i.e.intcompareTo(Permutation t)Permutationcomposition(Permutation other)Returns the result ofthis * other.Permutationcomposition(Permutation a, Permutation b)Returns the result ofthis * a * b.Permutationcomposition(Permutation a, Permutation b, Permutation c)Returns the result ofthis * a * b * c.PermutationcompositionWithInverse(Permutation other)Returns the result ofthis * other.inverse().Permutationconjugate(Permutation p)Returns conjugation of specified element by this permutation, i.e.int[][]cycles()Returns an array of disjoint cycles that represent this permutation.intdegree()Returns a largest moved point plus one.booleanequals(java.lang.Object o)PermutationgetIdentity()Returns the identity permutation with the degree of this permutationinthashCode()intimageOf(int i)Returns image of specified point under the action of this permutation.int[]imageOf(int[] set)Returns image of specified set of points under the action of this permutation.Permutationinverse()Returns the inverse permutation of this.booleanisIdentity()Returnstrueif this represents identity permutationintlength()Returns length of the underlying array (at low-level).int[]lengthsOfCycles()Returns lengths of cycles in disjoint cycle notation.PermutationmoveRight(int size)Inserts identity action on the set [0, 1, ..., size - 1]; as result the degree of resulting permutation will be size + degree of this.PermutationOneLineShortnegate()Changes sign (symmetry to antisymmetry and vice versa) of this permutationintnewIndexOf(int i)Returns image of specified point under the action of this permutation.intnewIndexOfUnderInverse(int i)Returns image of specified point under the action of inverse of this permutation.int[]oneLine()Returns array that represents this permutation in one-line notation.IntArrayoneLineImmutable()Returns immutable array that represents this permutation in one-line notation.java.math.BigIntegerorder()Calculates and returns the order of this permutation.booleanorderIsOdd()Returns true if order of this permutation is odd and false otherwise.intparity()Returns parity of this permutations.char[]permute(char[] array)Permutes array and returns the result.int[]permute(int[] array)Permutes array and returns the result.<T> java.util.List<T>permute(java.util.List<T> set)Permutes list and returns the result.<T> T[]permute(T[] array)Permutes array and returns the result.Permutationpow(int exponent)Returns this raised to the specified exponent.PermutationOneLineInttoIntRepresentation()Converts this to int-based representationPermutationOneLineIntjava.lang.StringtoString()java.lang.StringtoStringCycles()Returns a string representation of this permutation in disjoint cycles notation.java.lang.StringtoStringOneLine()Returns a string representation of this permutation in one-line notation.PermutationtoSymmetry()If this is antisymmetry, then converts this permutation to symmetry.
-
-
-
Constructor Detail
-
PermutationOneLineShort
public PermutationOneLineShort(boolean antisymmetry, short... permutation)Creates permutation with antisymmetry property from given array in one-line notation and boolean value of antisymmetry (truemeans antisymmetry)- Parameters:
antisymmetry- antisymmetry (true - antisymmetry, false - symmetry)permutation- permutation in one-line notation- Throws:
java.lang.IllegalArgumentException- if permutation is inconsistent with one-line notationjava.lang.IllegalArgumentException- if antisymmetry is true and permutation order is odd
-
-
Method Detail
-
toIntRepresentation
public PermutationOneLineInt toIntRepresentation()
Converts this to int-based representationPermutationOneLineInt- Returns:
- int-based representation of permutation
-
length
public int length()
Description copied from interface:PermutationReturns length of the underlying array (at low-level).- Specified by:
lengthin interfacePermutation- Returns:
- length of the underlying array (at low-level)
-
antisymmetry
public boolean antisymmetry()
Description copied from interface:PermutationReturns true if this permutation is antisymmetry and false otherwise.- Specified by:
antisymmetryin interfacePermutation- Returns:
- true if this permutation is antisymmetry and false otherwise
-
toSymmetry
public Permutation toSymmetry()
Description copied from interface:PermutationIf this is antisymmetry, then converts this permutation to symmetry.- Specified by:
toSymmetryin interfacePermutation- Returns:
- same permutation with
falseantisymmetry
-
negate
public PermutationOneLineShort negate()
Description copied from interface:PermutationChanges sign (symmetry to antisymmetry and vice versa) of this permutation- Specified by:
negatein interfacePermutation- Returns:
- same permutation with changed sign
-
oneLine
public int[] oneLine()
Description copied from interface:PermutationReturns array that represents this permutation in one-line notation.- Specified by:
oneLinein interfacePermutation- Returns:
- array that represents this permutation in one-line notation
-
oneLineImmutable
public IntArray oneLineImmutable()
Description copied from interface:PermutationReturns immutable array that represents this permutation in one-line notation.- Specified by:
oneLineImmutablein interfacePermutation- Returns:
- immutable array that represents this permutation in one-line notation
-
cycles
public int[][] cycles()
Description copied from interface:PermutationReturns an array of disjoint cycles that represent this permutation.- Specified by:
cyclesin interfacePermutation- Returns:
- array of disjoint cycles that represent this permutation
-
newIndexOf
public int newIndexOf(int i)
Description copied from interface:PermutationReturns image of specified point under the action of this permutation.- Specified by:
newIndexOfin interfacePermutation- Parameters:
i- point- Returns:
- image of specified point under the action of this permutation
-
imageOf
public int imageOf(int i)
Description copied from interface:PermutationReturns image of specified point under the action of this permutation. This method is absolutely same asPermutation.newIndexOf(int)without any difference.- Specified by:
imageOfin interfacePermutation- Parameters:
i- point- Returns:
- image of specified point under the action of this permutation
-
imageOf
public int[] imageOf(int[] set)
Description copied from interface:PermutationReturns image of specified set of points under the action of this permutation.- Specified by:
imageOfin interfacePermutation- Parameters:
set- set- Returns:
- image of specified set under this permutation
-
permute
public int[] permute(int[] array)
Description copied from interface:PermutationPermutes array and returns the result.- Specified by:
permutein interfacePermutation- Parameters:
array- array- Returns:
- permuted array
-
permute
public char[] permute(char[] array)
Description copied from interface:PermutationPermutes array and returns the result.- Specified by:
permutein interfacePermutation- Parameters:
array- array- Returns:
- permuted array
-
permute
public <T> T[] permute(T[] array)
Description copied from interface:PermutationPermutes array and returns the result.- Specified by:
permutein interfacePermutation- Parameters:
array- array- Returns:
- permuted array
-
permute
public <T> java.util.List<T> permute(java.util.List<T> set)
Description copied from interface:PermutationPermutes list and returns the result.- Specified by:
permutein interfacePermutation- Parameters:
set- array- Returns:
- permuted array
-
newIndexOfUnderInverse
public int newIndexOfUnderInverse(int i)
Description copied from interface:PermutationReturns image of specified point under the action of inverse of this permutation.- Specified by:
newIndexOfUnderInversein interfacePermutation- Parameters:
i- point- Returns:
- image of specified point under the action of inverse of this permutation
-
conjugate
public Permutation conjugate(Permutation p)
Description copied from interface:PermutationReturns conjugation of specified element by this permutation, i.e. this^-1 * p * this- Specified by:
conjugatein interfacePermutation- Parameters:
p- permutation- Returns:
- conjugation of specified element by this permutation, i.e. this^-1 * p * this
-
commutator
public Permutation commutator(Permutation p)
Description copied from interface:PermutationReturns commutator of this and specified permutation, i.e. this^-1 * p^-1 * this * p.- Specified by:
commutatorin interfacePermutation- Parameters:
p- permutation- Returns:
- commutator of this and specified permutation, i.e. this^-1 * p^-1 * this * p
-
composition
public Permutation composition(Permutation other)
Description copied from interface:PermutationReturns the result ofthis * other. Applying the resulting permutation is equivalent to applyingotherafterthis.- Specified by:
compositionin interfacePermutation- Parameters:
other- other permutation- Returns:
- the result of
this * other
-
composition
public Permutation composition(Permutation a, Permutation b)
Description copied from interface:PermutationReturns the result ofthis * a * b. Applying the resulting permutation is equivalent to applyingbafteraafterthis.- Specified by:
compositionin interfacePermutation- Parameters:
a- other permutationb- other permutation- Returns:
- the result of
this * a * b
-
composition
public Permutation composition(Permutation a, Permutation b, Permutation c)
Description copied from interface:PermutationReturns the result ofthis * a * b * c. Applying the resulting permutation is equivalent to applyingcafterbafteraafterthis.- Specified by:
compositionin interfacePermutation- Parameters:
a- other permutationb- other permutationc- other permutation- Returns:
- the result of
this * a * b * c
-
compositionWithInverse
public Permutation compositionWithInverse(Permutation other)
Description copied from interface:PermutationReturns the result ofthis * other.inverse(). Applying the resulting permutation is equivalent to applyingother.inverse()afterthis.- Specified by:
compositionWithInversein interfacePermutation- Parameters:
other- other permutation- Returns:
- the result of
this * other.inverse()
-
inverse
public Permutation inverse()
Description copied from interface:PermutationReturns the inverse permutation of this.- Specified by:
inversein interfacePermutation- Returns:
- the inverse permutation of this
-
isIdentity
public boolean isIdentity()
Description copied from interface:PermutationReturnstrueif this represents identity permutation- Specified by:
isIdentityin interfacePermutation- Returns:
trueif this is identity permutation
-
getIdentity
public Permutation getIdentity()
Description copied from interface:PermutationReturns the identity permutation with the degree of this permutation- Specified by:
getIdentityin interfacePermutation- Returns:
- identity permutation with the degree of this permutation
-
order
public java.math.BigInteger order()
Description copied from interface:PermutationCalculates and returns the order of this permutation.- Specified by:
orderin interfacePermutation- Returns:
- order of this permutation
- See Also:
Permutations.orderOfPermutation(int[])
-
orderIsOdd
public boolean orderIsOdd()
Description copied from interface:PermutationReturns true if order of this permutation is odd and false otherwise.- Specified by:
orderIsOddin interfacePermutation- Returns:
- true if order of this permutation is odd and false otherwise
-
degree
public int degree()
Description copied from interface:PermutationReturns a largest moved point plus one.- Specified by:
degreein interfacePermutation- Returns:
- largest moved point plus one
-
pow
public Permutation pow(int exponent)
Description copied from interface:PermutationReturns this raised to the specified exponent.- Specified by:
powin interfacePermutation- Parameters:
exponent- exponent- Returns:
- this raised to the specified exponent
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
parity
public int parity()
Description copied from interface:PermutationReturns parity of this permutations.- Specified by:
parityin interfacePermutation- Returns:
- parity of this permutations
-
moveRight
public Permutation moveRight(int size)
Description copied from interface:PermutationInserts identity action on the set [0, 1, ..., size - 1]; as result the degree of resulting permutation will be size + degree of this.- Specified by:
moveRightin interfacePermutation- Parameters:
size- size of the set
-
lengthsOfCycles
public int[] lengthsOfCycles()
Description copied from interface:PermutationReturns lengths of cycles in disjoint cycle notation.- Specified by:
lengthsOfCyclesin interfacePermutation- Returns:
- lengths of cycles in disjoint cycle notation
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
toStringOneLine
public java.lang.String toStringOneLine()
Description copied from interface:PermutationReturns a string representation of this permutation in one-line notation.- Specified by:
toStringOneLinein interfacePermutation- Returns:
- a string representation of this permutation in one-line notation
-
toStringCycles
public java.lang.String toStringCycles()
Description copied from interface:PermutationReturns a string representation of this permutation in disjoint cycles notation.- Specified by:
toStringCyclesin interfacePermutation- Returns:
- a string representation of this permutation in disjoint cycles notation
-
compareTo
public int compareTo(Permutation t)
- Specified by:
compareToin interfacejava.lang.Comparable<Permutation>
-
-
DataMelt 3.0 © DataMelt by jWork.ORG