Interface FieldElement<T>

Type Parameters:
T - the type of the field elements
All Known Subinterfaces:
RealFieldElement<T>
All Known Implementing Classes:
BigFraction, BigReal, Complex, Decimal64, DerivativeStructure, Dfp, DfpDec, Fraction, SparseGradient

public interface FieldElement<T>
Interface representing field elements.
Since:
2.0
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    add(T a)
    Compute this + a.
    divide(T a)
    Compute this ÷ a.
    Get the Field to which the instance belongs.
    multiply(int n)
    Compute n × this.
    Compute this × a.
    Returns the additive inverse of this element.
    Returns the multiplicative inverse of this element.
    Compute this - a.
  • Method Details

    • add

      T add(T a) throws NullArgumentException
      Compute this + a.
      Parameters:
      a - element to add
      Returns:
      a new element representing this + a
      Throws:
      NullArgumentException - if a is null.
    • subtract

      T subtract(T a) throws NullArgumentException
      Compute this - a.
      Parameters:
      a - element to subtract
      Returns:
      a new element representing this - a
      Throws:
      NullArgumentException - if a is null.
    • negate

      T negate()
      Returns the additive inverse of this element.
      Returns:
      the opposite of this.
    • multiply

      T multiply(int n)
      Compute n × this. Multiplication by an integer number is defined as the following sum
      n × this = ∑i=1n this.
      Parameters:
      n - Number of times this must be added to itself.
      Returns:
      A new element representing n × this.
    • multiply

      T multiply(T a) throws NullArgumentException
      Compute this × a.
      Parameters:
      a - element to multiply
      Returns:
      a new element representing this × a
      Throws:
      NullArgumentException - if a is null.
    • divide

      Compute this ÷ a.
      Parameters:
      a - element to divide by
      Returns:
      a new element representing this ÷ a
      Throws:
      NullArgumentException - if a is null.
      MathArithmeticException - if a is zero
    • reciprocal

      T reciprocal() throws MathArithmeticException
      Returns the multiplicative inverse of this element.
      Returns:
      the inverse of this.
      Throws:
      MathArithmeticException - if this is zero
    • getField

      Field<T> getField()
      Get the Field to which the instance belongs.
      Returns:
      Field to which the instance belongs