drasys.or.util
Class ComplexArray

java.lang.Object
  |
  +--drasys.or.util.ComplexArray

public class ComplexArray
extends java.lang.Object

Complex Array utility class. These arrays contain complex elements with each complex element stored in two adjacent array positions. The real component has the even index and the imaginary component has the next higher index.
EG: complex[0] = (array[0],array[1])
The 'beg?' and 'inc?' arguments specify the logical index of the complex element, these are multiplied by two internally to obtain the offset into the array.


Constructor Summary
ComplexArray()
           
 
Method Summary
static void copy(int n, double[] x, int begX, int incX, ComplexI scaler)
          Sets x[i] = 'scaler' for all i
Where: i = begX + k*incX
k = 0,1,..,n-1
static void copy(int n, double[] x, int begX, int incX, double[] y, int begY, int incY)
          Sets x[i] = y[j] for all i,j
Where: i = begX + k*incX
j = begY + k*incY
k = {0,..,n-1}
static void copy(int n, float[] x, int begX, int incX, ComplexI scaler)
          Sets x[i] = 'scaler' for all i
Where: i = begX + k*incX
k = 0,1,..,n-1
static void copy(int n, float[] x, int begX, int incX, float[] y, int begY, int incY)
          Sets x[i] = y[j] for all i,j
Where: i = begX + k*incX
j = begY + k*incY
k = {0,..,n-1}
static int count(int n, double[] x, int begX, int incX, ComplexI low, ComplexI high)
          Returns the number of elements where:
low <= x[i] <= high
i = begX + k*incX
k = 0,1,..,n-1
static int count(int n, float[] x, int begX, int incX, ComplexI low, ComplexI high)
          Returns the number of elements where:
low <= x[i] <= high
i = begX + k*incX
k = 0,1,..,n-1
static boolean equals(int n, double[] x, int begX, int incX, double[] y, int begY, int incY, double epsilon)
          Returns true if abs(x[i]-y[j]) <= epsilon for all i,j
Where: i = begX + k*incX
j = begY + k*incY
k = 0,1,..,n-1
static boolean equals(int n, float[] x, int begX, int incX, float[] y, int begY, int incY, float epsilon)
          Returns true if abs(x[i]-y[j]) <= epsilon for all i,j
Where: i = begX + k*incX
j = begY + k*incY
k = 0,1,..,n-1
static int find(int n, double[] x, int begX, int incX, ComplexI low, ComplexI high)
          Returns the index of the first element where:
low <= x[i] <= high
i = begX + k*incX
k = 0,1,..,n-1
static int find(int n, float[] x, int begX, int incX, ComplexI low, ComplexI high)
          Returns the index of the first element where:
low <= x[i] <= high
i = begX + k*incX
k = 0,1,..,n-1
static double[] resize(int n, double[] array)
          Resize an array.
static double[][] resize(int n, double[][] array)
          Resize an array of arrays.
static double[] resize(int n, double[] array, ComplexI fill)
          Resize and initialize an array.
static float[] resize(int n, float[] array)
          Resize an array.
static float[][] resize(int n, float[][] array)
          Resize an array of arrays.
static float[] resize(int n, float[] array, ComplexI fill)
          Resize and initialize an array.
static Complex sum(int n, double[] x, int begX, int incX, Complex results)
          Returns sum(x[i]) for all i
Where: i = begX + k*incX
k = 0,1,..,n-1
If 'results' is null then a new object will be created.
static Complex sum(int n, float[] x, int begX, int incX, Complex results)
          Returns sum(x[i]) for all i
Where: i = begX + k*incX
k = 0,1,..,n-1
If 'results' is null then a new object will be created.
static Complex sumOfProducts(int n, double[] x, int begX, int incX, double[] y, int begY, int incY, Complex results)
          Returns sum(x[i]*y[j]) for all i,j
Where: i = begX + k*incX
j = begY + k*incY
k = 0,1,..,n-1
If 'results' is null then a new object will be created.
static Complex sumOfProducts(int n, float[] x, int begX, int incX, float[] y, int begY, int incY, Complex results)
          Returns sum(x[i]*y[j]) for all i,j
Where: i = begX + k*incX
j = begY + k*incY
k = 0,1,..,n-1
If 'results' is null then a new object will be created.
static Complex sumOfSquaredDifferences(int n, double[] x, int begX, int incX, ComplexI scaler, Complex results)
          Returns sum((x[i]-scaler)^2) for all i
Where: i = begX + k*incX
k = 0,1,..,n-1
If 'results' is null then a new object will be created.
static Complex sumOfSquaredDifferences(int n, double[] x, int begX, int incX, double[] y, int begY, int incY, Complex results)
          Returns sum((x[i]-y[j])^2) for all i,j
Where: i = begX + k*incX
j = begY + k*incY
k = 0,1,..,n-1
If 'results' is null then a new object will be created.
static Complex sumOfSquaredDifferences(int n, float[] x, int begX, int incX, ComplexI scaler, Complex results)
          Returns sum((x[i]-scaler)^2) for all i
Where: i = begX + k*incX
k = 0,1,..,n-1
If 'results' is null then a new object will be created.
static Complex sumOfSquaredDifferences(int n, float[] x, int begX, int incX, float[] y, int begY, int incY, Complex results)
          Returns sum((x[i]-y[j])^2) for all i,j
Where: i = begX + k*incX
j = begY + k*incY
k = 0,1,..,n-1
If 'results' is null then a new object will be created.
static Complex sumOfSquares(int n, double[] x, int begX, int incX, Complex results)
          Returns sum(x[i]^2) for all i
Where: i = begX + k*incX
k = 0,1,..,n-1
If 'results' is null then a new object will be created.
static Complex sumOfSquares(int n, float[] x, int begX, int incX, Complex results)
          Returns sum(x[i]^2) for all i
Where: i = begX + k*incX
k = 0,1,..,n-1
If 'results' is null then a new object will be created.
static java.lang.String toString(int n, double[] x, int begX, int incX)
          Returns a string representation of the array elements x[i].
static java.lang.String toString(int n, float[] x, int begX, int incX)
          Returns a string representation of the array elements x[i].
 
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

resize

public static double[] resize(int n,
                              double[] array)
Resize an array. If the array is larger or smaller than 'n' then a new array is created and initialized with the contents of 'array'. If the length of 'array' is 'n' then 'array' is returned.

resize

public static double[] resize(int n,
                              double[] array,
                              ComplexI fill)
Resize and initialize an array. If the array is larger than 'n' then a new array is created and initialized with the contents of 'array'. If the array is smaller than 'n' then a new array is created, initialized with the contents of 'array', and any new elements are initialized with fill. If the length of 'array' is 'n' then 'array' is returned.

resize

public static double[][] resize(int n,
                                double[][] array)
Resize an array of arrays. If the array is larger or smaller than 'n' then a new array is created and initialized with the contents of 'array'. If the length of 'array' is 'n' then 'array' is returned.

toString

public static java.lang.String toString(int n,
                                        double[] x,
                                        int begX,
                                        int incX)
Returns a string representation of the array elements x[i]. Where: i = begX + k*incX
k = 0,1,..,n-1
Repeated elements are not printed.

equals

public static boolean equals(int n,
                             double[] x,
                             int begX,
                             int incX,
                             double[] y,
                             int begY,
                             int incY,
                             double epsilon)
Returns true if abs(x[i]-y[j]) <= epsilon for all i,j
Where: i = begX + k*incX
j = begY + k*incY
k = 0,1,..,n-1

count

public static int count(int n,
                        double[] x,
                        int begX,
                        int incX,
                        ComplexI low,
                        ComplexI high)
Returns the number of elements where:
low <= x[i] <= high
i = begX + k*incX
k = 0,1,..,n-1

find

public static int find(int n,
                       double[] x,
                       int begX,
                       int incX,
                       ComplexI low,
                       ComplexI high)
Returns the index of the first element where:
low <= x[i] <= high
i = begX + k*incX
k = 0,1,..,n-1
Returns:
-1 if no match is found.

copy

public static void copy(int n,
                        double[] x,
                        int begX,
                        int incX,
                        double[] y,
                        int begY,
                        int incY)
Sets x[i] = y[j] for all i,j
Where: i = begX + k*incX
j = begY + k*incY
k = {0,..,n-1}

copy

public static void copy(int n,
                        double[] x,
                        int begX,
                        int incX,
                        ComplexI scaler)
Sets x[i] = 'scaler' for all i
Where: i = begX + k*incX
k = 0,1,..,n-1

sum

public static Complex sum(int n,
                          double[] x,
                          int begX,
                          int incX,
                          Complex results)
Returns sum(x[i]) for all i
Where: i = begX + k*incX
k = 0,1,..,n-1
If 'results' is null then a new object will be created.

sumOfSquares

public static Complex sumOfSquares(int n,
                                   double[] x,
                                   int begX,
                                   int incX,
                                   Complex results)
Returns sum(x[i]^2) for all i
Where: i = begX + k*incX
k = 0,1,..,n-1
If 'results' is null then a new object will be created.

sumOfSquaredDifferences

public static Complex sumOfSquaredDifferences(int n,
                                              double[] x,
                                              int begX,
                                              int incX,
                                              ComplexI scaler,
                                              Complex results)
Returns sum((x[i]-scaler)^2) for all i
Where: i = begX + k*incX
k = 0,1,..,n-1
If 'results' is null then a new object will be created.

sumOfSquaredDifferences

public static Complex sumOfSquaredDifferences(int n,
                                              double[] x,
                                              int begX,
                                              int incX,
                                              double[] y,
                                              int begY,
                                              int incY,
                                              Complex results)
Returns sum((x[i]-y[j])^2) for all i,j
Where: i = begX + k*incX
j = begY + k*incY
k = 0,1,..,n-1
If 'results' is null then a new object will be created.

sumOfProducts

public static Complex sumOfProducts(int n,
                                    double[] x,
                                    int begX,
                                    int incX,
                                    double[] y,
                                    int begY,
                                    int incY,
                                    Complex results)
Returns sum(x[i]*y[j]) for all i,j
Where: i = begX + k*incX
j = begY + k*incY
k = 0,1,..,n-1
If 'results' is null then a new object will be created.

resize

public static float[] resize(int n,
                             float[] array)
Resize an array. If the array is larger or smaller than 'n' then a new array is created and initialized with the contents of 'array'. If the length of 'array' is 'n' then 'array' is returned.

resize

public static float[] resize(int n,
                             float[] array,
                             ComplexI fill)
Resize and initialize an array. If the array is larger than 'n' then a new array is created and initialized with the contents of 'array'. If the array is smaller than 'n' then a new array is created, initialized with the contents of 'array', and any new elements are initialized with fill. If the length of 'array' is 'n' then 'array' is returned.

resize

public static float[][] resize(int n,
                               float[][] array)
Resize an array of arrays. If the array is larger or smaller than 'n' then a new array is created and initialized with the contents of 'array'. If the length of 'array' is 'n' then 'array' is returned.

toString

public static java.lang.String toString(int n,
                                        float[] x,
                                        int begX,
                                        int incX)
Returns a string representation of the array elements x[i]. Where: i = begX + k*incX
k = 0,1,..,n-1
Repeated elements are not printed.

equals

public static boolean equals(int n,
                             float[] x,
                             int begX,
                             int incX,
                             float[] y,
                             int begY,
                             int incY,
                             float epsilon)
Returns true if abs(x[i]-y[j]) <= epsilon for all i,j
Where: i = begX + k*incX
j = begY + k*incY
k = 0,1,..,n-1

count

public static int count(int n,
                        float[] x,
                        int begX,
                        int incX,
                        ComplexI low,
                        ComplexI high)
Returns the number of elements where:
low <= x[i] <= high
i = begX + k*incX
k = 0,1,..,n-1

find

public static int find(int n,
                       float[] x,
                       int begX,
                       int incX,
                       ComplexI low,
                       ComplexI high)
Returns the index of the first element where:
low <= x[i] <= high
i = begX + k*incX
k = 0,1,..,n-1
Returns:
-1 if no match is found.

copy

public static void copy(int n,
                        float[] x,
                        int begX,
                        int incX,
                        float[] y,
                        int begY,
                        int incY)
Sets x[i] = y[j] for all i,j
Where: i = begX + k*incX
j = begY + k*incY
k = {0,..,n-1}

copy

public static void copy(int n,
                        float[] x,
                        int begX,
                        int incX,
                        ComplexI scaler)
Sets x[i] = 'scaler' for all i
Where: i = begX + k*incX
k = 0,1,..,n-1

sum

public static Complex sum(int n,
                          float[] x,
                          int begX,
                          int incX,
                          Complex results)
Returns sum(x[i]) for all i
Where: i = begX + k*incX
k = 0,1,..,n-1
If 'results' is null then a new object will be created.

sumOfSquares

public static Complex sumOfSquares(int n,
                                   float[] x,
                                   int begX,
                                   int incX,
                                   Complex results)
Returns sum(x[i]^2) for all i
Where: i = begX + k*incX
k = 0,1,..,n-1
If 'results' is null then a new object will be created.

sumOfSquaredDifferences

public static Complex sumOfSquaredDifferences(int n,
                                              float[] x,
                                              int begX,
                                              int incX,
                                              ComplexI scaler,
                                              Complex results)
Returns sum((x[i]-scaler)^2) for all i
Where: i = begX + k*incX
k = 0,1,..,n-1
If 'results' is null then a new object will be created.

sumOfSquaredDifferences

public static Complex sumOfSquaredDifferences(int n,
                                              float[] x,
                                              int begX,
                                              int incX,
                                              float[] y,
                                              int begY,
                                              int incY,
                                              Complex results)
Returns sum((x[i]-y[j])^2) for all i,j
Where: i = begX + k*incX
j = begY + k*incY
k = 0,1,..,n-1
If 'results' is null then a new object will be created.

sumOfProducts

public static Complex sumOfProducts(int n,
                                    float[] x,
                                    int begX,
                                    int incX,
                                    float[] y,
                                    int begY,
                                    int incY,
                                    Complex results)
Returns sum(x[i]*y[j]) for all i,j
Where: i = begX + k*incX
j = begY + k*incY
k = 0,1,..,n-1
If 'results' is null then a new object will be created.


Copyright(C)1997-2000 by DRA Systems all rights reserved. OpsResearch.com