DPFPArrays
Class DPFPArrays

java.lang.Object
  |
  +--DPFPArrays.DPFPArrays

public class DPFPArrays
extends java.lang.Object

This class contains various methods for manipulating double-precision floating-point arrays.

Since:
JDK1.2

Method Summary
static double max(double[] x)
          Returns the maximum element in an array.
static double mean(double[] x)
          Returns the mean of the elements in an array.
static double[] normalize(double[] x)
          Normalizes an array to (0,1) by dividing by its sum.
static int[] order(double[] x)
          Returns indices of original elements of array with respect to the sorted array.
static double sum(double[] x)
          Returns the sum of the elements in an array.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

normalize

public static double[] normalize(double[] x)
Normalizes an array to (0,1) by dividing by its sum.

Parameters:
x - the array
Returns:
a normalized copy of the array

sum

public static double sum(double[] x)
Returns the sum of the elements in an array.

Parameters:
x - the array
Returns:
the sum of the elements in the array

mean

public static double mean(double[] x)
Returns the mean of the elements in an array.

Parameters:
x - the array
Returns:
the mean of the elements in the array

max

public static double max(double[] x)
Returns the maximum element in an array.

Parameters:
x - the array
Returns:
the maximum element in the array

order

public static int[] order(double[] x)
Returns indices of original elements of array with respect to the sorted array. For example, if

double [] a = {5.5, 4.1, 2.7, 1.1, 3.3, 5.5},

then

DPFPArrays.order(a) = {3, 2, 4, 1, 0, 5}.

Parameters:
x - the array
Returns:
indices of ordered elements w.r.t. original array