public class LongPolynomial2
extends java.lang.Object
long
value for
faster multiplication in 64 bit environments.long
number.Modifier and Type | Field and Description |
---|---|
private long[] |
coeffs |
private int |
numCoeffs |
Modifier | Constructor and Description |
---|---|
private |
LongPolynomial2(int N) |
|
LongPolynomial2(IntegerPolynomial p)
Constructs a
LongPolynomial2 from a IntegerPolynomial . |
private |
LongPolynomial2(long[] coeffs) |
Modifier and Type | Method and Description |
---|---|
private void |
add(LongPolynomial2 b)
Adds another polynomial which can have a different number of coefficients.
|
java.lang.Object |
clone() |
boolean |
equals(java.lang.Object obj) |
LongPolynomial2 |
mult(LongPolynomial2 poly2)
Multiplies the polynomial with another, taking the indices mod N and the values mod 2048.
|
void |
mult2And(int mask)
Multiplies this polynomial by 2 and applies an AND mask to the upper and
lower halves of each coefficients.
|
private LongPolynomial2 |
multRecursive(LongPolynomial2 poly2)
Karazuba multiplication
|
private void |
sub(LongPolynomial2 b)
Subtracts another polynomial which can have a different number of coefficients.
|
void |
subAnd(LongPolynomial2 b,
int mask)
Subtracts another polynomial which must have the same number of coefficients,
and applies an AND mask to the upper and lower halves of each coefficients.
|
IntegerPolynomial |
toIntegerPolynomial() |
public LongPolynomial2(IntegerPolynomial p)
LongPolynomial2
from a IntegerPolynomial
. The two polynomials are independent of each other.p
- the original polynomial. Coefficients must be between 0 and 2047.private LongPolynomial2(long[] coeffs)
private LongPolynomial2(int N)
public LongPolynomial2 mult(LongPolynomial2 poly2)
public IntegerPolynomial toIntegerPolynomial()
private LongPolynomial2 multRecursive(LongPolynomial2 poly2)
private void add(LongPolynomial2 b)
b
- another polynomialprivate void sub(LongPolynomial2 b)
b
- another polynomialpublic void subAnd(LongPolynomial2 b, int mask)
b
- another polynomialmask
- a bit mask less than 2048 to apply to each 11-bit coefficientpublic void mult2And(int mask)
mask
- a bit mask less than 2048 to apply to each 11-bit coefficientpublic java.lang.Object clone()
clone
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object