Package fftManager

Class Complex

java.lang.Object
fftManager.Complex
All Implemented Interfaces:
Serializable, Cloneable, Comparable<Complex>, ManagedParameters

public class Complex extends Object implements Cloneable, Serializable, Comparable<Complex>, ManagedParameters
Class definition for a Complex number type.
Author:
Paul Redmond / Doug Gillespie
See Also:
  • Field Details

    • serialVersionUID

      public static final long serialVersionUID
      See Also:
    • real

      public double real
    • imag

      public double imag
  • Constructor Details

    • Complex

      public Complex()
    • Complex

      public Complex(double real, double imag)
      Constructor
      Parameters:
      real - real part
      imag - imaginary part
    • Complex

      public Complex(Complex a)
      Constructor
      Parameters:
      a - Complex Number (to clone)
  • Method Details

    • clone

      public Complex clone()
    • ang

      public double ang()
      Gets the angle of a complex number
      Returns:
      angle in radians
    • magsq

      public double magsq()
      Gets the squared magnitude of a complex number
      Returns:
      squared magnitude
    • norm

      @Deprecated public double norm()
      Deprecated.
      Gets the squared magnitude of a complex number
      Returns:
      squared magnitude
    • mag

      public double mag()
      Gets the magnitude of a complex number
      Returns:
      magnitude
    • sqrt

      public Complex sqrt()
      Gets the square root of a Complex number
      Returns:
      square root of the Complex number
    • pow

      public Complex pow(double f)
      Raises a complex number to a scalar power.
      Parameters:
      f - power to raise number to
      Returns:
      new Complex number
    • exp

      public Complex exp()
      A new Complex object whose value is the complex exponential of this
      Returns:
    • plus

      public Complex plus(Complex b)
      Adds a complex number
      Parameters:
      b - Complex number to add
      Returns:
      new Complex number
    • assign

      public void assign(Complex b)
      Assign new real and imaginary values to an existing Complex number
      Parameters:
      b - Complex number to take values from
    • assign

      public void assign(double real, double imag)
      Assign new real and imaginary values to an existing Complex number
      Parameters:
      real - new real part
      imag - new imaginary part
    • plus

      public Complex plus(double b)
      Add a real number to a complex number
      Parameters:
      b - real number
      Returns:
      new Complex number
    • minus

      public Complex minus(Complex b)
      Subtract a real number from a complex number
      Parameters:
      b - real number
      Returns:
      new Complex number
    • minus

      public Complex minus(double b)
      Subtract a real number from a complex number
      Parameters:
      b - real number
      Returns:
      new Complex number
    • times

      public Complex times(double b)
      Multiply a complex number by a real
      Parameters:
      b - real number
      Returns:
      new Complex number
    • times

      public Complex times(Complex b)
      Multiply a complex number by another complex number
      Parameters:
      b - complex number
      Returns:
      new complex number
    • internalTimes

      public void internalTimes(double b)
      Multiply a complex numbers real and imaginary parts by a real number
      Parameters:
      b - real number
    • internalTimes

      public void internalTimes(Complex b)
      Multiply a complex numbers real and imaginary parts by a complex number
      Parameters:
      b - complex number
    • conj

      public Complex conj()
    • conj

      public static void conj(Complex x)
      Converts a number to it's own complex conjugate
      Parameters:
      x -
    • isNaN

      public boolean isNaN()
      Returns true if either the real or imaginary part is a Not-a-Number (NaN) value, false otherwise
      Returns:
      true if either part of the number is NaN
    • isInfinite

      public boolean isInfinite()
      Returns true if either the real or imaginary part is infinite, false otherwise
      Returns:
      true if either part of the number is infinite
    • createComplexArray

      public static Complex[] createComplexArray(double[] doubleArray)
      Create a complex array from a double array
      Parameters:
      doubleArray - doubel array
      Returns:
      complex array
    • allocateComplexArray

      public static Complex[] allocateComplexArray(int n)
      Allocate a new complex array in which each element has been created and it's contents set to 0 +i0;
      Parameters:
      n - length of array
      Returns:
      Complex array of length n
    • allocateComplexArray

      public static Complex[][] allocateComplexArray(int n, int m)
    • zeroComplexArray

      public static void zeroComplexArray(Complex[] array)
      Sets all the elements of a complex array to zero
      Parameters:
      array - Complex Array
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • toString

      public String toString(String format)
      Parameters:
      format - such as %2.2f
      Returns:
    • toString

      public String toString(int decimalPlaces)
    • getConstructorCalls

      public static long getConstructorCalls()
    • compareTo

      public int compareTo(Complex o)
      Specified by:
      compareTo in interface Comparable<Complex>
    • getParameterSet

      public PamParameterSet getParameterSet()
      Description copied from interface: ManagedParameters
      Get a set of data that describes all of the parameters in a class
      Specified by:
      getParameterSet in interface ManagedParameters
      Returns:
      description of the parameters in a class.