T - the type of the field elementspublic interface FieldElement<T extends FieldElement<T>>
Field| Modifier and Type | Method and Description |
|---|---|
T |
add(T a)
Compute this + a.
|
T |
divide(T a)
Compute this ÷ a.
|
Field<T> |
getField()
Get the
Field to which the instance belongs. |
double |
getReal()
Get the real value of the number.
|
default boolean |
isZero()
Check if an element is semantically equal to zero.
|
T |
multiply(int n)
Compute n × this.
|
T |
multiply(T a)
Compute this × a.
|
T |
negate()
Returns the additive inverse of
this element. |
T |
reciprocal()
Returns the multiplicative inverse of
this element. |
T |
subtract(T a)
Compute this - a.
|
double getReal()
T add(T a) throws NullArgumentException
a - element to addNullArgumentException - if a is null.T subtract(T a) throws NullArgumentException
a - element to subtractNullArgumentException - if a is null.T negate()
this element.this.T multiply(int n)
n - Number of times this must be added to itself.T multiply(T a) throws NullArgumentException
a - element to multiplyNullArgumentException - if a is null.T divide(T a) throws NullArgumentException, MathRuntimeException
a - element to divide byNullArgumentException - if a is null.MathRuntimeException - if a is zeroT reciprocal() throws MathRuntimeException
this element.this.MathRuntimeException - if this is zeroField<T> getField()
Field to which the instance belongs.Field to which the instance belongsdefault boolean isZero()
The default implementation simply calls equals(getField().getZero()).
However, this may need to be overridden in some cases as due to
compatibility with hashCode() some classes implements
equals(Object) in such a way that -0.0 and +0.0 are different,
which may be a problem. It prevents for example identifying a diagonal
element is zero and should be avoided when doing partial pivoting in
LU decomposition.
Copyright © 2016-2022 CS GROUP. All rights reserved.