Class Complex<C extends RingElem<C>>
java.lang.Object
edu.jas.poly.Complex<C>
- Type Parameters:
C- base type of RingElem (for complex polynomials).
- All Implemented Interfaces:
AbelianGroupElem<Complex<C>>, Element<Complex<C>>, GcdRingElem<Complex<C>>, MonoidElem<Complex<C>>, RingElem<Complex<C>>, StarRingElem<Complex<C>>, Serializable, Comparable<Complex<C>>
public class Complex<C extends RingElem<C>>
extends Object
implements StarRingElem<Complex<C>>, GcdRingElem<Complex<C>>
Generic Complex class implementing the RingElem interface. Objects of this
class are immutable.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final booleanprotected final CImaginary part of the data structure.private static final org.apache.logging.log4j.Loggerprotected final CReal part of the data structure.final ComplexRing<C> Complex class factory data structure. -
Constructor Summary
ConstructorsConstructorDescriptionComplex(ComplexRing<C> ring) The constructor creates a Complex object with real part 0 and imaginary part 0.Complex(ComplexRing<C> ring, long r) The constructor creates a Complex object from a long element as real part, the imaginary part is set to 0.Complex(ComplexRing<C> ring, C r) The constructor creates a Complex object from a C object as real part, the imaginary part is set to 0.Complex(ComplexRing<C> ring, C r, C i) The constructor creates a Complex object from two C objects as real and imaginary part.Complex(ComplexRing<C> ring, String s) The constructor creates a Complex object from a String representation. -
Method Summary
Modifier and TypeMethodDescriptionabs()Complex number absolute value.intSince complex numbers are unordered, we use lexicographical order of re and im.Complex number conjugate.copy()Copy this.Complex number divide.Complex extended greatest common divisor.booleanComparison with any other object.factory()Get the corresponding element factory.Complex number greatest common divisor.getIm()Get the imaginary part.getRe()Get the real part.inthashCode()Hash code for this Complex.inverse()Complex number inverse.booleanisIMAG()Is Complex imaginary one.booleanisONE()Is Complex number one.booleanisUnit()Is Complex unit element.booleanisZERO()Is Complex number zero.Complex number product.negate()Complex number negative.norm()Complex number norm.Complex number quotient and remainder.Complex number remainder.intsignum()Since complex numbers are unordered, we use lexicographical order of re and im.Complex number subtract.Complex number summation.toScript()Get a scripting compatible string representation.Get a scripting compatible string representation of the factory.toString()Get the String representation.Methods inherited from interface MonoidElem
leftDivide, leftRemainder, power, rightDivide, rightRemainder, twosidedDivide, twosidedRemainder
-
Field Details
-
logger
private static final org.apache.logging.log4j.Logger logger -
debug
private static final boolean debug -
ring
Complex class factory data structure. -
re
-
im
-
-
Constructor Details
-
Complex
The constructor creates a Complex object from two C objects as real and imaginary part.- Parameters:
ring- factory for Complex objects.r- real part.i- imaginary part.
-
Complex
The constructor creates a Complex object from a C object as real part, the imaginary part is set to 0.- Parameters:
r- real part.
-
Complex
The constructor creates a Complex object from a long element as real part, the imaginary part is set to 0.- Parameters:
r- real part.
-
Complex
The constructor creates a Complex object with real part 0 and imaginary part 0. -
Complex
The constructor creates a Complex object from a String representation.- Parameters:
s- string of a Complex.- Throws:
NumberFormatException
-
-
Method Details
-
factory
-
getRe
-
getIm
-
copy
-
toString
-
toScript
-
toScriptFactory
-
isZERO
public boolean isZERO()Is Complex number zero.- Specified by:
isZEROin interfaceAbelianGroupElem<C extends RingElem<C>>- Returns:
- If this is 0 then true is returned, else false.
- See Also:
-
isONE
public boolean isONE()Is Complex number one.- Specified by:
isONEin interfaceMonoidElem<C extends RingElem<C>>- Returns:
- If this is 1 then true is returned, else false.
- See Also:
-
isIMAG
public boolean isIMAG()Is Complex imaginary one.- Returns:
- If this is i then true is returned, else false.
-
isUnit
public boolean isUnit()Is Complex unit element.- Specified by:
isUnitin interfaceMonoidElem<C extends RingElem<C>>- Returns:
- If this is a unit then true is returned, else false.
- See Also:
-
equals
-
hashCode
-
compareTo
Since complex numbers are unordered, we use lexicographical order of re and im. -
signum
public int signum()Since complex numbers are unordered, we use lexicographical order of re and im.- Specified by:
signumin interfaceAbelianGroupElem<C extends RingElem<C>>- Returns:
- 0 if this is equal to 0; 1 if re > 0, or re == 0 and im > 0; -1 if re < 0, or re == 0 and im < 0
- See Also:
-
sum
-
subtract
-
negate
-
conjugate
-
norm
-
abs
-
multiply
-
inverse
-
remainder
-
divide
-
quotientRemainder
Complex number quotient and remainder.- Specified by:
quotientRemainderin interfaceMonoidElem<C extends RingElem<C>>- Parameters:
S- Complex.- Returns:
- Complex[] { q, r } with q = this/S and r = rem(this,S).
-
gcd
-
egcd
-