Class ComplexFieldWithTotalOrder
java.lang.Object
com.singularsys.extensions.field.AbstractComparativeField
com.singularsys.extensions.field.implementations.ComplexFieldWithTotalOrder
- All Implemented Interfaces:
FieldI,IntegerConvertor,Serializable
public class ComplexFieldWithTotalOrder
extends AbstractComparativeField
implements IntegerConvertor
A Field which operates on Complex objects which imposes
a total order on the complex numbers,
by first comparing the real part and then the imaginary part.
So
Complex(2,1) > Complex(2,0) > Complex(2,-1) > Complex(1,1) > Complex(1,0) > Complex(1,-1),
All versions of zero, Complex(0,0), Complex(-0,0), Complex(0,-0), Complex(0,0),
are considered equal. Handling of infinities and NaNs
are as in Double.compareTo(Double)
so Complex(Double.NaN, Double.NaN) is considered greater than all other complex numbers.
This class is intended to be used with the
PolynomialCreator
to allow it to work with polynomials with complex coefficients.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAdd two members of the field.Not implemented for this field.Compare two elements, return -1,0,1 if the comparison can be carried out, null otherwise.Attempt to convert argument from an integerAttempt to convert argument to an integerDivides two members of the field.getOne()Get the multiplicative identity for this field.getZero()Get the additive identity for this fieldNot implemented for this field.Multiplies two members of the field.The negation -x of an element.Not implemented for this field.Not implemented for this field.The power operator.Subtract two members of the field.
-
Constructor Details
-
ComplexFieldWithTotalOrder
public ComplexFieldWithTotalOrder()
-
-
Method Details
-
add
Description copied from interface:FieldIAdd two members of the field. -
neg
Description copied from interface:FieldIThe negation -x of an element. -
sub
Description copied from interface:FieldISubtract two members of the field. -
div
Description copied from interface:FieldIDivides two members of the field. -
mod
Not implemented for this field. -
mul
Description copied from interface:FieldIMultiplies two members of the field. -
pow
Description copied from interface:FieldIThe power operator. -
and
Not implemented for this field. -
or
Not implemented for this field. -
not
Not implemented for this field. -
getOne
Description copied from interface:FieldIGet the multiplicative identity for this field. -
getZero
Description copied from interface:FieldIGet the additive identity for this field -
cmp
Description copied from class:AbstractComparativeFieldCompare two elements, return -1,0,1 if the comparison can be carried out, null otherwise.- Specified by:
cmpin classAbstractComparativeField- Parameters:
a-b-- Returns:
- -1, 0, 1 if l < r, l==r or l > r respectively, or null if comparison cannot be carried out or
- Throws:
EvaluationException
-
convertToInt
Description copied from interface:IntegerConvertorAttempt to convert argument to an integer- Specified by:
convertToIntin interfaceIntegerConvertor- Parameters:
l- value to convert- Returns:
- corresponding integer or null if it cannot be converted
- Throws:
EvaluationException- on error
-
convertFromInt
Description copied from interface:IntegerConvertorAttempt to convert argument from an integer- Specified by:
convertFromIntin interfaceIntegerConvertor- Parameters:
l- value to convert- Returns:
- corresponding value in this field or null if it cannot be converted
- Throws:
EvaluationException- probably never
-