Class BigDecimalPolynomial
java.lang.Object
org.bouncycastle.pqc.legacy.math.ntru.polynomial.BigDecimalPolynomial
A polynomial with
BigDecimal
coefficients.
Some methods (like add
) change the polynomial, others (like mult
) do
not but return the result as a new polynomial.-
Constructor Summary
ConstructorDescriptionConstructs aBigDecimalPolynomial
from aBigIntPolynomial
. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds another polynomial which can have a different number of coefficients.clone()
Makes a copy of the polynomial that is independent of the original.void
halve()
Divides all coefficients by 2.mult
(BigDecimalPolynomial poly2) Multiplies the polynomial by another, taking the indices mod N.mult
(BigIntPolynomial poly2) Multiplies the polynomial by another.round()
Rounds all coefficients to the nearest integer.
-
Constructor Details
-
BigDecimalPolynomial
Constructs aBigDecimalPolynomial
from aBigIntPolynomial
. The two polynomials are independent of each other.- Parameters:
p
- the original polynomial
-
-
Method Details
-
halve
public void halve()Divides all coefficients by 2. -
mult
Multiplies the polynomial by another. Does not change this polynomial but returns the result as a new polynomial.- Parameters:
poly2
- the polynomial to multiply by- Returns:
- a new polynomial
-
mult
Multiplies the polynomial by another, taking the indices mod N. Does not change this polynomial but returns the result as a new polynomial.- Parameters:
poly2
- the polynomial to multiply by- Returns:
- a new polynomial
-
add
Adds another polynomial which can have a different number of coefficients.- Parameters:
b
- another polynomial
-
round
Rounds all coefficients to the nearest integer.- Returns:
- a new polynomial with
BigInteger
coefficients
-
clone
Makes a copy of the polynomial that is independent of the original. -
getCoeffs
-