Package org.apache.commons.numbers.field
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,DDField,FP64Field,FractionField
public abstract class AbstractField<T extends NativeOperators<T>>
extends Object
implements Field<T>
Boiler-plate code for concrete implementations of
Field.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAdd the elements.Divide the elementabyb.Multiply the elementaby a specified number of timesn.Multiply the elements.Negate the element.reciprocal(T a) Return the reciprocal (multiplicative inverse).Subtract the elementbfroma.
-
Constructor Details
-
AbstractField
public AbstractField()Create an instance.
-
-
Method Details
-
add
Add the elements.- Specified by:
addin interfaceField<T extends NativeOperators<T>>- Parameters:
a- Field element.b- Field element.- Returns:
a + b.
-
subtract
Subtract the elementbfroma.- Specified by:
subtractin interfaceField<T extends NativeOperators<T>>- Parameters:
a- Field element.b- Field element.- Returns:
a - b.
-
negate
Negate the element.- Specified by:
negatein interfaceField<T extends NativeOperators<T>>- Parameters:
a- Field element.- Returns:
-a.
-
multiply
Multiply the elementaby a specified number of timesn.- Specified by:
multiplyin interfaceField<T extends NativeOperators<T>>- Parameters:
n- Number of timesamust be added to itself.a- Field element.- Returns:
n a.
-
multiply
Multiply the elements.- Specified by:
multiplyin interfaceField<T extends NativeOperators<T>>- Parameters:
a- Field element.b- Field element.- Returns:
a * b.
-
divide
Divide the elementabyb.- Specified by:
dividein interfaceField<T extends NativeOperators<T>>- Parameters:
a- Field element.b- Field element.- Returns:
a * b-1.
-
reciprocal
Return the reciprocal (multiplicative inverse).- Specified by:
reciprocalin interfaceField<T extends NativeOperators<T>>- Parameters:
a- Field element.- Returns:
a-1.
-