Package org.apache.commons.math3
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 TypeMethodDescriptionCompute this + a.Compute this ÷ a.getField()Get theFieldto which the instance belongs.multiply(int n) Compute n × this.Compute this × a.negate()Returns the additive inverse ofthiselement.Returns the multiplicative inverse ofthiselement.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 sumn × 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
-