Class FloatComplex
java.lang.Object
com.xinapse.image.Complex
com.xinapse.image.FloatComplex
A complex (real, imaginary) number, with single precision.
-
Constructor Summary
ConstructorsConstructorDescriptionCreates a newFloatComplexnumber, with zero real and imaginary parts.FloatComplex(float r, float i) Creates a newFloatComplexnumber, with the real and imaginary parts specified by the arguments.Creates a newFloatComplexnumber, with the real and imaginary parts copied from an existingComplex. -
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 thisFloatComplexnumber.expi()Returns the exponential of this complex number multiplied by i.doublegetArg()Returns the polar angle of this complex number.static float[]getArg(float[] complexArray) Returns a float[] of phases of an array of interleaved complex real/imaginary components.static float[]getArg(float[] complexArray, int from, int to) Returns a float[] of phases of an array of interleaved complex real/imaginary components within a specified range of indices.static float[]Returns a float[] of phases of an array of Complex, within a specified range of indices.doublegetImag()Returns the imaginary part of this complex number.static float[]getImag(float[] complexArray) Returns a float[] of imaginary components of an array of interleaved complex real/imaginary components.static float[]getImag(float[] complexArray, int from, int to) Returns a float[] of imaginary components of an array of interleaved complex real/imaginary components within a specified range of indices.static float[]Returns a float[] of imaginary components of an array of Complex.static float[]Returns a float[] of imaginary components of an array of Complex, within a specified range of indices.doublegetMod()Returns the modulus of this complex number.static float[]getMod(float[] complexArray) Returns a float[] of magnitudes of an array of interleaved complex real/imaginary components.static float[]getMod(float[] complexArray, int from, int to) Returns a float[] of magnitudes of an array of interleaved complex real/imaginary components within a specified range of indices.static float[]Returns a float[] of magnitudes of an array of Complex.static float[]Returns a float[] 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 float[]getReal(float[] complexArray) Returns a float[] of real components of an array of interleaved complex real/imaginary components.static float[]getReal(float[] complexArray, int from, int to) Returns a float[] of real components of an array of interleaved complex real/imaginary components within a specified range of indices.static float[]Returns a float[] of real components of an array of Complex.static float[]Returns a float[] 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 thisFloatComplexnumber.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 FloatComplexpolar(float mod, float arg) Creates a newFloatComplexgiven the modulus and argument (in radians).static FloatComplexCreates a new randomFloatComplexfrom 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 float[]toInterleavedFloatArray(Complex[] complexArray) Returns a float[] of interleaved real/imaginary components of an array of Complex.static float[]toInterleavedFloatArray(Complex[] complexArray, int from, int to) Returns a float[] of interleaved real/imaginary components of an array of Complex, within a specified range of indices.toString()Returns a string representation of this complex number.
-
Constructor Details
-
FloatComplex
public FloatComplex()Creates a newFloatComplexnumber, with zero real and imaginary parts. -
FloatComplex
public FloatComplex(float r, float i) Creates a newFloatComplexnumber, 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.
-
FloatComplex
Creates a newFloatComplexnumber, with the real and imaginary parts copied from an existingComplex.- Parameters:
c- theComplexto copy.
-
-
Method Details
-
polar
Creates a newFloatComplexgiven the modulus and argument (in radians).- Parameters:
mod- the modulus.arg- the argument in radians.- Returns:
- a new
FloatComplexfrom the modulus and argument.
-
random
Creates a new randomFloatComplexfrom a distribution with zero mean, and the specified standard deviation.- Parameters:
sd- the standard deviation.random- the random number generator.- Returns:
- a new random
FloatComplex.
-
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
-
toInterleavedFloatArray
Returns a float[] of interleaved real/imaginary components of an array of Complex.- Parameters:
complexArray- the array of Complex.- Returns:
- a float[] of interleaved real/imaginary components.
-
toInterleavedFloatArray
Returns a float[] of interleaved real/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 float[] of interleaved rea/imaginary components.
-
getReal
Returns a float[] of real components of an array of Complex.- Parameters:
complexArray- the array of Complex.- Returns:
- a float[] of real components.
-
getReal
Returns a float[] 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 float[] of real components.
-
getReal
public static float[] getReal(float[] complexArray) Returns a float[] of real components of an array of interleaved complex real/imaginary components.- Parameters:
complexArray- the array of interleaved complex real/imaginary components.- Returns:
- a float[] of real components.
-
getReal
public static float[] getReal(float[] complexArray, int from, int to) Returns a float[] of real components 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 float[] of real components.
-
getImag
Returns a float[] of imaginary components of an array of Complex.- Parameters:
complexArray- the array of Complex.- Returns:
- a float[] of imaginary components.
-
getImag
Returns a float[] 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 float[] of imaginary components.
-
getImag
public static float[] getImag(float[] complexArray) Returns a float[] of imaginary components of an array of interleaved complex real/imaginary components.- Parameters:
complexArray- the array of interleaved complex real/imaginary components.- Returns:
- a float[] of imaginary components.
-
getImag
public static float[] getImag(float[] complexArray, int from, int to) Returns a float[] of imaginary components 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 float[] of imaginary components.
-
getMod
Returns a float[] of magnitudes of an array of Complex.- Parameters:
complexArray- the array of Complex.- Returns:
- a float[] of magnitudes.
-
getMod
Returns a float[] 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 float[] of magnitudes.
-
getMod
Returns a float[] of magnitudes of an array of interleaved complex real/imaginary components.- Parameters:
complexArray- the array of interleaved complex real/imaginary components.- Returns:
- a float[] of magnitudes.
- Throws:
CancelledException- if the operation takes too long to complete.
-
getMod
Returns a float[] 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 float[] of magnitudes.
- Throws:
CancelledException- if the operation takes too long to complete.
-
getArg
Returns a float[] 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 float[] of phases.
-
getArg
Returns a float[] of phases of an array of interleaved complex real/imaginary components.- Parameters:
complexArray- the array of interleaved complex real/imaginary components.- Returns:
- a float[] of phases.
- Throws:
CancelledException- if the operation takes too long to complete.
-
getArg
Returns a float[] 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 float[] of phases.
- Throws:
CancelledException- if the operation takes too long to complete.
-
equals
Determines whether another object is equal to thisFloatComplexnumber.
The result is true if and only if the argument is not null and is aFloatComplexobject that has the same real and imaginary components as thisFloatComplexobject. -
hashCode
public int hashCode()Returns a hash code value for thisFloatComplexnumber.- Overrides:
hashCodein classObject- Returns:
- a hash code value for this
FloatComplexnumber.
-
toString
-