jfftw
Class ArrayUtil

java.lang.Object
  extended by jfftw.ArrayUtil

public class ArrayUtil
extends Object

Class containing some useful static method to manipulate double arrays containing complex data used in jfftw.


Constructor Summary
ArrayUtil()
           
 
Method Summary
static void conjugate(double[] data)
          Method to take form the conjugate of an interleaved array by taking the negative of imaginary parts.
static void conjugate(double[][] split)
          Method to take form the conjugate of a split array by taking the negative of imaginary parts.
static Complex getComplex(double[][] split, int i)
          Static method to get the ith Complex element from a split array consisting of real and imaginary parts in a [2][] array
static Complex getComplex(double[] real, double[] imag, int i)
          Static method to get the ith Complex element from a split array consisting of real and imaginary parts.
static Complex getComplex(double[] data, int i)
          Static method to get the ith Complex element from an interleaved array where real part is in 2*i and imaginary in 2*i + 1.
static double[] interleave(double[][] data)
          Static method to take split array normally holding real and imaginary parts and interleave them to a single array.
static double[] interleave(double[] real, double[] imag)
          Static method to take two double arrays normally holding real and imaginary parts and interleave them to a single array.
static void mult(double[][] split, Complex c)
          Method to multiply a split array by a complex.
static void mult(double[][] split, double a)
          Method to multiply a split array by a double.
static void mult(double[][] first, double[][] second)
          Methed to multiply two split arrays puttin the result in the first.
static void mult(double[][] split, double a, double b)
          Method to multiply a split array by a complex specified as two doubles.
static void mult(double[] data, Complex c)
          Method to multiply an interleaved array by a complex.
static void mult(double[] data, double a)
          Method to multiply an interleaved array by a double.
static void mult(double[] first, double[] second)
          Method to multiply two complex interleaved data arrays placing the result in the first.
static void mult(double[] data, double a, double b)
          Method to multiply a interleaved array by a complex specified as two doubles.
static void mult(double[] data, int i, Complex c)
          Multiply specifed element of interleaved array by a complex.
static void mult(double[] data, int i, double a)
          Multiply specifed element of interleaved array by a double
static void mult(double[] data, int i, double a, double b)
          Multiply specifed element of interleaved array by a complex specified as two doubles.
static void multConjugate(double[][] first, double[][] second)
          Methed to multiply first array by complex conjugate of teh second.
static void multConjugate(double[] first, double[] second)
          Method to multiply a interleaves complex arrays with the complex conjugate of an interfeaved array, placing the result in the first.
static void setComplex(double[][] split, int i, Complex z)
          Static to set the ith component of split array array with a Complex.
static void setComplex(double[][] split, int i, double a, double b)
          Static to set the ith component of split array array with a Complex.
static void setComplex(double[] real, double[] imag, int i, Complex z)
          Static to set the ith component of split array array with a Complex.
static void setComplex(double[] real, double[] imag, int i, double a, double b)
          Static to set the ith component of split array array with two doubles
static void setComplex(double[] data, int i, Complex z)
          Static to set the ith component of a interleaved complex array with a Complex.
static void setComplex(double[] data, int i, double a, double b)
          Static to set the ith component of a interleaved complex array with a two doubles
static double[][] split(double[] data)
          Static method to split an interleaved array into two split array, returned as a double[2][] array with [0][i] and [1][i] holding the real / imaginary parts.
static double[][] split(double[] real, double[] imag)
          Static method to form a split array from a real and imaginary array.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ArrayUtil

public ArrayUtil()
Method Detail

interleave

public static double[] interleave(double[] real,
                                  double[] imag)
Static method to take two double arrays normally holding real and imaginary parts and interleave them to a single array. If imaginary array is null or length zero it is taken as zero.

Parameters:
real - the real array
imag - the imaginary array (can be null, or length zero).
Returns:
double[] interleaved array.

interleave

public static double[] interleave(double[][] data)
Static method to take split array normally holding real and imaginary parts and interleave them to a single array.

Parameters:
data - the split array
Returns:
double[] interleaved array.

split

public static double[][] split(double[] data)
Static method to split an interleaved array into two split array, returned as a double[2][] array with [0][i] and [1][i] holding the real / imaginary parts.

Parameters:
data - the interleaved array.
Returns:
double[][] of size [2][data.length/2]

split

public static double[][] split(double[] real,
                               double[] imag)
Static method to form a split array from a real and imaginary array. If imaginary array is null or of length zero, it is assumed to be zero.

Note the data is not copied to new space.

Parameters:
real - the real array
imag - the imaginary array
Returns:
double[][] array in split format.

getComplex

public static Complex getComplex(double[] data,
                                 int i)
Static method to get the ith Complex element from an interleaved array where real part is in 2*i and imaginary in 2*i + 1.

Parameters:
data - the interleaved array
i - the element index

setComplex

public static void setComplex(double[] data,
                              int i,
                              Complex z)
Static to set the ith component of a interleaved complex array with a Complex.

Parameters:
data - the interleaved array
i - the element index
z - the value

setComplex

public static void setComplex(double[] data,
                              int i,
                              double a,
                              double b)
Static to set the ith component of a interleaved complex array with a two doubles

Parameters:
data - the interleaved array
i - the element index
a - the real part
b - the imaginary part.

getComplex

public static Complex getComplex(double[] real,
                                 double[] imag,
                                 int i)
Static method to get the ith Complex element from a split array consisting of real and imaginary parts.

Parameters:
real - the real array.
imag - the imaginary array.
i - the element index.

setComplex

public static void setComplex(double[] real,
                              double[] imag,
                              int i,
                              Complex z)
Static to set the ith component of split array array with a Complex.

Parameters:
real - the real array
imag - the imaginary array
i - the element index
z - the value

setComplex

public static void setComplex(double[] real,
                              double[] imag,
                              int i,
                              double a,
                              double b)
Static to set the ith component of split array array with two doubles

Parameters:
real - the real array
imag - the imaginary array
i - the element index
a - the real part
b - the imainary part

getComplex

public static Complex getComplex(double[][] split,
                                 int i)
Static method to get the ith Complex element from a split array consisting of real and imaginary parts in a [2][] array

Parameters:
split - the [2][] array
i - the element index.

setComplex

public static void setComplex(double[][] split,
                              int i,
                              Complex z)
Static to set the ith component of split array array with a Complex.

Parameters:
split - the split array of real and imaginary parts
i - the element index
z - the value

setComplex

public static void setComplex(double[][] split,
                              int i,
                              double a,
                              double b)
Static to set the ith component of split array array with a Complex.

Parameters:
split - the split array of real and imaginary parts
i - the element index
a - the real part
b - the imaginary part.

mult

public static void mult(double[] data,
                        int i,
                        double a)
Multiply specifed element of interleaved array by a double

Parameters:
data - the interleaved array
i - the index
a - the double.

mult

public static void mult(double[] data,
                        int i,
                        double a,
                        double b)
Multiply specifed element of interleaved array by a complex specified as two doubles.

Parameters:
data - the interleaved array
i - the index
a - real part
b - imaginary part

mult

public static void mult(double[] data,
                        int i,
                        Complex c)
Multiply specifed element of interleaved array by a complex.

Parameters:
data - the interleaved array
i - the index
c - the Complex

mult

public static void mult(double[] data,
                        double a)
Method to multiply an interleaved array by a double.

Parameters:
data - the interleaved array
a - the multiplier.

mult

public static void mult(double[][] split,
                        double a)
Method to multiply a split array by a double.

Parameters:
split - the split array
a - the multiplier.

mult

public static void mult(double[] data,
                        double a,
                        double b)
Method to multiply a interleaved array by a complex specified as two doubles.

Parameters:
data - the interleaved array
a - real part of multiplier
b - imaginary part of multiplier

mult

public static void mult(double[] data,
                        Complex c)
Method to multiply an interleaved array by a complex.

Parameters:
data - the interleaved array
c - the Complex multiplier

mult

public static void mult(double[][] split,
                        double a,
                        double b)
Method to multiply a split array by a complex specified as two doubles.

Parameters:
split - the split array
a - real part of multiplier
b - imaginary part of multiplier
Throws:
ArrayIndexOutOfBoundsException - if real and imaginary arrays of different lengths.

mult

public static void mult(double[][] split,
                        Complex c)
Method to multiply a split array by a complex.

Parameters:
split - the split array
c - the Complex multiplier

mult

public static void mult(double[] first,
                        double[] second)
Method to multiply two complex interleaved data arrays placing the result in the first. Both must be the same size.

Parameters:
first - the first interleaved array
second - the second interleaved array (not changed)
Throws:
ArrayIndexOutOfBoundsException - if the two arrays are not the same length.

multConjugate

public static void multConjugate(double[] first,
                                 double[] second)
Method to multiply a interleaves complex arrays with the complex conjugate of an interfeaved array, placing the result in the first. Both must be the same size.

Parameters:
first - the first interleaved array
second - the second interleaved array (not changed)
Throws:
ArrayIndexOutOfBoundsException - if the two arrays are not the same length.

mult

public static void mult(double[][] first,
                        double[][] second)
Methed to multiply two split arrays puttin the result in the first. Both must be of the same length.

Parameters:
first - the first split array
second - the second split array.
Throws:
ArrayIndexOutOfBoundsException - if the two arrays are not the same length.

multConjugate

public static void multConjugate(double[][] first,
                                 double[][] second)
Methed to multiply first array by complex conjugate of teh second. Both must be of the same length and the second array is not altered.

Parameters:
first - the first split array
second - the second split array.
Throws:
ArrayIndexOutOfBoundsException - if the two arrays are not the same length.

conjugate

public static void conjugate(double[] data)
Method to take form the conjugate of an interleaved array by taking the negative of imaginary parts.

Parameters:
data - the interleaved array.

conjugate

public static void conjugate(double[][] split)
Method to take form the conjugate of a split array by taking the negative of imaginary parts.

Parameters:
split - the split array.