Package com.xinapse.image
Class DoubleComplex
java.lang.Object
com.xinapse.image.Complex
com.xinapse.image.DoubleComplex
A complex (real, imaginary) number, with double precision.
-
Constructor Summary
ConstructorDescriptionCreates a newDoubleComplex
number, with zero real and imaginary parts.DoubleComplex
(double r, double i) Creates a newDoubleComplex
number, with the real and imaginary parts specified by the arguments.Creates a newDoubleComplex
number, with the real and imaginary parts copied from an existingComplex
number. -
Method Summary
Modifier and TypeMethodDescriptionAdds the value of this complex number to another complex number, and returns the result.conj()
Returns the complex conjugate of this complex number.Divides this complex by another complex number, and returns the result.boolean
Determines whether another object is equal to thisDoubleComplex
number.expi()
Returns the exponential of this complex number multiplied by i.double
getArg()
Returns the polar angle of this complex number.double
getImag()
Returns the imaginary part of this complex number.double
getMod()
Returns the modulus of this complex number.double
getModSq()
Returns the square of the modulus of this complex number.double
getReal()
Returns the real part of this complex number.int
hashCode()
Returns a hash code value for thisDoubleComplex
number.boolean
isZero()
Tests whether this complex number is zero.log()
Returns the natural log of this complex number.Multiplies this complex number by another complex number, and returns the result.static DoubleComplex
polar
(double mod, double arg) Creates a newDoubleComplex
given the modulus and argument (in radians).scale
(double factor) Scales this Complex by a real scalar value and returns the result.Subtracts another complex number from this complex number, and returns the result.toString()
Returns a string representation of this complex number.
-
Constructor Details
-
DoubleComplex
public DoubleComplex()Creates a newDoubleComplex
number, with zero real and imaginary parts. -
DoubleComplex
public DoubleComplex(double r, double i) Creates a newDoubleComplex
number, with the real and imaginary parts specified by the arguments.- Parameters:
r
- the real part of the complex number.i
- the imaginary part of the complex number.
-
DoubleComplex
Creates a newDoubleComplex
number, with the real and imaginary parts copied from an existingComplex
number.- Parameters:
c
- theComplex
number to copy.
-
-
Method Details
-
polar
Creates a newDoubleComplex
given the modulus and argument (in radians).- Parameters:
mod
- the modulus.arg
- the argument in radians.- Returns:
- a new
DoubleComplex
from the modulus and argument.
-
getReal
public double getReal()Description copied from class:Complex
Returns the real part of this complex number. -
getImag
public double getImag()Description copied from class:Complex
Returns the imaginary part of this complex number. -
getArg
public double getArg()Description copied from class:Complex
Returns the polar angle of this complex number. -
getMod
public double getMod()Description copied from class:Complex
Returns the modulus of this complex number. -
getModSq
public double getModSq()Description copied from class:Complex
Returns the square of the modulus of this complex number. -
add
Description copied from class:Complex
Adds the value of this complex number to another complex number, and returns the result. -
subtract
Description copied from class:Complex
Subtracts another complex number from this complex number, and returns the result. -
multiply
Description copied from class:Complex
Multiplies this complex number by another complex number, and returns the result. -
divide
Description copied from class:Complex
Divides this complex by another complex number, and returns the result. -
scale
Description copied from class:Complex
Scales this Complex by a real scalar value and returns the result. -
conj
Description copied from class:Complex
Returns the complex conjugate of this complex number. -
expi
Description copied from class:Complex
Returns the exponential of this complex number multiplied by i. -
log
Description copied from class:Complex
Returns the natural log of this complex number. -
isZero
public boolean isZero()Description copied from class:Complex
Tests whether this complex number is zero. -
equals
Determines whether another object is equal to thisDoubleComplex
number.
The result is true if and only if the argument is not null and is aComplex
object that has the same real and imaginary components as thisDoubleComplex
object. -
hashCode
public int hashCode()Returns a hash code value for thisDoubleComplex
number.- Overrides:
hashCode
in classObject
- Returns:
- a hash code value for this
DoubleComplex
number.
-
toString
Description copied from class:Complex
Returns a string representation of this complex number.
-