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