Class FloatComplex

java.lang.Object
com.xinapse.image.Complex
com.xinapse.image.FloatComplex

public final class FloatComplex extends Complex
A complex (real, imaginary) number, with single precision.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates a new FloatComplex number, with zero real and imaginary parts.
    FloatComplex(float r, float i)
    Creates a new FloatComplex number, with the real and imaginary parts specified by the arguments.
    Creates a new FloatComplex number, with the real and imaginary parts copied from an existing Complex.
  • Method Summary

    Modifier and Type
    Method
    Description
    add(Complex cmplx)
    Adds the value of this complex number to another complex number, and returns the result.
    Returns the complex conjugate of this complex number.
    divide(Complex cmplx)
    Divides this complex by another complex number, and returns the result.
    boolean
    Determines whether another object is equal to this FloatComplex number.
    Returns the exponential of this complex number multiplied by i.
    double
    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[]
    getArg(Complex[] complexArray, int from, int to)
    Returns a float[] of phases of an array of Complex, within a specified range of indices.
    double
    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[]
    getImag(Complex[] complexArray)
    Returns a float[] of imaginary components of an array of Complex.
    static float[]
    getImag(Complex[] complexArray, int from, int to)
    Returns a float[] of imaginary components of an array of Complex, within a specified range of indices.
    double
    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[]
    getMod(Complex[] complexArray)
    Returns a float[] of magnitudes of an array of Complex.
    static float[]
    getMod(Complex[] complexArray, int from, int to)
    Returns a float[] of magnitudes of an array of Complex, within a specified range of indices.
    double
    Returns the square of the modulus of this complex number.
    double
    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[]
    getReal(Complex[] complexArray)
    Returns a float[] of real components of an array of Complex.
    static float[]
    getReal(Complex[] complexArray, int from, int to)
    Returns a float[] of real components of an array of Complex, within a specified range of indices.
    Returns this complex number divided by its absolute value.
    int
    Returns a hash code value for this FloatComplex number.
    boolean
    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.
    polar(float mod, float arg)
    Creates a new FloatComplex given the modulus and argument (in radians).
    random(float sd, Random random)
    Creates a new random FloatComplex from 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[]
    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.
    Returns a string representation of this complex number.

    Methods inherited from class Complex

    getValue

    Methods inherited from class Object

    getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • FloatComplex

      public FloatComplex()
      Creates a new FloatComplex number, with zero real and imaginary parts.
    • FloatComplex

      public FloatComplex(float r, float i)
      Creates a new FloatComplex 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.
    • FloatComplex

      public FloatComplex(Complex c)
      Creates a new FloatComplex number, with the real and imaginary parts copied from an existing Complex.
      Parameters:
      c - the Complex to copy.
  • Method Details

    • polar

      public static FloatComplex polar(float mod, float arg)
      Creates a new FloatComplex given the modulus and argument (in radians).
      Parameters:
      mod - the modulus.
      arg - the argument in radians.
      Returns:
      a new FloatComplex from the modulus and argument.
    • random

      public static FloatComplex random(float sd, Random random)
      Creates a new random FloatComplex from 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

      public double getReal()
      Description copied from class: Complex
      Returns the real part of this complex number.
      Specified by:
      getReal in 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.
      Specified by:
      getImag in 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.
      Specified by:
      getArg in 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.
      Specified by:
      getMod in 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.
      Specified by:
      getModSq in class Complex
      Returns:
      the square of the modulus of this complex number.
    • getSign

      public Complex getSign()
      Description copied from class: Complex
      Returns this complex number divided by its absolute value.
      Specified by:
      getSign in class Complex
      Returns:
      this complex number divided by its absolute value.
    • add

      public FloatComplex add(Complex cmplx)
      Description copied from class: Complex
      Adds the value of this complex number to another complex number, and returns the result.
      Specified by:
      add in class Complex
      Parameters:
      cmplx - the complex number to add.
      Returns:
      the result of adding this to another complex number.
    • subtract

      public FloatComplex subtract(Complex cmplx)
      Description copied from class: Complex
      Subtracts another complex number from this complex number, and returns the result.
      Specified by:
      subtract in class Complex
      Parameters:
      cmplx - the complex number to subtract.
      Returns:
      the result of subtracting another complex number from this.
    • multiply

      public FloatComplex multiply(Complex cmplx)
      Description copied from class: Complex
      Multiplies this complex number by another complex number, and returns the result.
      Specified by:
      multiply in class Complex
      Parameters:
      cmplx - the complex by which to multiply.
      Returns:
      the result of multiplying this by another complex number.
    • divide

      public FloatComplex divide(Complex cmplx)
      Description copied from class: Complex
      Divides this complex by another complex number, and returns the result.
      Specified by:
      divide in class Complex
      Parameters:
      cmplx - the complex by which to divide.
      Returns:
      the result of dividing this by another complex number.
    • scale

      public FloatComplex scale(double factor)
      Description copied from class: Complex
      Scales this Complex by a real scalar value and returns the result.
      Specified by:
      scale in class Complex
      Parameters:
      factor - the real scalar value by which to scale.
      Returns:
      the result of scaling this Complex by a real scalar value.
    • conj

      public FloatComplex conj()
      Description copied from class: Complex
      Returns the complex conjugate of this complex number.
      Specified by:
      conj in class Complex
      Returns:
      the complex conjugate of this complex number.
    • expi

      public DoubleComplex expi()
      Description copied from class: Complex
      Returns the exponential of this complex number multiplied by i.
      Specified by:
      expi in class Complex
      Returns:
      the exponential of this complex number multiplied by i.
    • log

      public DoubleComplex log()
      Description copied from class: Complex
      Returns the natural log of this complex number.
      Specified by:
      log in 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.
      Specified by:
      isZero in class Complex
      Returns:
      true if both the real and imaginary components are zero; false otherwise.
    • toInterleavedFloatArray

      public static float[] toInterleavedFloatArray(Complex[] complexArray)
      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

      public 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.
      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

      public static float[] getReal(Complex[] complexArray)
      Returns a float[] of real components of an array of Complex.
      Parameters:
      complexArray - the array of Complex.
      Returns:
      a float[] of real components.
    • getReal

      public static float[] getReal(Complex[] complexArray, int from, int to)
      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

      public static float[] getImag(Complex[] complexArray)
      Returns a float[] of imaginary components of an array of Complex.
      Parameters:
      complexArray - the array of Complex.
      Returns:
      a float[] of imaginary components.
    • getImag

      public static float[] getImag(Complex[] complexArray, int from, int to)
      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

      public static float[] getMod(Complex[] complexArray)
      Returns a float[] of magnitudes of an array of Complex.
      Parameters:
      complexArray - the array of Complex.
      Returns:
      a float[] of magnitudes.
    • getMod

      public static float[] getMod(Complex[] complexArray, int from, int to)
      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

      public static float[] getMod(float[] complexArray) throws CancelledException
      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

      public static float[] getMod(float[] complexArray, int from, int to) throws CancelledException
      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

      public static float[] getArg(Complex[] complexArray, int from, int to)
      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

      public static float[] getArg(float[] complexArray) throws CancelledException
      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

      public static float[] getArg(float[] complexArray, int from, int to) throws CancelledException
      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

      public boolean equals(Object o)
      Determines whether another object is equal to this FloatComplex number.
      The result is true if and only if the argument is not null and is a FloatComplex object that has the same real and imaginary components as this FloatComplex object.
      Overrides:
      equals in class Object
      Parameters:
      o - the object to compare with.
      Returns:
      true if the objects are the same; false otherwise.
    • hashCode

      public int hashCode()
      Returns a hash code value for this FloatComplex number.
      Overrides:
      hashCode in class Object
      Returns:
      a hash code value for this FloatComplex number.
    • toString

      public String toString()
      Description copied from class: Complex
      Returns a string representation of this complex number.
      Specified by:
      toString in class Complex
      Returns:
      string representation of this complex.