LongPolynomial2 (Bouncy Castle Library 1.52 API Specification)
Date: 2015-03-01

org.bouncycastle.pqc.math.ntru.polynomial

## Class LongPolynomial2

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

-     public class LongPolynomial2
      extends java.lang.Object

  A polynomial class that combines two coefficients into one `long` value for faster multiplication in 64 bit environments.
  Coefficients can be between 0 and 2047 and are stored in pairs in the bits 0..10 and 24..34 of a `long` number.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `LongPolynomial2(IntegerPolynomial p)` Constructs a `LongPolynomial2` from a `IntegerPolynomial`.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `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.
    `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()`

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

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

- - ### Constructor Detail

    - #### LongPolynomial2

          public LongPolynomial2(IntegerPolynomial p)

      Constructs a `LongPolynomial2` from a `IntegerPolynomial`. The two polynomials are independent of each other.
      Parameters:
        `p` - the original polynomial. Coefficients must be between 0 and 2047.

  - ### Method Detail

    - #### mult

          public LongPolynomial2 mult(LongPolynomial2 poly2)

      Multiplies the polynomial with another, taking the indices mod N and the values mod 2048.

    - #### toIntegerPolynomial

          public IntegerPolynomial toIntegerPolynomial()

    - #### subAnd

          public 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.
      Parameters:
        `b` - another polynomial
        `mask` - a bit mask less than 2048 to apply to each 11-bit coefficient

    - #### mult2And

          public void mult2And(int mask)

      Multiplies this polynomial by 2 and applies an AND mask to the upper and lower halves of each coefficients.
      Parameters:
        `mask` - a bit mask less than 2048 to apply to each 11-bit coefficient

    - #### clone

          public java.lang.Object clone()

      Overrides:
        `clone` in class `java.lang.Object`

    - #### equals

          public boolean equals(java.lang.Object obj)

      Overrides:
        `equals` in class `java.lang.Object`