utils
Class ArrayUtilities

java.lang.Object
  extended by utils.ArrayUtilities

public class ArrayUtilities
extends java.lang.Object

additional utility functions for operating with arrays


Constructor Summary
ArrayUtilities()
           
 
Method Summary
static java.lang.String debug2DArray(double[][] array)
          get a debug string displaying two dimensional arrays
static java.lang.String debug2DArray(float[][] array)
          get a debug string displaying two dimensional arrays
static java.lang.String debug2DArray(int[][] array)
          get a debug string displaying two dimensional arrays
static float[][] double2float(double[][] array)
          convert double[][] to float[][]
static void fillWith(double[][] destination, double value)
          fill all indices in destination with the specified value
static double getAverage(double[][] haystack)
          get the average of all elements in a two dimensional array.
static double getMaximum(double[][] haystack)
          get the maximum entry of a twodimensional array.
static double getMean(double[] haystack)
          get the mean value for the specified one-dimensional array
static double getStd(double[] haystack)
          get the standard deviation of the specified array.
static void multiArrayCopy(double[][] source, double[][] destination)
          copy a two-dimensional array into another array.
static void multiArrayCopy(float[][] source, float[][] destination)
          copy a two-dimensional array into another array.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ArrayUtilities

public ArrayUtilities()
Method Detail

double2float

public static float[][] double2float(double[][] array)
convert double[][] to float[][]

Parameters:
array -
Returns:
the input array, with all values converted to floats

debug2DArray

public static java.lang.String debug2DArray(double[][] array)
get a debug string displaying two dimensional arrays

Parameters:
array - the array to be displayed
Returns:
debug string

debug2DArray

public static java.lang.String debug2DArray(float[][] array)
get a debug string displaying two dimensional arrays

Parameters:
array - the array to be displayed
Returns:
debug string

debug2DArray

public static java.lang.String debug2DArray(int[][] array)
get a debug string displaying two dimensional arrays

Parameters:
array - - the array to be displayed
Returns:
debug string

fillWith

public static void fillWith(double[][] destination,
                            double value)
fill all indices in destination with the specified value

Parameters:
destination - - the array to be filled
value - - the value that should fill all indices in destination

multiArrayCopy

public static void multiArrayCopy(double[][] source,
                                  double[][] destination)
copy a two-dimensional array into another array.

Parameters:
source - - the array to be copied
destination - - the array where to copy

multiArrayCopy

public static void multiArrayCopy(float[][] source,
                                  float[][] destination)
copy a two-dimensional array into another array.

Parameters:
source - - the array to be copied
destination - - the array where to copy

getMaximum

public static double getMaximum(double[][] haystack)
get the maximum entry of a twodimensional array.

Parameters:
haystack - the array to be searched
Returns:
maximum entry in the specified array

getAverage

public static double getAverage(double[][] haystack)
get the average of all elements in a two dimensional array.

Parameters:
haystack - the array to get the average for
Returns:
average of all elements in haystack

getStd

public static double getStd(double[] haystack)
get the standard deviation of the specified array.

Parameters:
haystack - the array to get the sd for
Returns:
standard deviation for the specified array.

getMean

public static double getMean(double[] haystack)
get the mean value for the specified one-dimensional array

Parameters:
haystack - the array to get the mean for
Returns:
mean for haystack