public class Sn extends java.lang.Object implements GroupImpl
| Modifier and Type | Class and Description |
|---|---|
class |
Sn.SnElementImpl
A permutation on \(\{1,...,n\}\).
|
| Modifier and Type | Field and Description |
|---|---|
protected int |
n |
| Constructor and Description |
|---|
Sn(int n)
Constructs Sn for n.
|
Sn(Representation repr) |
| Modifier and Type | Method and Description |
|---|---|
static Sn.SnElementImpl |
createElementFromString(java.lang.String str)
Creates a permutation from a string of images, each of which is separated by an empty space.
|
boolean |
equals(java.lang.Object obj) |
double |
estimateCostInvPerOp()
Estimates the number of inversions that can be done per group operation for the same cost.
|
GroupElementImpl |
getGenerator()
Returns any generator of this group if the group is cyclic and it's feasible to compute a generator.
|
int |
getN()
Returns the integer n of this group, such that its permutation map from and onto \(\{1,...,n\}\).
|
Sn.SnElementImpl |
getNeutralElement()
Returns the neutral element of this group.
|
Representation |
getRepresentation()
The representation of this object.
|
Sn.SnElementImpl |
getUniformlyRandomElement()
Generates a uniformly random element of this group.
|
java.util.Optional<java.lang.Integer> |
getUniqueByteLength()
Returns the number of bytes returned by this structure's
UniqueByteRepresentable.getUniqueByteRepresentation(),
or an empty Optional if this structure's elements do not guarantee a fixed length. |
int |
hashCode() |
boolean |
hasPrimeSize()
Returns true if the size of this structure is known and prime.
|
boolean |
isCommutative()
Returns true if this group is known to be commutative.
|
Sn.SnElementImpl |
restoreElement(Representation repr)
Restores a group element from its representation.
|
java.math.BigInteger |
size()
Retrieves number of elements in the group if possible.
|
java.lang.String |
toString() |
clone, finalize, getClass, notify, notifyAll, wait, wait, waitexp, getUniformlyRandomNonNeutral, implementsOwnExp, implementsOwnMultiExp, multiexp, restoreFromRepresentationpublic Sn(int n)
public Sn(Representation repr)
public int getN()
public java.math.BigInteger size()
throws java.lang.UnsupportedOperationException
GroupImplpublic boolean hasPrimeSize()
throws java.lang.UnsupportedOperationException
GroupImplhasPrimeSize in interface GroupImpljava.lang.UnsupportedOperationExceptionpublic double estimateCostInvPerOp()
GroupImpl2 would mean that an inversion costs half as much as a group operation, on average.estimateCostInvPerOp in interface GroupImplpublic Representation getRepresentation()
RepresentableReprUtilgetRepresentation in interface RepresentableRepresentationpublic Sn.SnElementImpl getNeutralElement()
GroupImplgetNeutralElement in interface GroupImplpublic Sn.SnElementImpl getUniformlyRandomElement() throws java.lang.UnsupportedOperationException
GroupImplgetUniformlyRandomElement in interface GroupImpljava.lang.UnsupportedOperationException - if the random generation cannot be donepublic Sn.SnElementImpl restoreElement(Representation repr)
GroupImplrestoreElement in interface GroupImplpublic GroupElementImpl getGenerator() throws java.lang.UnsupportedOperationException
GroupImplRepeated calls may or may not always supply the same generator again (i.e. the output is not guaranteed to be random)!
getGenerator in interface GroupImpljava.lang.UnsupportedOperationException - if group is not cyclic or it's too hard to compute a generatorpublic static Sn.SnElementImpl createElementFromString(java.lang.String str)
Specifically, the format is "[image1 image2 image3]".
public int hashCode()
hashCode in class java.lang.Objectpublic boolean equals(java.lang.Object obj)
equals in class java.lang.Objectpublic java.lang.String toString()
toString in class java.lang.Objectpublic java.util.Optional<java.lang.Integer> getUniqueByteLength()
GroupImplUniqueByteRepresentable.getUniqueByteRepresentation(),
or an empty Optional if this structure's elements do not guarantee a fixed length.
For example, elements of Zp will always be represented by ceil(ceil(log(p))/8) bytes,
hence getUniqueByteLength() would return ceil(ceil(log(p))/8).
A polynomial ring would return an empty Optional since a polynomial's unique byte representation length
depends on its degree.
getUniqueByteLength in interface GroupImplgetUniqueByteRepresentation(),
or an empty Optional, if no guaranteepublic boolean isCommutative()
GroupImplisCommutative in interface GroupImpl