Package org.bouncycastle.pqc.math.ntru.polynomial

## Class BigDecimalPolynomial

- java.lang.Object
- - org.bouncycastle.pqc.math.ntru.polynomial.BigDecimalPolynomial

-     public class BigDecimalPolynomial
      extends java.lang.Object

  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

    Constructors
    Constructor | Description
    --- | ---
    `BigDecimalPolynomial​(BigIntPolynomial p)` | Constructs a `BigDecimalPolynomial` from a `BigIntPolynomial`.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | `add​(BigDecimalPolynomial b)` | Adds another polynomial which can have a different number of coefficients.
    `java.lang.Object` | `clone()` | Makes a copy of the polynomial that is independent of the original.
    `java.math.BigDecimal[]` | `getCoeffs()` |
    `void` | `halve()` | Divides all coefficients by 2.
    `BigDecimalPolynomial` | `mult​(BigDecimalPolynomial poly2)` | Multiplies the polynomial by another, taking the indices mod N.
    `BigDecimalPolynomial` | `mult​(BigIntPolynomial poly2)` | Multiplies the polynomial by another.
    `BigIntPolynomial` | `round()` | Rounds all coefficients to the nearest integer.

    - ### Methods inherited from class java.lang.Object

      `equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### BigDecimalPolynomial

          public BigDecimalPolynomial​(BigIntPolynomial p)

      Constructs a `BigDecimalPolynomial` from a `BigIntPolynomial`. The two polynomials are independent of each other.
      Parameters:
        `p` - the original polynomial

  - ### Method Detail

    - #### halve

          public void halve()

      Divides all coefficients by 2.

    - #### mult

          public BigDecimalPolynomial mult​(BigIntPolynomial poly2)

      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

          public BigDecimalPolynomial mult​(BigDecimalPolynomial poly2)

      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

          public void add​(BigDecimalPolynomial b)

      Adds another polynomial which can have a different number of coefficients.
      Parameters:
        `b` - another polynomial

    - #### round

          public BigIntPolynomial round()

      Rounds all coefficients to the nearest integer.
      Returns:
        a new polynomial with `BigInteger` coefficients

    - #### clone

          public java.lang.Object clone()

      Makes a copy of the polynomial that is independent of the original.
      Overrides:
        `clone` in class `java.lang.Object`

    - #### getCoeffs

          public java.math.BigDecimal[] getCoeffs()