Class DoubleComplex
java.lang.Object
com.xinapse.image.Complex
com.xinapse.image.DoubleComplex
A complex (real, imaginary) number, with double precision.
-
Constructor Summary
ConstructorsConstructorDescriptionCreates a newDoubleComplexnumber, with zero real and imaginary parts.DoubleComplex(double r, double i) Creates a newDoubleComplexnumber, with the real and imaginary parts specified by the arguments.Creates a newDoubleComplexnumber, with the real and imaginary parts copied from an existingComplexnumber. -
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.booleanDetermines whether another object is equal to thisDoubleComplexnumber.expi()Returns the exponential of this complex number multiplied by i.doublegetArg()Returns the polar angle of this complex number.static double[]getArg(double[] complexArray) Returns a double[] of phases of an array of interleaved complex real/imaginary components.static double[]getArg(double[] complexArray, int from, int to) Returns a double[] of phases of an array of interleaved complex real/imaginary components within a specified range of indices.static double[]Returns a double[] of phases of an array of Complex, within a specified range of indices.doublegetImag()Returns the imaginary part of this complex number.static double[]getImag(double[] complexArray) Returns a double[] of imag values of an array of interleaved complex imag/imaginary components.static double[]getImag(double[] complexArray, int from, int to) Returns a double[] of imaginary values from an array of interleaved complex real/imaginary components within a specified range of indices.static double[]Returns a double[] of imaginary components of an array of Complex.static double[]Returns a double[] of imaginary components of an array of Complex, within a specified range of indices.doublegetMod()Returns the modulus of this complex number.static double[]getMod(double[] complexArray) Returns a double[] of magnitudes of an array of interleaved complex real/imaginary components.static double[]getMod(double[] complexArray, int from, int to) Returns a double[] of magnitudes of an array of interleaved complex real/imaginary components within a specified range of indices.static double[]Returns a double[] of magnitudes of an array of Complex.static double[]Returns a double[] of magnitudes of an array of Complex, within a specified range of indices.doublegetModSq()Returns the square of the modulus of this complex number.doublegetReal()Returns the real part of this complex number.static double[]getReal(double[] complexArray) Returns a double[] of real values of an array of interleaved complex real/imaginary components.static double[]getReal(double[] complexArray, int from, int to) Returns a double[] of real values of an array of interleaved complex real/imaginary components within a specified range of indices.static double[]Returns a double[] of real components of an array of Complex.static double[]Returns a double[] of real components of an array of Complex, within a specified range of indices.getSign()Returns this complex number divided by its absolute value.inthashCode()Returns a hash code value for thisDoubleComplexnumber.booleanisZero()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 DoubleComplexpolar(double mod, double arg) Creates a newDoubleComplexgiven the modulus and argument (in radians).static DoubleComplexCreates a new randomDoubleComplexfrom a distribution with zero mean, and the specified standard deviation.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.static double[]toInterleavedDoubleArray(Complex[] complexArray) Returns a double[] of interleaved read/imaginary components of an array of Complex.static double[]toInterleavedDoubleArray(Complex[] complexArray, int from, int to) Returns a double[] of interleaved read/imaginary components of an array of Complex, within a specified range of indices.toString()Returns a string representation of this complex number.
-
Constructor Details
-
DoubleComplex
public DoubleComplex()Creates a newDoubleComplexnumber, with zero real and imaginary parts. -
DoubleComplex
public DoubleComplex(double r, double i) Creates a newDoubleComplexnumber, 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 newDoubleComplexnumber, with the real and imaginary parts copied from an existingComplexnumber.- Parameters:
c- theComplexnumber to copy.
-
-
Method Details
-
polar
Creates a newDoubleComplexgiven the modulus and argument (in radians).- Parameters:
mod- the modulus.arg- the argument in radians.- Returns:
- a new
DoubleComplexfrom the modulus and argument.
-
random
Creates a new randomDoubleComplexfrom a distribution with zero mean, and the specified standard deviation.- Parameters:
sd- the standard deviation.random- the random number generator.- Returns:
- a new random
DoubleComplex.
-
getReal
-
getImag
-
getArg
-
getMod
-
getModSq
-
getSign
-
add
Description copied from class:ComplexAdds the value of this complex number to another complex number, and returns the result. -
subtract
Description copied from class:ComplexSubtracts another complex number from this complex number, and returns the result. -
multiply
Description copied from class:ComplexMultiplies this complex number by another complex number, and returns the result. -
divide
Description copied from class:ComplexDivides this complex by another complex number, and returns the result. -
scale
Description copied from class:ComplexScales this Complex by a real scalar value and returns the result. -
conj
Description copied from class:ComplexReturns the complex conjugate of this complex number. -
expi
Description copied from class:ComplexReturns the exponential of this complex number multiplied by i. -
log
Description copied from class:ComplexReturns the natural log of this complex number. -
isZero
-
toInterleavedDoubleArray
Returns a double[] of interleaved read/imaginary components of an array of Complex.- Parameters:
complexArray- the array of Complex.- Returns:
- a double[] of of interleaved read/imaginary components.
-
toInterleavedDoubleArray
Returns a double[] of interleaved read/imaginary components of an array of Complex, within a specified range of indices.- Parameters:
complexArray- the array of Complex.from- the initial index of the range to be extracted, inclusive.to- the final index of the range to be extracted, exclusive.- Returns:
- a double[] of of interleaved read/imaginary components.
-
getReal
Returns a double[] of real components of an array of Complex.- Parameters:
complexArray- the array of Complex.- Returns:
- a double[] of real components.
-
getReal
Returns a double[] of real components of an array of Complex, within a specified range of indices.- Parameters:
complexArray- the array of Complex.from- the initial index of the range to be extracted, inclusive.to- the final index of the range to be extracted, exclusive.- Returns:
- a double[] of real components.
-
getReal
public static double[] getReal(double[] complexArray) Returns a double[] of real values of an array of interleaved complex real/imaginary components.- Parameters:
complexArray- the array of interleaved complex real/imaginary components.- Returns:
- a double[] of real values.
-
getReal
public static double[] getReal(double[] complexArray, int from, int to) Returns a double[] of real values of an array of interleaved complex real/imaginary components within a specified range of indices.- Parameters:
complexArray- the array of interleaved complex real/imaginary components.from- the initial index of the range to be extracted, inclusive.to- the final index of the range to be extracted, exclusive.- Returns:
- a double[] of real values.
-
getImag
Returns a double[] of imaginary components of an array of Complex.- Parameters:
complexArray- the array of Complex.- Returns:
- a double[] of imaginary components.
-
getImag
Returns a double[] of imaginary components of an array of Complex, within a specified range of indices.- Parameters:
complexArray- the array of Complex.from- the initial index of the range to be extracted, inclusive.to- the final index of the range to be extracted, exclusive.- Returns:
- a double[] of imaginary components.
-
getImag
public static double[] getImag(double[] complexArray) Returns a double[] of imag values of an array of interleaved complex imag/imaginary components.- Parameters:
complexArray- the array of interleaved complex imag/imaginary components.- Returns:
- a double[] of imag values.
-
getImag
public static double[] getImag(double[] complexArray, int from, int to) Returns a double[] of imaginary values from an array of interleaved complex real/imaginary components within a specified range of indices.- Parameters:
complexArray- the array of interleaved complex real/imaginary components.from- the initial index of the range to be extracted, inclusive.to- the final index of the range to be extracted, exclusive.- Returns:
- a double[] of imaginary values.
-
getMod
Returns a double[] of magnitudes of an array of Complex.- Parameters:
complexArray- the array of Complex.- Returns:
- a double[] of magnitudes.
-
getMod
Returns a double[] of magnitudes of an array of Complex, within a specified range of indices.- Parameters:
complexArray- the array of Complex.from- the initial index of the range to be extracted, inclusive.to- the final index of the range to be extracted, exclusive.- Returns:
- a double[] of magnitudes.
-
getMod
Returns a double[] of magnitudes of an array of interleaved complex real/imaginary components.- Parameters:
complexArray- the array of interleaved complex real/imaginary components.- Returns:
- a double[] of magnitudes.
- Throws:
CancelledException- if the operation takes too long to complete.
-
getMod
Returns a double[] of magnitudes of an array of interleaved complex real/imaginary components within a specified range of indices.- Parameters:
complexArray- the array of interleaved complex real/imaginary components.from- the initial index of the range to be extracted, inclusive.to- the final index of the range to be extracted, exclusive.- Returns:
- a double[] of magnitudes.
- Throws:
CancelledException- if the operation takes too long to complete.
-
getArg
Returns a double[] of phases of an array of Complex, within a specified range of indices.- Parameters:
complexArray- the array of Complex.from- the initial index of the range to be extracted, inclusive.to- the final index of the range to be extracted, exclusive.- Returns:
- a double[] of phases.
-
getArg
Returns a double[] of phases of an array of interleaved complex real/imaginary components.- Parameters:
complexArray- the array of interleaved complex real/imaginary components.- Returns:
- a double[] of phases.
- Throws:
CancelledException- if the operation takes too long to complete.
-
getArg
Returns a double[] of phases of an array of interleaved complex real/imaginary components within a specified range of indices.- Parameters:
complexArray- the array of interleaved complex real/imaginary components.from- the initial index of the range to be extracted, inclusive.to- the final index of the range to be extracted, exclusive.- Returns:
- a double[] of phases.
- Throws:
CancelledException- if the operation takes too long to complete.
-
equals
Determines whether another object is equal to thisDoubleComplexnumber.
The result is true if and only if the argument is not null and is aComplexobject that has the same real and imaginary components as thisDoubleComplexobject. -
hashCode
public int hashCode()Returns a hash code value for thisDoubleComplexnumber.- Overrides:
hashCodein classObject- Returns:
- a hash code value for this
DoubleComplexnumber.
-
toString
-