Package org.hipparchus
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
,FieldDerivativeStructure
,FieldTuple
,Fraction
,SparseGradient
,Tuple
public interface FieldElement<T>
Interface representing field elements.- See Also:
Field
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description T
add(T a)
Compute this + a.T
divide(T a)
Compute this ÷ a.Field<T>
getField()
Get theField
to which the instance belongs.T
multiply(int n)
Compute n × this.T
multiply(T a)
Compute this × a.T
negate()
Returns the additive inverse ofthis
element.T
reciprocal()
Returns the multiplicative inverse ofthis
element.T
subtract(T a)
Compute this - a.
-
-
-
Method Detail
-
add
T add(T a) throws NullArgumentException
Compute this + a.- Parameters:
a
- element to add- Returns:
- a new element representing this + a
- Throws:
NullArgumentException
- ifa
isnull
.
-
subtract
T subtract(T a) throws NullArgumentException
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
T multiply(int n)
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
T multiply(T a) throws NullArgumentException
Compute this × a.- Parameters:
a
- element to multiply- Returns:
- a new element representing this × a
- Throws:
NullArgumentException
- ifa
isnull
.
-
divide
T divide(T a) throws NullArgumentException, MathRuntimeException
Compute this ÷ a.- Parameters:
a
- element to divide by- Returns:
- a new element representing this ÷ a
- Throws:
NullArgumentException
- ifa
isnull
.MathRuntimeException
- ifa
is zero
-
reciprocal
T reciprocal() throws MathRuntimeException
Returns the multiplicative inverse ofthis
element.- Returns:
- the inverse of
this
. - Throws:
MathRuntimeException
- ifthis
is zero
-
-