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 elementa
byb
.Multiply the elementa
by a specified number of timesn
.Multiply the elements.Negate the element.reciprocal
(T a) Return the reciprocal (multiplicative inverse).Subtract the elementb
froma
.
-
Constructor Details
-
AbstractField
public AbstractField()Create an instance.
-
-
Method Details
-
add
Add the elements.- Specified by:
add
in interfaceField<T extends NativeOperators<T>>
- Parameters:
a
- Field element.b
- Field element.- Returns:
a + b
.
-
subtract
Subtract the elementb
froma
.- Specified by:
subtract
in interfaceField<T extends NativeOperators<T>>
- Parameters:
a
- Field element.b
- Field element.- Returns:
a - b
.
-
negate
Negate the element.- Specified by:
negate
in interfaceField<T extends NativeOperators<T>>
- Parameters:
a
- Field element.- Returns:
-a
.
-
multiply
Multiply the elementa
by a specified number of timesn
.- Specified by:
multiply
in interfaceField<T extends NativeOperators<T>>
- Parameters:
n
- Number of timesa
must be added to itself.a
- Field element.- Returns:
n a
.
-
multiply
Multiply the elements.- Specified by:
multiply
in interfaceField<T extends NativeOperators<T>>
- Parameters:
a
- Field element.b
- Field element.- Returns:
a * b
.
-
divide
Divide the elementa
byb
.- Specified by:
divide
in interfaceField<T extends NativeOperators<T>>
- Parameters:
a
- Field element.b
- Field element.- Returns:
a * b-1
.
-
reciprocal
Return the reciprocal (multiplicative inverse).- Specified by:
reciprocal
in interfaceField<T extends NativeOperators<T>>
- Parameters:
a
- Field element.- Returns:
a-1
.
-