Package org.apache.commons.math4
Interface FieldElement<T>
- Type Parameters:
T- the type of the field elements
- All Known Subinterfaces:
RealFieldElement<T>
- All Known Implementing Classes:
BigFraction,BigReal,Decimal64,DerivativeStructure,Fraction,SparseGradient
public interface FieldElement<T>
Interface representing field elements.
- Since:
- 2.0
- See Also:
Field
-
Method Summary
Modifier and Type Method Description Tadd(T a)Compute this + a.Tdivide(T a)Compute this ÷ a.Field<T>getField()Get theFieldto which the instance belongs.Tmultiply(int n)Compute n × this.Tmultiply(T a)Compute this × a.Tnegate()Returns the additive inverse ofthiselement.Treciprocal()Returns the multiplicative inverse ofthiselement.Tsubtract(T a)Compute this - a.
-
Method Details
-
add
Compute this + a.- Parameters:
a- element to add- Returns:
- a new element representing this + a
- Throws:
NullArgumentException- ifaisnull.
-
subtract
Compute this - a.- Parameters:
a- element to subtract- Returns:
- a new element representing this - a
- Throws:
NullArgumentException- ifaisnull.
-
negate
T negate()Returns the additive inverse ofthiselement.- Returns:
- the opposite of
this.
-
multiply
Compute n × this. Multiplication by an integer number is defined as the following sum n × this = ∑i=1n this.- Parameters:
n- Number of timesthismust be added to itself.- Returns:
- A new element representing n × this.
-
multiply
Compute this × a.- Parameters:
a- element to multiply- Returns:
- a new element representing this × a
- Throws:
NullArgumentException- ifaisnull.
-
divide
Compute this ÷ a.- Parameters:
a- element to divide by- Returns:
- a new element representing this ÷ a
- Throws:
NullArgumentException- ifaisnull.MathArithmeticException- ifais zero
-
reciprocal
Returns the multiplicative inverse ofthiselement.- Returns:
- the inverse of
this. - Throws:
MathArithmeticException- ifthisis zero
-
getField
Get theFieldto which the instance belongs.- Returns:
Fieldto which the instance belongs
-