# Class ModuloPolynomialField<F extends Field<F>>

java.lang.Object
org.apfloat.jscience.ModuloPolynomialField<F>

Type Parameters:
  `F` - The type of the polynomial coefficients.

All Implemented Interfaces:
  `Serializable, Immutable, Realtime, ValueType, Field<ModuloPolynomialField<F>>, GroupAdditive<ModuloPolynomialField<F>>, GroupMultiplicative<ModuloPolynomialField<F>>, Ring<ModuloPolynomialField<F>>, Structure<ModuloPolynomialField<F>>`

public class ModuloPolynomialField<F extends Field<F>> extends Object implements Field<ModuloPolynomialField<F>>, Serializable, Realtime
This class represents a polynomial modulo a modulus. The modulus must be set with `setModulus(Polynomial)`; otherwise the modulo reduction is not done.

For the polynomials to actually form a field, the modulus must be irreducible over the coefficient field. Otherwise it's just a `Ring` and the multiplicative `inverse()` method may fail.

Since:
  1.15.0
Version:
  1.15.1
Author:
  Mikko Tommila
See Also:
  - Serialized Form

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `ModuloPolynomialField(Polynomial<F> polynomial)`
  Create a new modulo polynomial.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `Object`
  `copy()`
  `boolean`
  `equals(Object obj)`
  `static <F extends Field<F>>
  Polynomial<F>`
  `getModulus()`
  Returns the modulus or `null` if modulo reduction is not done.
  `int`
  `hashCode()`
  `ModuloPolynomialField<F>`
  `inverse()`
  `ModuloPolynomialField<F>`
  `minus(ModuloPolynomialField<F> that)`
  Returns the difference of two polynomials.
  `ModuloPolynomialField<F>`
  `opposite()`
  `ModuloPolynomialField<F>`
  `plus(ModuloPolynomialField<F> that)`
  `static <F extends Field<F>>
  Polynomial<F>`
  `reduce(Polynomial<F> polynomial)`
  Reduce the polynomial with the current modulus.
  `static <F extends Field<F>>
  void`
  `setModulus(Polynomial<F> modulus)`
  Sets the modulus.
  `ModuloPolynomialField<F>`
  `times(ModuloPolynomialField<F> that)`
  `String`
  `toString()`
  `Text`
  `toText()`
  `Polynomial<F>`
  `value()`
  Returns the underlying polynomial.

  ### Methods inherited from class Object

  `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- ## Constructor Details

  - ### ModuloPolynomialField

    public ModuloPolynomialField(Polynomial<F> polynomial)
    Create a new modulo polynomial.
    Parameters:
      `polynomial` - The polynomial. Will be reduced by the modulus, if any.

- ## Method Details

  - ### getModulus

    public static <F extends Field<F>> Polynomial<F> getModulus()
    Returns the modulus or `null` if modulo reduction is not done. The modulus can be set in a thread-specific way using `LocalContext`.
    Type Parameters:
      `F` - The type of the polynomial coefficients.
    Returns:
      The local modulus or `null` if modulo reduction is not done.
    See Also:
      - `setModulus(Polynomial)`

  - ### setModulus

    public static <F extends Field<F>> void setModulus(Polynomial<F> modulus)
    Sets the modulus. The modulus can be set in a thread-specific way using `LocalContext`.
    Type Parameters:
      `F` - The type of the polynomial coefficients.
    Parameters:
      `modulus` - The modulus or `null` if modulo reduction is not done.

  - ### reduce

    public static <F extends Field<F>> Polynomial<F> reduce(Polynomial<F> polynomial)
    Reduce the polynomial with the current modulus.
    Type Parameters:
      `F` - The type of the polynomial coefficients.
    Parameters:
      `polynomial` - The polynomial.
    Returns:
      The polynomial mod the current modulus.

  - ### plus

    public ModuloPolynomialField<F> plus(ModuloPolynomialField<F> that)
    Specified by:
      `plus` in interface `GroupAdditive<F extends Field<F>>`

  - ### minus

    public ModuloPolynomialField<F> minus(ModuloPolynomialField<F> that)
    Returns the difference of two polynomials.
    Parameters:
      `that` - The polynomial being subtracted.
    Returns:
      `this - that`

  - ### opposite

    public ModuloPolynomialField<F> opposite()
    Specified by:
      `opposite` in interface `GroupAdditive<F extends Field<F>>`

  - ### times

    public ModuloPolynomialField<F> times(ModuloPolynomialField<F> that)
    Specified by:
      `times` in interface `GroupMultiplicative<F extends Field<F>>`
    Specified by:
      `times` in interface `Ring<F extends Field<F>>`

  - ### inverse

    public ModuloPolynomialField<F> inverse()
    Specified by:
      `inverse` in interface `GroupMultiplicative<F extends Field<F>>`

  - ### value

    public Polynomial<F> value()
    Returns the underlying polynomial.
    Returns:
      The polynomial.

  - ### copy

    public Object copy()
    Specified by:
      `copy` in interface `ValueType`

  - ### toText

    public Text toText()
    Specified by:
      `toText` in interface `Realtime`

  - ### toString

    public String toString()
    Overrides:
      `toString` in class `Object`

  - ### hashCode

    public int hashCode()
    Overrides:
      `hashCode` in class `Object`

  - ### equals

    public boolean equals(Object obj)
    Overrides:
      `equals` in class `Object`