utils
Class Utils

java.lang.Object
  extended by utils.Utils

public class Utils
extends java.lang.Object


Field Summary
static boolean DEBUG
           
 
Constructor Summary
Utils()
           
 
Method Summary
static double[] _column(double[][] source, int column)
          Returns the specified column from the given table.
static double[] aabs(double[] src)
          Returns an array of absolute values
static double[] adiff(double[] src)
          Given an array a, returns an array containing the differences between successive array elements (b[0] = a[1]-a[0], b[i] = a[i+1]-a[i]).
static double[] alog10(double[] src)
          Computes the log10 of the given array
static double amax(double[] src)
          Returns the largest element in the array
static double amax(double[][] src, int column)
          Returns the largest element in table for the specified column
static int amaxi(double[] src)
          Returns the index of the largest item within the array.
static int amaxi(double[][] src, int col)
          Returns the index of the largest item within the table for column col.
static double amin(double[] src)
          Returns the smallest item of the array
static double amin(double[][] src, int column)
          Returns the smallest item of the table for the specified column
static int amini(double[] src)
          Returns the index of the smallest item within the array.
static int amini(double[][] src, int col)
          Returns the index of the smallest item within the table for column col.
static double[][] append_right(double[][] arr1, double[] arr2)
           
static double[][] append(double[][] arr1, double[] arr2)
           
static double[][] append(double[][] arr1, double[][] arr2)
           
static double[] append(double[] arr1, double[] arr2)
           
static java.lang.String[] append(java.lang.String[] arr, java.lang.String el)
           
static double[] apply(double[] data, java.lang.String operation)
           
static double[][] applySort(double[][] arr, java.lang.Integer[] indices)
           
static double[] applySort(double[] arr, java.lang.Integer[] indices)
           
static int[][] applySort(int[][] arr, java.lang.Integer[] indices)
           
static java.lang.Object[] applySort(java.lang.Object[] arr, java.lang.Integer[] indices)
           
static java.lang.String[] applySort(java.lang.String[] arr, java.lang.Integer[] indices)
           
static double[] array(double v, int length)
          Creates a new array of the specified length and fills it with the specified double value.
static double[][] bin_nn(double[] data, java.lang.Double min, java.lang.Double max, int bins, double[][] binv2, double[] info)
           
static double[][] bin(double[] data, java.lang.Double min, java.lang.Double max, int bins, double[][] binv2, double[] info)
          Bins an array between the min and max values, for the given number of bins.
static int[] booleanToIntArray(boolean[] source)
          Converts a boolean array to an int array.
static int[][] booleanToIntArray(boolean[][] source)
          Converts a boolean table to an int table (true -> 1, false -> 0)
static double[][] bootstrapCreateGaussianDeviates(double[][] data, double dev)
           
static double[][] bootstrapDataSet(double[][] data)
           
static double[][] bootstrapDataSetAroundMean(double[][] data)
           
static double[][] bootstrapDataSetByScrambling(double[][] data)
           
static boolean checkOptions(java.lang.Object[] list, java.lang.Object... tagsAndClasses)
           
static void column(boolean[][] dest, boolean[] subst, int column)
          Substitutes the specified column in the dest table with the subst array.
static void column(boolean[][] dest, boolean subst, int column)
          Fills the specified column in the dest table with the subst value.
static boolean[] column(boolean[][] source, int column)
          Returns the given column of the table.
static void column(double[][] dest, double[] subst, int column)
          Substitutes the specified column in the dest table with the subst array.
static void column(double[][] dest, double subst, int column)
          Fills the specified column in the dest table with the value subst.
static double[] column(double[][] source, int column)
          Returns the specified column from the given table.
static java.lang.String concat(java.util.List<java.lang.String> what, java.lang.String sep)
           
static boolean[] copy(boolean[] vo)
          Returns a copy of the specified array.
static boolean[][] copy(boolean[][] source)
          Returns a copy of the boolean table source.
static void copy(boolean[][] source, boolean[][] dest)
          Copies the table source into the table dest.
static javax.swing.table.DefaultTableModel copy(javax.swing.table.DefaultTableModel source)
           
static double[] copy(double[] source)
          Returns a copy of the double array source.
static double[][] copy(double[][] source)
          Returns a copy of the table source.
static void copy(double[][] source, double[][] dest)
          Copies a source array into the destination array.
static void copy(double[][] source, double[] dest, int column)
          Copies the specified column of the table source into the dest array.
static void copy(double[] source, double[] dest)
          Copies a source array into the destination array.
static int[] copy(int[] source)
          Returns a copy of the specified array.
static int[][] copy(int[][] source)
          Returns a copy of the source table.
static void copy(int[][] source, int[][] dest)
          Copies the table source into the table dest.
static void copy(int[] source, int[] dest)
          Copies a source array into the destination array.
static java.lang.String[] copy(java.lang.String[] source)
          Returns a copy of the String array source.
static void copy(java.lang.String[] source, java.lang.String[] dest)
          Copies a source array into the destination array.
static GenericList copyGLAsDoubleArray(GenericList list)
           
static GenericList copyGLAsString(GenericList list)
           
static double[][] cumsum(double[][] data, int col)
           
static double[] deleteIndex(double[] arr, int index)
           
static
<T> T[]
deleteIndex(T[] arr, int index)
           
static void dprint(double str)
           
static void dprint(int str)
           
static void dprint(java.lang.String str)
           
static void dprintln()
           
static void dprintln(double str)
           
static void dprintln(int str)
           
static void dprintln(java.lang.String str)
           
static void eadd(double[] result, double[] a, double[] b)
           
static void ediv(double[] result, double[] a, double b)
           
static void ediv(double[] result, double[] a, double[] b)
          Divides the two arrays.
static void emul(double[][] result, double[][] a, int column, double b)
           
static void emul(double[] result, double[] a, double b)
           
static void emul(double[] result, double[] a, double[] b)
          Multiplies the two arrays.
static boolean equals(double d1, double d2, double tolerance)
           
static double[] esub(double[] a, double b)
           
static double[] esub(double[] a, double[] b)
           
static void esub(double[] result, double[] a, double b)
           
static void esub(double[] result, double[] a, double[] b)
           
static void fill(boolean[][] m, boolean v)
          Fills a table with the value v.
static void fill(boolean[][] m, boolean v, int column)
          Fills the specified column of the table with the value v.
static void fill(boolean[] m, boolean v)
          Fills an array with the value v (equivalent to Array.fill).
static void fill(double[][] m, double v)
          Fills a table with the value v.
static void fill(double[][] m, double[] v, int column)
          Fills the specified column of the table with the given array.
static void fill(double[][] m, double v, int column)
          Fills the specified column of the table with the value v.
static void fill(double[] m, double v)
          Fills an array with the value v (equivalent to Array.fill).
static void fill(int[][] m, int v)
          Fills the table with the value v.
static void fill(int[][] m, int v, int column)
          Fills the table with the value v.
static void fill(int[] m, int v)
          Fills an array with the value v (equivalent to Array.fill).
static void fill(java.lang.Object[] m, java.lang.Object v)
          Fills an array with the value v (equivalent to Array.fill).
static double[] findContainingEllipse(double[] data1, double[] data2, double perc, boolean isAngle1, boolean isAngle2, int averageType)
           
static boolean[] flatten(boolean[][] source)
          "Flattens" a table into an array (each row is appended to make an array).
static double[] flatten(double[][] source)
          "Flattens" a table into an array (each row is appended to make an array).
static
<T> int
indexOf(T[] array, T item)
          Searches the array for the specified item and returns its index within the array, or -1.
static double[][] insert(double[][] arr1, double[] arr2, int idx)
           
static boolean[] intToBooleanArray(int[] source)
          Converts an int array to a boolean array.
static boolean[][] intToBooleanArray(int[][] source)
          Converts an int table to a boolean table.
static boolean isNumeric(java.lang.String num)
           
static double[] linspace(double a, double b, int len)
          Returns an array of length len with elements equally spaced between a and b.
static double[] numbers(java.lang.String line)
          Returns an array containing all the numbers in the input string.
static java.io.PrintStream openFile(java.lang.String fn, boolean append)
           
static java.lang.Boolean parseOptions(java.lang.Object[] list, java.lang.String tag, boolean defaultValue)
           
static double parseOptions(java.lang.Object[] list, java.lang.String tag, double defaultValue)
           
static int parseOptions(java.lang.Object[] list, java.lang.String tag, int defaultValue)
           
static java.lang.Object parseOptions(java.lang.Object[] list, java.lang.String tag, java.lang.Object defaultValue)
           
static void printTable(java.io.PrintStream out, double[][] table, java.lang.String fmt)
           
static void printTable(java.io.PrintStream out, double[] table, java.lang.String fmt)
           
static void printTable(java.io.PrintStream out, int[][] table, java.lang.String fmt)
           
static void printTable(java.lang.String fn, double[][] table, java.lang.String fmt)
           
static void printTable(java.lang.String fn, double[] table, java.lang.String fmt)
           
static double[][] readTable(java.lang.String fn)
           
static double[][] reshape(double[] src, int rows, int columns)
          Reshapes a table.
static double[] resize(double[] source, int size)
          Resizes an array to a new size.
static int rndIntRange(int r1, int r2)
           
static double rndLogRange(double r1, double r2)
          Returns a number between r1 and r2, uniformly distributed in log.
static double rndRange(double r1, double r2)
          Returns a number between r1 and r2, uniformly distributed.
static double[][] sampleDataSet(double[][] dataset, int length)
           
static void saveData(double[][] src, java.lang.String fn)
          Saves a table to a file, using the default format (%15.8f).
static void saveData(double[] src, java.lang.String fn)
          Saves an array to a file, using the default format (%15.8f).
static void saveData(java.util.List<double[]> src, java.lang.String fn)
          Saves a list of double arrays to a file, using the default format (%15.8f).
static void shellSort(double[][] arr, double[][] arrcp, int col, int startRow, int endRow)
           
static void shellSort(double[][] arr, int col)
           
static void shellSort(double[][] arr, int col, boolean descending)
           
static void shellSort(double[][] arr, int col, int startRow, int endRow)
           
static void shellSort(double[][] arr, int col, int startRow, int endRow, boolean descending)
           
static void shellSort2(double[][] arr, int col, int startRow, int endRow, boolean descending)
           
static double[] shuffle(double[] array)
           
static double[][] shuffle(double[][] array)
           
static double[][] slice(double[][] array, int from, int count)
          Returns a slice of the specified table (all rows between from and from + count)
static double[] slice(double[] array, int from, int count)
          Returns an array containing count elements from from (inclusive).
static java.lang.Integer[] sort(double[][] arr, int col, boolean ascending)
           
static java.lang.Integer[] sort(double[] arr, boolean ascending)
           
static double span(double[] array)
          Returns the span of the array (max(array) - min(array))
static double span(double[][] table, int column)
          Returns the span of the table (max(array) - min(array)) for the given column
static java.lang.Double stringToDouble(java.lang.String v, java.lang.Double def)
          Converts a string to a double number.
static double sum(double[] data)
           
static double[][] table(java.lang.String source)
          Attempts parsing a string into a numeric table.
static double[] toArray(java.util.List<java.lang.Double> arr)
           
static double[][] toMatrix(java.util.List<double[]> arr)
           
static double valueOf(java.lang.String s, double defaultn)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEBUG

public static boolean DEBUG
Constructor Detail

Utils

public Utils()
Method Detail

indexOf

public static <T> int indexOf(T[] array,
                              T item)
Searches the array for the specified item and returns its index within the array, or -1.

Parameters:
array - Array to search
item - Item to search
Returns:
Index of the item, or -1

dprintln

public static void dprintln(java.lang.String str)
Parameters:
str -

dprintln

public static void dprintln(double str)
Parameters:
str -

dprintln

public static void dprintln(int str)
Parameters:
str -

dprintln

public static void dprintln()

dprint

public static void dprint(java.lang.String str)
Parameters:
str -

dprint

public static void dprint(double str)
Parameters:
str -

dprint

public static void dprint(int str)
Parameters:
str -

resize

public static double[] resize(double[] source,
                              int size)
Resizes an array to a new size.

Parameters:
source - Array
size - New length of the array
Returns:
Resized array

copy

public static final void copy(int[] source,
                              int[] dest)
Copies a source array into the destination array.

Parameters:
source -
dest -

copy

public static final int[] copy(int[] source)
Returns a copy of the specified array.

Parameters:
source -
Returns:

copy

public static final boolean[] copy(boolean[] vo)
Returns a copy of the specified array.

Parameters:
vo -
Returns:

copy

public static final void copy(double[] source,
                              double[] dest)
Copies a source array into the destination array.

Parameters:
source -
dest -

copy

public static final void copy(java.lang.String[] source,
                              java.lang.String[] dest)
Copies a source array into the destination array.

Parameters:
source -
dest -

copy

public static final void copy(double[][] source,
                              double[][] dest)
Copies a source array into the destination array.

Parameters:
source -
dest -

amini

public static int amini(double[] src)
Returns the index of the smallest item within the array.

Parameters:
src -
Returns:

amaxi

public static int amaxi(double[] src)
Returns the index of the largest item within the array.

Parameters:
src -
Returns:

amini

public static int amini(double[][] src,
                        int col)
Returns the index of the smallest item within the table for column col.

Parameters:
src -
col -
Returns:

amaxi

public static int amaxi(double[][] src,
                        int col)
Returns the index of the largest item within the table for column col.

Parameters:
src -
col -
Returns:

linspace

public static double[] linspace(double a,
                                double b,
                                int len)
Returns an array of length len with elements equally spaced between a and b.

Parameters:
a -
b -
len -
Returns:

checkOptions

public static boolean checkOptions(java.lang.Object[] list,
                                   java.lang.Object... tagsAndClasses)
Parameters:
list -
tagsAndClasses -
Returns:

parseOptions

public static java.lang.Object parseOptions(java.lang.Object[] list,
                                            java.lang.String tag,
                                            java.lang.Object defaultValue)
Parameters:
list -
tag -
defaultValue -
Returns:

parseOptions

public static double parseOptions(java.lang.Object[] list,
                                  java.lang.String tag,
                                  double defaultValue)
Parameters:
list -
tag -
defaultValue -
Returns:

parseOptions

public static int parseOptions(java.lang.Object[] list,
                               java.lang.String tag,
                               int defaultValue)
Parameters:
list -
tag -
defaultValue -
Returns:

parseOptions

public static java.lang.Boolean parseOptions(java.lang.Object[] list,
                                             java.lang.String tag,
                                             boolean defaultValue)
Parameters:
list -
tag -
defaultValue -
Returns:

slice

public static double[] slice(double[] array,
                             int from,
                             int count)
Returns an array containing count elements from from (inclusive).

Parameters:
array - Array to slice
from - First index
count - Slice size
Returns:
Slice

slice

public static double[][] slice(double[][] array,
                               int from,
                               int count)
Returns a slice of the specified table (all rows between from and from + count)

Parameters:
array -
from -
count -
Returns:

span

public static double span(double[] array)
Returns the span of the array (max(array) - min(array))

Parameters:
array -
Returns:

span

public static double span(double[][] table,
                          int column)
Returns the span of the table (max(array) - min(array)) for the given column

Parameters:
table -
column -
Returns:

amin

public static double amin(double[] src)
Returns the smallest item of the array

Parameters:
src -
Returns:

amin

public static double amin(double[][] src,
                          int column)
Returns the smallest item of the table for the specified column

Parameters:
src -
column -
Returns:

adiff

public static double[] adiff(double[] src)
Given an array a, returns an array containing the differences between successive array elements (b[0] = a[1]-a[0], b[i] = a[i+1]-a[i]).

Parameters:
src - The input array
Returns:
Array of differences

amax

public static double amax(double[] src)
Returns the largest element in the array

Parameters:
src -
Returns:

amax

public static double amax(double[][] src,
                          int column)
Returns the largest element in table for the specified column

Parameters:
src -
column -
Returns:

aabs

public static double[] aabs(double[] src)
Returns an array of absolute values

Parameters:
src -
Returns:

alog10

public static double[] alog10(double[] src)
Computes the log10 of the given array

Parameters:
src -
Returns:

copy

public static javax.swing.table.DefaultTableModel copy(javax.swing.table.DefaultTableModel source)
Parameters:
source -
Returns:

copyGLAsDoubleArray

public static GenericList copyGLAsDoubleArray(GenericList list)
Parameters:
list -
Returns:

copyGLAsString

public static GenericList copyGLAsString(GenericList list)
Parameters:
list -
Returns:

intToBooleanArray

public static boolean[][] intToBooleanArray(int[][] source)
Converts an int table to a boolean table.

Parameters:
source -
Returns:

stringToDouble

public static java.lang.Double stringToDouble(java.lang.String v,
                                              java.lang.Double def)
Converts a string to a double number. If the string cannot be converted to a double, then the method returns the default value def.

Parameters:
v -
def -
Returns:

booleanToIntArray

public static int[][] booleanToIntArray(boolean[][] source)
Converts a boolean table to an int table (true -> 1, false -> 0)

Parameters:
source -
Returns:

intToBooleanArray

public static boolean[] intToBooleanArray(int[] source)
Converts an int array to a boolean array.

Parameters:
source -
Returns:

booleanToIntArray

public static int[] booleanToIntArray(boolean[] source)
Converts a boolean array to an int array.

Parameters:
source -
Returns:

saveData

public static void saveData(double[][] src,
                            java.lang.String fn)
                     throws java.io.FileNotFoundException
Saves a table to a file, using the default format (%15.8f).

Parameters:
src - Numeric table
fn - File name
Throws:
java.io.FileNotFoundException

saveData

public static void saveData(java.util.List<double[]> src,
                            java.lang.String fn)
                     throws java.io.FileNotFoundException
Saves a list of double arrays to a file, using the default format (%15.8f).

Parameters:
src -
fn -
Throws:
java.io.FileNotFoundException

saveData

public static void saveData(double[] src,
                            java.lang.String fn)
                     throws java.io.FileNotFoundException
Saves an array to a file, using the default format (%15.8f).

Parameters:
src -
fn -
Throws:
java.io.FileNotFoundException

array

public static final double[] array(double v,
                                   int length)
Creates a new array of the specified length and fills it with the specified double value.

Parameters:
v - Default value for array elements
length - Length of the array
Returns:

findContainingEllipse

public static final double[] findContainingEllipse(double[] data1,
                                                   double[] data2,
                                                   double perc,
                                                   boolean isAngle1,
                                                   boolean isAngle2,
                                                   int averageType)
Parameters:
data1 -
data2 -
perc -
isAngle1 -
isAngle2 -
averageType -
Returns:

copy

public static final void copy(int[][] source,
                              int[][] dest)
Copies the table source into the table dest.

Parameters:
source -
dest -

copy

public static final int[][] copy(int[][] source)
Returns a copy of the source table.

Parameters:
source -
Returns:

copy

public static final void copy(boolean[][] source,
                              boolean[][] dest)
Copies the table source into the table dest.

Parameters:
source -
dest -

copy

public static final void copy(double[][] source,
                              double[] dest,
                              int column)
Copies the specified column of the table source into the dest array.

Parameters:
source -
dest -
column -

copy

public static final double[][] copy(double[][] source)
Returns a copy of the table source.

Parameters:
source -
Returns:

copy

public static final double[] copy(double[] source)
Returns a copy of the double array source.

Parameters:
source -
Returns:

copy

public static final java.lang.String[] copy(java.lang.String[] source)
Returns a copy of the String array source.

Parameters:
source -
Returns:

copy

public static final boolean[][] copy(boolean[][] source)
Returns a copy of the boolean table source.

Parameters:
source -
Returns:

table

public static double[][] table(java.lang.String source)
Attempts parsing a string into a numeric table. Each row is separated by a newline character. Lines that start with a # character are considered comments.

Parameters:
source -
Returns:

numbers

public static double[] numbers(java.lang.String line)
Returns an array containing all the numbers in the input string.

Parameters:
line -
Returns:

column

public static double[] column(double[][] source,
                              int column)
Returns the specified column from the given table.

Parameters:
source -
column -
Returns:

_column

public static double[] _column(double[][] source,
                               int column)
Returns the specified column from the given table.

Parameters:
source -
column -
Returns:

column

public static void column(double[][] dest,
                          double[] subst,
                          int column)
Substitutes the specified column in the dest table with the subst array.

Parameters:
dest -
subst -
column -

column

public static void column(double[][] dest,
                          double subst,
                          int column)
Fills the specified column in the dest table with the value subst.

Parameters:
dest -
subst -
column -

column

public static boolean[] column(boolean[][] source,
                               int column)
Returns the given column of the table.

Parameters:
source -
column -
Returns:

column

public static void column(boolean[][] dest,
                          boolean[] subst,
                          int column)
Substitutes the specified column in the dest table with the subst array.

Parameters:
dest -
subst -
column -

column

public static void column(boolean[][] dest,
                          boolean subst,
                          int column)
Fills the specified column in the dest table with the subst value.

Parameters:
dest -
subst -
column -

reshape

public static double[][] reshape(double[] src,
                                 int rows,
                                 int columns)
Reshapes a table. Given the source table, this method returns a new table with the the specified number of rows and columns.

Parameters:
src -
rows -
columns -
Returns:

emul

public static void emul(double[] result,
                        double[] a,
                        double[] b)
Multiplies the two arrays.

Parameters:
result -
a -
b -

ediv

public static void ediv(double[] result,
                        double[] a,
                        double[] b)
Divides the two arrays.

Parameters:
result -
a -
b -

emul

public static void emul(double[] result,
                        double[] a,
                        double b)
Parameters:
result -
a -
b -

emul

public static void emul(double[][] result,
                        double[][] a,
                        int column,
                        double b)
Parameters:
result -
a -
column -
b -

ediv

public static void ediv(double[] result,
                        double[] a,
                        double b)
Parameters:
result -
a -
b -

eadd

public static void eadd(double[] result,
                        double[] a,
                        double[] b)
Parameters:
result -
a -
b -

esub

public static final void esub(double[] result,
                              double[] a,
                              double[] b)
Parameters:
result -
a -
b -

esub

public static final void esub(double[] result,
                              double[] a,
                              double b)
Parameters:
result -
a -
b -

esub

public static final double[] esub(double[] a,
                                  double[] b)
Parameters:
a -
b -
Returns:

esub

public static final double[] esub(double[] a,
                                  double b)
Parameters:
a -
b -
Returns:

flatten

public static final double[] flatten(double[][] source)
"Flattens" a table into an array (each row is appended to make an array).

Parameters:
source -
Returns:

flatten

public static boolean[] flatten(boolean[][] source)
"Flattens" a table into an array (each row is appended to make an array).

Parameters:
source -
Returns:

fill

public static void fill(double[][] m,
                        double v)
Fills a table with the value v.

Parameters:
m -
v -

fill

public static void fill(double[] m,
                        double v)
Fills an array with the value v (equivalent to Array.fill).

Parameters:
m -
v -

fill

public static void fill(boolean[] m,
                        boolean v)
Fills an array with the value v (equivalent to Array.fill).

Parameters:
m -
v -

fill

public static void fill(int[] m,
                        int v)
Fills an array with the value v (equivalent to Array.fill).

Parameters:
m -
v -

fill

public static void fill(java.lang.Object[] m,
                        java.lang.Object v)
Fills an array with the value v (equivalent to Array.fill).

Parameters:
m -
v -

fill

public static void fill(boolean[][] m,
                        boolean v)
Fills a table with the value v.

Parameters:
m -
v -

fill

public static void fill(double[][] m,
                        double v,
                        int column)
Fills the specified column of the table with the value v.

Parameters:
m -
v -
column -

fill

public static void fill(boolean[][] m,
                        boolean v,
                        int column)
Fills the specified column of the table with the value v.

Parameters:
m -
v -
column -

fill

public static void fill(double[][] m,
                        double[] v,
                        int column)
Fills the specified column of the table with the given array.

Parameters:
m -
v -
column -

rndRange

public static double rndRange(double r1,
                              double r2)
Returns a number between r1 and r2, uniformly distributed.

Parameters:
r1 -
r2 -
Returns:

rndIntRange

public static int rndIntRange(int r1,
                              int r2)

rndLogRange

public static double rndLogRange(double r1,
                                 double r2)
Returns a number between r1 and r2, uniformly distributed in log.

Parameters:
r1 -
r2 -
Returns:

apply

public static double[] apply(double[] data,
                             java.lang.String operation)
Parameters:
data -
operation -
Returns:

fill

public static void fill(int[][] m,
                        int v)
Fills the table with the value v.

Parameters:
m -
v -

fill

public static void fill(int[][] m,
                        int v,
                        int column)
Fills the table with the value v.

Parameters:
m -
v -
column -

bin

public static double[][] bin(double[] data,
                             java.lang.Double min,
                             java.lang.Double max,
                             int bins,
                             double[][] binv2,
                             double[] info)
Bins an array between the min and max values, for the given number of bins. This routine returns a new table containing {{bin1, v1}, {bin2, v2}...} bins bins.

Parameters:
data - Input data.
min - Minimum value of the bin (can be null to use the minimum value of the data)
max - Maximum value of the bin (can be null to use the maximum value of the data)
bins - Number of bins
binv2 -
info -
Returns:

cumsum

public static double[][] cumsum(double[][] data,
                                int col)
Parameters:
data -
col -
Returns:

sum

public static double sum(double[] data)
Parameters:
data -
Returns:

isNumeric

public static boolean isNumeric(java.lang.String num)
Parameters:
num -
Returns:

bin_nn

public static double[][] bin_nn(double[] data,
                                java.lang.Double min,
                                java.lang.Double max,
                                int bins,
                                double[][] binv2,
                                double[] info)
Parameters:
data -
min -
max -
bins -
binv2 -
info -
Returns:

append

public static java.lang.String[] append(java.lang.String[] arr,
                                        java.lang.String el)
Parameters:
arr -
el -
Returns:

deleteIndex

public static <T> T[] deleteIndex(T[] arr,
                                  int index)

deleteIndex

public static double[] deleteIndex(double[] arr,
                                   int index)

valueOf

public static double valueOf(java.lang.String s,
                             double defaultn)
Parameters:
s -
defaultn -
Returns:

append

public static double[][] append(double[][] arr1,
                                double[][] arr2)
Parameters:
arr1 -
arr2 -
Returns:

append

public static double[][] append(double[][] arr1,
                                double[] arr2)
Parameters:
arr1 -
arr2 -
Returns:

append_right

public static double[][] append_right(double[][] arr1,
                                      double[] arr2)
Parameters:
arr1 -
arr2 -
Returns:

append

public static double[] append(double[] arr1,
                              double[] arr2)
Parameters:
arr1 -
arr2 -
Returns:

insert

public static final double[][] insert(double[][] arr1,
                                      double[] arr2,
                                      int idx)
Parameters:
arr1 -
arr2 -
idx -
Returns:

toMatrix

public static double[][] toMatrix(java.util.List<double[]> arr)
Parameters:
arr -
Returns:

toArray

public static double[] toArray(java.util.List<java.lang.Double> arr)
Parameters:
arr -
Returns:

concat

public static java.lang.String concat(java.util.List<java.lang.String> what,
                                      java.lang.String sep)
Parameters:
what -
sep -
Returns:

shellSort

public static final void shellSort(double[][] arr,
                                   double[][] arrcp,
                                   int col,
                                   int startRow,
                                   int endRow)
Parameters:
arr -
arrcp -
col -
startRow -
endRow -

shellSort

public static void shellSort(double[][] arr,
                             int col,
                             int startRow,
                             int endRow)
Parameters:
arr -
col -
startRow -
endRow -

shellSort

public static void shellSort(double[][] arr,
                             int col)
Parameters:
arr -
col -
startRow -
endRow -

shellSort

public static void shellSort(double[][] arr,
                             int col,
                             boolean descending)

shellSort2

public static void shellSort2(double[][] arr,
                              int col,
                              int startRow,
                              int endRow,
                              boolean descending)
Parameters:
arr -
col -
startRow -
endRow -
descending -

shellSort

public static final void shellSort(double[][] arr,
                                   int col,
                                   int startRow,
                                   int endRow,
                                   boolean descending)
Parameters:
arr -
col -
startRow -
endRow -
descending -

sort

public static java.lang.Integer[] sort(double[][] arr,
                                       int col,
                                       boolean ascending)
Parameters:
arr -
col -
ascending -
Returns:

sort

public static java.lang.Integer[] sort(double[] arr,
                                       boolean ascending)
Parameters:
arr -
col -
ascending -
Returns:

applySort

public static double[][] applySort(double[][] arr,
                                   java.lang.Integer[] indices)
Parameters:
arr -
indices -
Returns:

applySort

public static double[] applySort(double[] arr,
                                 java.lang.Integer[] indices)
Parameters:
arr -
indices -
Returns:

applySort

public static int[][] applySort(int[][] arr,
                                java.lang.Integer[] indices)
Parameters:
arr -
indices -
Returns:

applySort

public static java.lang.String[] applySort(java.lang.String[] arr,
                                           java.lang.Integer[] indices)
Parameters:
arr -
indices -
Returns:

applySort

public static java.lang.Object[] applySort(java.lang.Object[] arr,
                                           java.lang.Integer[] indices)
Parameters:
arr -
indices -
Returns:

printTable

public static void printTable(java.io.PrintStream out,
                              int[][] table,
                              java.lang.String fmt)
Parameters:
out -
table -
fmt -

printTable

public static void printTable(java.io.PrintStream out,
                              double[][] table,
                              java.lang.String fmt)
Parameters:
out -
table -
fmt -

printTable

public static void printTable(java.lang.String fn,
                              double[][] table,
                              java.lang.String fmt)

printTable

public static void printTable(java.lang.String fn,
                              double[] table,
                              java.lang.String fmt)

printTable

public static void printTable(java.io.PrintStream out,
                              double[] table,
                              java.lang.String fmt)
Parameters:
out -
table -
fmt -

openFile

public static java.io.PrintStream openFile(java.lang.String fn,
                                           boolean append)

equals

public static boolean equals(double d1,
                             double d2,
                             double tolerance)
Parameters:
d1 -
d2 -
tolerance -
Returns:

bootstrapDataSet

public static double[][] bootstrapDataSet(double[][] data)
Parameters:
data -
Returns:

bootstrapDataSetAroundMean

public static double[][] bootstrapDataSetAroundMean(double[][] data)
Parameters:
data -
Returns:

bootstrapDataSetByScrambling

public static double[][] bootstrapDataSetByScrambling(double[][] data)
Parameters:
data -
Returns:

bootstrapCreateGaussianDeviates

public static double[][] bootstrapCreateGaussianDeviates(double[][] data,
                                                         double dev)
Parameters:
data -
dev -
Returns:

shuffle

public static double[] shuffle(double[] array)

shuffle

public static double[][] shuffle(double[][] array)

sampleDataSet

public static double[][] sampleDataSet(double[][] dataset,
                                       int length)

readTable

public static double[][] readTable(java.lang.String fn)