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