public final class IntegersZp extends ARing<BigInteger>
modulus
.Modifier and Type | Field and Description |
---|---|
BigInteger |
modulus
The modulus.
|
plain
Constructor and Description |
---|
IntegersZp(BigInteger modulus)
Creates Zp ring for specified modulus.
|
IntegersZp(long modulus)
Creates Zp ring for specified modulus.
|
Modifier and Type | Method and Description |
---|---|
BigInteger |
add(BigInteger a,
BigInteger b)
Add two elements
|
IntegersZp64 |
asMachineRing()
Converts to a
IntegersZp64 |
IntegersZp64 |
asZp64()
Returns machine integer ring or null if modulus is larger than
long |
BigInteger |
cardinality()
Returns the number of elements in this ring (cardinality) or null if ring is infinite
|
BigInteger |
characteristic()
Returns characteristic of this ring
|
int |
compare(BigInteger o1,
BigInteger o2) |
BigInteger |
copy(BigInteger element)
Makes a deep copy of the specified element (for immutable instances the same reference returned).
|
BigInteger[] |
createArray(int length)
Creates generic array of ring elements of specified length
|
BigInteger[][] |
createArray2d(int length)
Creates 2d array of ring elements of specified length
|
BigInteger[][] |
createArray2d(int m,
int n)
Creates 2d array of ring elements of specified shape
|
BigInteger |
divide(BigInteger a,
BigInteger b) |
BigInteger[] |
divideAndRemainder(BigInteger a,
BigInteger b)
Returns quotient and remainder of
dividend / divider |
boolean |
equals(Object o) |
FactorDecomposition<BigInteger> |
factor(BigInteger element)
Factor specified element
|
FactorDecomposition<BigInteger> |
factorSquareFree(BigInteger element)
Square-free factorization of specified element
|
BigInteger |
getOne()
Returns unit element of this ring (one)
|
BigInteger |
getZero()
Returns zero element of this ring
|
int |
hashCode() |
boolean |
isEuclideanRing()
Returns whether this ring is a Euclidean ring
|
boolean |
isField()
Returns whether this ring is a field
|
boolean |
isOne(BigInteger element)
Tests whether specified element is one (exactly)
|
boolean |
isUnit(BigInteger element)
Tests whether specified element is a ring unit
|
boolean |
isZero(BigInteger element)
Tests whether specified element is zero
|
Iterator<BigInteger> |
iterator()
Returns iterator over ring elements (for finite rings, otherwise throws exception)
|
BigInteger |
modulus(BigInteger val)
Returns
val mod this.modulus |
BigInteger |
multiply(BigInteger a,
BigInteger b)
Multiplies two elements
|
BigInteger |
negate(BigInteger element)
Negates the given element
|
BigInteger |
parse(String string)
Parse string into ring element
|
IntegersZp |
perfectPowerBaseDomain()
Returns ring for
ARing.perfectPowerBase() or this if modulus is not a perfect power |
BigInteger |
randomElement(org.apache.commons.math3.random.RandomGenerator rnd)
Returns a random element from this ring
|
BigInteger |
reciprocal(BigInteger element)
Gives the inverse element
element ^ (-1) |
BigInteger |
remainder(BigInteger a,
BigInteger b)
Returns the remainder of
dividend / divider |
int |
signum(BigInteger element)
Returns -1 if
element < 0 , 0 if element == 0 and 1 if element > 0 , where comparison is
specified by Comparator.compare(Object, Object) |
BigInteger |
subtract(BigInteger a,
BigInteger b)
Subtracts
b from a |
BigInteger |
symmetricForm(BigInteger value)
Converts
value to a symmetric representation of Zp |
String |
toString() |
BigInteger |
valueOf(BigInteger val)
Converts a value from other ring to this ring.
|
BigInteger |
valueOf(long val)
Returns ring element associated with specified
long |
BigInteger |
valueOfBigInteger(BigInteger val)
Returns ring element associated with specified integer
|
isPerfectPower, perfectPowerBase, perfectPowerExponent
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
add, addMutable, createArray, createArray, createArray, createZeroesArray, decrement, divideExact, divideOrNull, extendedGCD, factorial, gcd, gcd, gcd, getNegativeOne, increment, isFinite, isFiniteField, isMinusOne, isUnitOrZero, lcm, multiply, multiplyMutable, negateMutable, pow, pow, pow, quotient, randomElement, randomNonZeroElement, setToValueOf, subtractMutable, toString, valueOf
comparing, comparing, comparingDouble, comparingInt, comparingLong, naturalOrder, nullsFirst, nullsLast, reversed, reverseOrder, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
forEach, spliterator
plain, withVariables
public final BigInteger modulus
public IntegersZp(BigInteger modulus)
modulus
- the moduluspublic IntegersZp(long modulus)
modulus
- the moduluspublic boolean isField()
Ring
public boolean isEuclideanRing()
Ring
public BigInteger cardinality()
Ring
public BigInteger characteristic()
Ring
public boolean isUnit(BigInteger element)
Ring
element
- the ring elementRing.isOne(Object)
public BigInteger modulus(BigInteger val)
val mod this.modulus
val
- the integerval mod this.modulus
public BigInteger symmetricForm(BigInteger value)
value
to a symmetric representation of Zpvalue
- field elementvalue
in a symmetric representation of Zppublic IntegersZp64 asMachineRing()
IntegersZp64
public BigInteger add(BigInteger a, BigInteger b)
Ring
a
- the first elementb
- the second elementpublic BigInteger subtract(BigInteger a, BigInteger b)
Ring
b
from a
a
- the first elementb
- the second elementpublic BigInteger negate(BigInteger element)
Ring
element
- the ring elementpublic BigInteger multiply(BigInteger a, BigInteger b)
Ring
a
- the first elementb
- the second elementpublic BigInteger[] divideAndRemainder(BigInteger a, BigInteger b)
Ring
dividend / divider
a
- the dividendb
- the divider{quotient, remainder}
public BigInteger divide(BigInteger a, BigInteger b)
public BigInteger remainder(BigInteger a, BigInteger b)
Ring
dividend / divider
a
- the dividendb
- the dividerdividend / divider
public BigInteger reciprocal(BigInteger element)
Ring
element ^ (-1)
element
- the elementelement ^ (-1)
public FactorDecomposition<BigInteger> factorSquareFree(BigInteger element)
Ring
public FactorDecomposition<BigInteger> factor(BigInteger element)
Ring
public BigInteger valueOf(BigInteger val)
Ring
val
- some element from any ringval
public BigInteger valueOf(long val)
Ring
long
val
- machine integerlong
public BigInteger randomElement(org.apache.commons.math3.random.RandomGenerator rnd)
Ring
rnd
- the source of randomnesspublic Iterator<BigInteger> iterator()
Ring
public IntegersZp perfectPowerBaseDomain()
ARing.perfectPowerBase()
or this
if modulus is not a perfect powerARing.perfectPowerBase()
or this
if modulus is not a perfect powerpublic IntegersZp64 asZp64()
long
long
public boolean equals(Object o)
equals
in interface Comparator<BigInteger>
equals
in class Object
public final BigInteger getZero()
Ring
public final BigInteger getOne()
Ring
public final boolean isZero(BigInteger element)
Ring
element
- the ring elementpublic final boolean isOne(BigInteger element)
Ring
element
- the ring elementRing.isUnit(Object)
public final BigInteger parse(String string)
Ring
string
- stringpublic final int signum(BigInteger element)
Ring
element < 0
, 0 if element == 0
and 1 if element > 0
, where comparison is
specified by Comparator.compare(Object, Object)
element
- the elementelement < 0
, 0 if element == 0
and 1 otherwisepublic final int compare(BigInteger o1, BigInteger o2)
public final BigInteger[] createArray(int length)
Ring
length
- array lengthlength
public final BigInteger[][] createArray2d(int length)
Ring
length
- array lengthlength
public final BigInteger[][] createArray2d(int m, int n)
Ring
m
- result lengthn
- length of each array in the resultpublic final BigInteger valueOfBigInteger(BigInteger val)
Ring
val
- integerpublic BigInteger copy(BigInteger element)
Ring
element
- the elementCopyright © 2017. All rights reserved.