public final class ModIntRing extends java.lang.Object implements ModularRingFactory<ModInt>, java.lang.Iterable<ModInt>
Modifier and Type | Field and Description |
---|---|
static java.math.BigInteger |
MAX_INT
maximal representable integer.
|
int |
modul
Module part of the factory data structure.
|
Constructor and Description |
---|
ModIntRing(java.math.BigInteger m)
The constructor creates a ModIntRing object from a BigInteger converted
to int as module part.
|
ModIntRing(java.math.BigInteger m,
boolean isField)
The constructor creates a ModIntRing object from a BigInteger converted
to int as module part.
|
ModIntRing(int m)
The constructor creates a ModIntRing object from a int integer as module
part.
|
ModIntRing(int m,
boolean isField)
The constructor creates a ModIntRing object from a int integer as module
part.
|
ModIntRing(java.lang.Integer m)
The constructor creates a ModIntRing object from a Int integer as module
part.
|
ModIntRing(java.lang.Integer m,
boolean isField)
The constructor creates a ModIntRing object from a Int integer as module
part.
|
ModIntRing(java.lang.String m)
The constructor creates a ModIntRing object from a String object as
module part.
|
ModIntRing(java.lang.String m,
boolean isField)
The constructor creates a ModIntRing object from a String object as
module part.
|
Modifier and Type | Method and Description |
---|---|
java.math.BigInteger |
characteristic()
Characteristic of this ring.
|
static java.util.List<ModInt> |
chineseRemainder(ModInt m1,
ModInt m2,
java.util.List<ModInt> L1,
java.util.List<ModInt> L2)
Modular digit list chinese remainder algorithm. m1 and m2 are positive
beta-integers, with GCD(m1,m2)=1 and m=m1*m2 less than beta.
|
ModInt |
chineseRemainder(ModInt c,
ModInt ci,
ModInt a)
ModInt chinese remainder algorithm.
|
ModInt |
copy(ModInt c)
Copy ModInt element c.
|
ModInt |
create(java.math.BigInteger c)
Create ModInt element c.
|
ModInt |
create(int c)
Create ModInt element c.
|
ModInt |
create(java.lang.String c)
Create ModInt element c.
|
boolean |
equals(java.lang.Object b)
Comparison with any other object.
|
ModInt |
fromInteger(java.math.BigInteger a)
Get a ModInt element from a BigInteger value.
|
ModInt |
fromInteger(int a)
Get a ModInt element from a int value.
|
ModInt |
fromInteger(long a)
Get a ModInt element from a long value.
|
java.util.List<ModInt> |
generators()
Get a list of the generating elements.
|
BigInteger |
getIntegerModul()
Get the module part as BigInteger.
|
int |
getIntModul()
Get the module part as int.
|
java.math.BigInteger |
getModul()
Get the module part as BigInteger.
|
ModInt |
getONE()
Get the one element.
|
ModInt |
getZERO()
Get the zero element.
|
int |
hashCode()
Hash code for this ModIntRing.
|
boolean |
isAssociative()
Query if this ring is associative.
|
boolean |
isCommutative()
Query if this ring is commutative.
|
boolean |
isField()
Query if this ring is a field.
|
boolean |
isFinite()
Is this structure finite or infinite.
|
java.util.Iterator<ModInt> |
iterator()
Get a ModInt iterator.
|
ModInt |
parse(java.io.Reader r)
Parse ModInt from Reader.
|
ModInt |
parse(java.lang.String s)
Parse ModInt from String.
|
ModInt |
random(int n)
ModInt random.
|
ModInt |
random(int n,
java.util.Random rnd)
ModInt random.
|
java.lang.String |
toScript()
Get a scripting compatible string representation.
|
java.lang.String |
toString()
Get the String representation.
|
public final int modul
public static final java.math.BigInteger MAX_INT
public ModIntRing(int m)
m
- int integer.public ModIntRing(int m, boolean isField)
m
- int integer.isField
- indicator if m is prime.public ModIntRing(java.lang.Integer m)
m
- Int integer.public ModIntRing(java.lang.Integer m, boolean isField)
m
- Int integer.isField
- indicator if m is prime.public ModIntRing(java.math.BigInteger m)
m
- java.math.BigInteger.public ModIntRing(java.math.BigInteger m, boolean isField)
m
- java.math.BigInteger.isField
- indicator if m is prime.public ModIntRing(java.lang.String m)
m
- String.public ModIntRing(java.lang.String m, boolean isField)
m
- String.isField
- indicator if m is prime.public java.math.BigInteger getModul()
public int getIntModul()
public BigInteger getIntegerModul()
getIntegerModul
in interface ModularRingFactory<ModInt>
public ModInt create(java.math.BigInteger c)
c
- public ModInt create(java.lang.String c)
c
- public ModInt copy(ModInt c)
copy
in interface ElemFactory<ModInt>
c
- public ModInt getZERO()
getZERO
in interface AbelianGroupFactory<ModInt>
public ModInt getONE()
getONE
in interface MonoidFactory<ModInt>
public java.util.List<ModInt> generators()
generators
in interface ElemFactory<ModInt>
ElemFactory.generators()
public boolean isFinite()
isFinite
in interface ElemFactory<ModInt>
ElemFactory.isFinite()
public boolean isCommutative()
isCommutative
in interface MonoidFactory<ModInt>
public boolean isAssociative()
isAssociative
in interface MonoidFactory<ModInt>
public boolean isField()
isField
in interface RingFactory<ModInt>
public java.math.BigInteger characteristic()
characteristic
in interface RingFactory<ModInt>
public ModInt fromInteger(java.math.BigInteger a)
fromInteger
in interface ElemFactory<ModInt>
a
- BigInteger.public ModInt fromInteger(int a)
a
- int.public ModInt fromInteger(long a)
fromInteger
in interface ElemFactory<ModInt>
a
- lon.public java.lang.String toString()
toString
in class java.lang.Object
Object.toString()
public java.lang.String toScript()
toScript
in interface ElemFactory<ModInt>
ElemFactory.toScript()
public boolean equals(java.lang.Object b)
equals
in class java.lang.Object
Object.equals(java.lang.Object)
public int hashCode()
hashCode
in class java.lang.Object
Object.hashCode()
public ModInt random(int n)
random
in interface ElemFactory<ModInt>
n
- such that 0 ≤ v ≤ (2n-1).public ModInt random(int n, java.util.Random rnd)
random
in interface ElemFactory<ModInt>
n
- such that 0 ≤ v ≤ (2n-1).rnd
- is a source for random bits.public ModInt parse(java.lang.String s)
parse
in interface ElemFactory<ModInt>
s
- String.public ModInt parse(java.io.Reader r)
parse
in interface ElemFactory<ModInt>
r
- Reader.public ModInt chineseRemainder(ModInt c, ModInt ci, ModInt a)
chineseRemainder
in interface ModularRingFactory<ModInt>
c
- ModInt.ci
- inverse of c.modul in ring of a.a
- other ModInt.public static java.util.List<ModInt> chineseRemainder(ModInt m1, ModInt m2, java.util.List<ModInt> L1, java.util.List<ModInt> L2)
m1
- ModInt.m2
- other ModInt.