Class DoubleComplex

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

public final class DoubleComplex extends Complex
A complex (real, imaginary) number, with double precision.
  • Constructor Details

    • DoubleComplex

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

      public DoubleComplex(double r, double i)
      Creates a new DoubleComplex 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

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

    • polar

      public static DoubleComplex polar(double mod, double arg)
      Creates a new DoubleComplex 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.
      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 DoubleComplex 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 DoubleComplex 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 DoubleComplex 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 DoubleComplex 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 DoubleComplex 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 DoubleComplex 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 DoubleComplex number.
      The result is true if and only if the argument is not null and is a Complex object that has the same real and imaginary components as this DoubleComplex 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 DoubleComplex number.
      Overrides:
      hashCode in class Object
      Returns:
      a hash code value for this DoubleComplex 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.