Class AbstractField<T extends NativeOperators<T>>

java.lang.Object
org.apache.commons.numbers.field.AbstractField<T>
Type Parameters:
T - Type of the field elements.
All Implemented Interfaces:
Field<T>
Direct Known Subclasses:
BigFractionField, FP64Field, FractionField

public abstract class AbstractField<T extends NativeOperators<T>> extends Object implements Field<T>
Boiler-plate code for concrete implementations of Field.
  • Constructor Details

    • AbstractField

      public AbstractField()
  • Method Details

    • add

      public T add(T a, T b)
      Specified by:
      add in interface Field<T extends NativeOperators<T>>
      Parameters:
      a - Field element.
      b - Field element.
      Returns:
      a + b.
    • subtract

      public T subtract(T a, T b)
      Specified by:
      subtract in interface Field<T extends NativeOperators<T>>
      Parameters:
      a - Field element.
      b - Field element.
      Returns:
      a - b.
    • negate

      public T negate(T a)
      Specified by:
      negate in interface Field<T extends NativeOperators<T>>
      Parameters:
      a - Field element.
      Returns:
      -a.
    • multiply

      public T multiply(int n, T a)
      Specified by:
      multiply in interface Field<T extends NativeOperators<T>>
      Parameters:
      n - Number of times a must be added to itself.
      a - Field element.
      Returns:
      n a.
    • multiply

      public T multiply(T a, T b)
      Specified by:
      multiply in interface Field<T extends NativeOperators<T>>
      Parameters:
      a - Field element.
      b - Field element.
      Returns:
      a * b.
    • divide

      public T divide(T a, T b)
      Specified by:
      divide in interface Field<T extends NativeOperators<T>>
      Parameters:
      a - Field element.
      b - Field element.
      Returns:
      a * b-1.
    • reciprocal

      public T reciprocal(T a)
      Specified by:
      reciprocal in interface Field<T extends NativeOperators<T>>
      Parameters:
      a - Field element.
      Returns:
      a-1.