public class LongModMath extends LongElementaryModMath
long
data.Constructor and Description |
---|
LongModMath()
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
long[] |
createWTable(long w,
int n)
Create a table of powers of n:th root of unity.
|
long |
getForwardNthRoot(long primitiveRoot,
long n)
Get forward n:th root of unity.
|
long |
getInverseNthRoot(long primitiveRoot,
long n)
Get inverse n:th root of unity.
|
long |
modDivide(long a,
long b)
Modular division.
|
long |
modInverse(long a)
Modular inverse, that is
1 / a . |
long |
modPow(long a,
long n)
Modular power.
|
long |
negate(long a)
Modular negation.
|
getModulus, modAdd, modMultiply, modSubtract, setModulus
public final long[] createWTable(long w, int n)
w
- The n:th root of unity modulo the current modulus.n
- The table length (= transform length).table[i]=wi mod m
, i = 0, ..., n-1.public long getForwardNthRoot(long primitiveRoot, long n)
w
.Assumes that the modulus is prime.
primitiveRoot
- Primitive root of the modulus.n
- The transform length.public long getInverseNthRoot(long primitiveRoot, long n)
w-1
.Assumes that the modulus is prime.
primitiveRoot
- Primitive root of the modulus.n
- The transform length.public final long modInverse(long a)
1 / a
. Assumes that the modulus is prime.a
- The operand.a-1 mod m
.public final long modDivide(long a, long b)
a
- The dividend.b
- The divisor.a*b-1 mod m
.public final long negate(long a)
a
- The argument.-a mod m
.public final long modPow(long a, long n)
a
- The base.n
- The exponent.an mod m
.Copyright © 2019. All rights reserved.