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