public final class IntegersZp64 extends Object implements Serializable
FastDivision,
Serialized Form| Modifier and Type | Field and Description |
|---|---|
cc.redberry.libdivide4j.FastDivision.Magic |
magic
magic
|
cc.redberry.libdivide4j.FastDivision.Magic |
magic32MulMod
magic
|
long |
modulus
the modulus
|
boolean |
modulusFits32
whether modulus less then 2^32 (if so, faster mulmod available)
|
| Constructor and Description |
|---|
IntegersZp64(long modulus)
Creates the ring.
|
IntegersZp64(long modulus,
cc.redberry.libdivide4j.FastDivision.Magic magic,
cc.redberry.libdivide4j.FastDivision.Magic magic32MulMod,
boolean modulusFits32) |
| Modifier and Type | Method and Description |
|---|---|
long |
add(long a,
long b)
Add mod operation
|
IntegersZp |
asGenericRing()
Converts this to a generic ring over big integers
|
void |
buildCachedReciprocals()
builds a table of cached reciprocals
|
long |
divide(long a,
long b)
Subtract mod operation
|
boolean |
equals(Object o) |
long |
factorial(int value)
Gives value!
|
int |
hashCode() |
boolean |
isPerfectPower()
Returns whether the modulus is a perfect power
|
long |
modulus(BigInteger val)
Returns
val % this.modulus |
long |
modulus(long val)
Returns
val % this.modulus |
void |
modulus(long[] data)
Inplace sets elements of
data to data % this.modulus |
long |
multiply(long a,
long b)
Multiply mod operation
|
long |
negate(long val)
Negate mod operation
|
long |
perfectPowerBase()
Returns
base if modulus == base^exponent, and -1 otherwisec |
IntegersZp64 |
perfectPowerBaseDomain()
Returns ring for
perfectPowerBase() or this if modulus is not a perfect power |
long |
perfectPowerExponent()
Returns
exponent if modulus == base^exponent, and -1 otherwisec |
long |
powMod(long base,
long exponent)
Returns
base in a power of non-negative e modulo magic.modulus |
long |
randomElement()
Returns a random element from this ring
|
long |
randomElement(org.apache.commons.math3.random.RandomGenerator rnd)
Returns a random element from this ring
|
long |
randomNonZeroElement(org.apache.commons.math3.random.RandomGenerator rnd)
Returns a random non zero element from this ring
|
long |
reciprocal(long val)
Returns modular inverse of
val |
long |
subtract(long a,
long b)
Subtract mod operation
|
long |
symmetricForm(long value)
to symmetric modulus
|
String |
toString() |
public final long modulus
public final cc.redberry.libdivide4j.FastDivision.Magic magic
public final cc.redberry.libdivide4j.FastDivision.Magic magic32MulMod
public final boolean modulusFits32
public IntegersZp64(long modulus,
cc.redberry.libdivide4j.FastDivision.Magic magic,
cc.redberry.libdivide4j.FastDivision.Magic magic32MulMod,
boolean modulusFits32)
public IntegersZp64(long modulus)
modulus - the moduluspublic long modulus(long val)
val % this.moduluspublic long modulus(BigInteger val)
val % this.moduluspublic void modulus(long[] data)
data to data % this.moduluspublic long multiply(long a,
long b)
public long add(long a,
long b)
public long subtract(long a,
long b)
public long divide(long a,
long b)
public void buildCachedReciprocals()
public long reciprocal(long val)
valpublic long negate(long val)
public long symmetricForm(long value)
public IntegersZp asGenericRing()
public long powMod(long base,
long exponent)
base in a power of non-negative e modulo magic.modulusbase - the baseexponent - the non-negative exponentbase in a power of epublic long randomElement(org.apache.commons.math3.random.RandomGenerator rnd)
rnd - the source of randomnesspublic long randomElement()
public long randomNonZeroElement(org.apache.commons.math3.random.RandomGenerator rnd)
rnd - the source of randomnesspublic long factorial(int value)
value - the numberpublic boolean isPerfectPower()
public long perfectPowerBase()
base if modulus == base^exponent, and -1 otherwisecbase if modulus == base^exponent, and -1 otherwisecpublic long perfectPowerExponent()
exponent if modulus == base^exponent, and -1 otherwisecexponent if modulus == base^exponent, and -1 otherwisecpublic IntegersZp64 perfectPowerBaseDomain()
perfectPowerBase() or this if modulus is not a perfect powerperfectPowerBase() or this if modulus is not a perfect powerCopyright © 2022. All rights reserved.