org.das2.math.fft
Class ComplexArray

java.lang.Object
  extended by org.das2.math.fft.ComplexArray

public class ComplexArray
extends java.lang.Object

Interface for passing complex arrays to and from FFT routines. The intent is that the complex array can be backed by data in any format. Each elements is readable and writeable via get and set methods for the real and imaginary components.


Nested Class Summary
static class ComplexArray.ComplexArrayDoubleDouble
          Implements ComplexArray that is backed by two float arrays.
static class ComplexArray.ComplexArrayFloatFloat
          Implements ComplexArray that is backed by two float arrays.
static interface ComplexArray.Double
          ComplexArray that is accessed by doubles
static interface ComplexArray.Float
          A complex array that is accessed by floats
 
Constructor Summary
ComplexArray()
           
 
Method Summary
static double[] magnitude(ComplexArray.Double array)
          returns the magnitudes of each element in an array
static double magnitude(ComplexArray.Double array, int i)
          returns the magnitude of ah element in an array
static double magnitude2(ComplexArray.Double array, int i)
          returns the magnitude of ah element in an array
static ComplexArray.Double newArray(double[] real)
          Creates a new ComplexArray from an array of real numbers.
static ComplexArray.Double newArray(double[] real, double[] imag)
          Creates a new ComplexArray from an array representing real numbers and an array representing the corresponding complex components.
static ComplexArray.Float newArray(float[] real)
          Creates a new ComplexArray from an array of real numbers.
static ComplexArray.Float newArray(float[] real, float[] imag)
          Creates a new ComplexArray from an array representing real numbers and an array representing the corresponding complex components.
static ComplexArray.Double newArrayCopy(double[] real)
          Creates a new ComplexArray from a float array representing real numbers, but copies the original array so that it is not modified.
static double[] realPart(ComplexArray.Double array)
          returns the real parts of each element in an array.
static java.lang.String toString(ComplexArray.Double array)
          converts a ComplexArray into an array for debugging purposes.
static java.lang.String toString(ComplexArray.Float array)
          converts a ComplexArray into an array for debugging purposes.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ComplexArray

public ComplexArray()
Method Detail

newArray

public static ComplexArray.Double newArray(double[] real)
Creates a new ComplexArray from an array of real numbers. The complex components of each element in the resulting array is zero.


newArrayCopy

public static ComplexArray.Double newArrayCopy(double[] real)
Creates a new ComplexArray from a float array representing real numbers, but copies the original array so that it is not modified.


newArray

public static ComplexArray.Double newArray(double[] real,
                                           double[] imag)
Creates a new ComplexArray from an array representing real numbers and an array representing the corresponding complex components.


newArray

public static ComplexArray.Float newArray(float[] real)
Creates a new ComplexArray from an array of real numbers. The complex components of each element in the resulting array is zero.


newArray

public static ComplexArray.Float newArray(float[] real,
                                          float[] imag)
Creates a new ComplexArray from an array representing real numbers and an array representing the corresponding complex components.


toString

public static java.lang.String toString(ComplexArray.Float array)
converts a ComplexArray into an array for debugging purposes.


toString

public static java.lang.String toString(ComplexArray.Double array)
converts a ComplexArray into an array for debugging purposes.


realPart

public static double[] realPart(ComplexArray.Double array)
returns the real parts of each element in an array.


magnitude

public static double[] magnitude(ComplexArray.Double array)
returns the magnitudes of each element in an array


magnitude2

public static final double magnitude2(ComplexArray.Double array,
                                      int i)
returns the magnitude of ah element in an array


magnitude

public static final double magnitude(ComplexArray.Double array,
                                     int i)
returns the magnitude of ah element in an array