Utils
Class Array1D

java.lang.Object
  extended by Utils.Array1D

public class Array1D
extends java.lang.Object

Utility class for 1D arrays

Version:
1.0

Method Summary
static int[] index(double[] a)
          Returns indexes from the input array in rank order.
static int[] rank(double[] a)
          Returns the rank of each element in an array.
static void writeFile(double[] a, java.io.File f)
          Write an array to a file
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

index

public static int[] index(double[] a)
Returns indexes from the input array in rank order. That is the output array will contain an index to the largest element in the original array, then the second largest etc.

Parameters:
a - The input array
Returns:
An array of indexes in rank order

rank

public static int[] rank(double[] a)
Returns the rank of each element in an array. In the case of a tie between elements in the array the element that occurs first will have the lowest rank.

Parameters:
a - The input array
Returns:
The rank of each element

writeFile

public static void writeFile(double[] a,
                             java.io.File f)
                      throws java.io.FileNotFoundException
Write an array to a file

Parameters:
a - The array
f - The file
Throws:
java.io.FileNotFoundException - thrown if this error is encountered while writing the file.