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 theField
to which the instance belongs.multiply
(int n) Compute n × this.Compute this × a.negate()
Returns the additive inverse ofthis
element.Returns the multiplicative inverse ofthis
element.Compute this - a.
-
Method Details
-
add
Compute this + a.- Parameters:
a
- element to add- Returns:
- a new element representing this + a
- Throws:
NullArgumentException
- ifa
isnull
.
-
subtract
Compute this - a.- Parameters:
a
- element to subtract- Returns:
- a new element representing this - a
- Throws:
NullArgumentException
- ifa
isnull
.
-
negate
T negate()Returns the additive inverse ofthis
element.- 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 timesthis
must 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
- ifa
isnull
.
-
divide
Compute this ÷ a.- Parameters:
a
- element to divide by- Returns:
- a new element representing this ÷ a
- Throws:
NullArgumentException
- ifa
isnull
.MathArithmeticException
- ifa
is zero
-
reciprocal
Returns the multiplicative inverse ofthis
element.- Returns:
- the inverse of
this
. - Throws:
MathArithmeticException
- ifthis
is zero
-
getField
Get theField
to which the instance belongs.- Returns:
Field
to which the instance belongs
-