|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.stanford.nlp.math.ArrayMath
public class ArrayMath
Class ArrayMath
Constructor Summary | |
---|---|
ArrayMath()
|
Method Summary | |
---|---|
static double[] |
add(double[] a,
double c)
|
static double[] |
add(double[] a,
double[] b)
|
static float[] |
add(float[] a,
float[] b)
|
static void |
addInPlace(double[] a,
double b)
|
static void |
addInPlace(double[] a,
double[] b)
|
static int |
argmax(double[] a)
|
static int |
argmax(float[] a)
|
static int |
argmin(double[] a)
|
static int |
argmin(float[] a)
|
static int |
argmin(int[] a)
|
static double |
average(double[] a)
|
static float[] |
doubleArrayToFloatArray(double[] a)
|
static float[][] |
doubleArrayToFloatArray(double[][] a)
|
static double[] |
exp(double[] a)
|
static void |
expInPlace(double[] a)
|
static double[] |
floatArrayToDoubleArray(float[] a)
|
static double[][] |
floatArrayToDoubleArray(float[][] a)
|
static boolean |
hasInfinite(double[] a)
|
static boolean |
hasNaN(double[] a)
|
static double |
innerProduct(double[] a,
double[] b)
|
static double |
innerProduct(float[] a,
float[] b)
|
static double |
klDivergence(double[] from,
double[] to)
|
static double[][] |
load2DMatrixFromFile(String filename)
|
static double[] |
log(double[] a)
|
static void |
logInPlace(double[] a)
|
static void |
logNormalize(double[] a)
Makes the values in this array sum to 1.0. |
static double |
logSum(double[] logInputs)
Returns the log of the sum of an array of numbers, which are themselves input in log form. |
static float |
logSum(float[] logInputs)
Returns the log of the sum of an array of numbers, which are themselves input in log form. |
static double |
max(double[] a)
|
static float |
max(float[] a)
|
static double |
mean(double[] a)
|
static double |
min(double[] a)
|
static float |
min(float[] a)
|
static int |
min(int[] a)
|
static double[] |
multiply(double[] a,
double c)
Scales the values in this array by c. |
static float[] |
multiply(float[] a,
float c)
Scales the values in this array by c. |
static void |
multiplyInPlace(double[] a,
double c)
Scales in place the values in this array by c. |
static double |
norm_1(double[] a)
Computes 1-norm of vector |
static double |
norm_1(float[] a)
Computes 1-norm of vector |
static double |
norm_inf(double[] a)
Computes inf-norm of vector |
static double |
norm_inf(float[] a)
Computes inf-norm of vector |
static double |
norm(double[] a)
Computes 2-norm of vector |
static double |
norm(float[] a)
Computes 2-norm of vector |
static void |
normalize(double[] a)
Makes the values in this array sum to 1.0. |
static void |
normalize(float[] a)
Makes the values in this array sum to 1.0. |
static double[] |
pairwiseAdd(double[] a,
double[] b)
|
static double[] |
pairwiseMultiply(double[] a,
double[] b)
Assumes that both arrays have same length. |
static void |
pairwiseMultiply(double[] a,
double[] b,
double[] result)
Puts the result in the result array. |
static float[] |
pairwiseMultiply(float[] a,
float[] b)
Assumes that both arrays have same length. |
static void |
pairwiseMultiply(float[] a,
float[] b,
float[] result)
Puts the result in the result array. |
static double[] |
pow(double[] a,
double c)
Scales the values in this array by c. |
static float[] |
pow(float[] a,
float c)
Scales the values in this array by c. |
static void |
powInPlace(double[] a,
double c)
Scales the values in this array by c. |
static void |
powInPlace(float[] a,
float c)
Scales the values in this array by c. |
static int |
sampleFromDistribution(double[] d)
Samples from the distribution over values 0 through d.length given by d. |
static int |
sampleFromDistribution(double[] d,
Random random)
Samples from the distribution over values 0 through d.length given by d. |
static int |
sampleFromDistribution(float[] d,
Random random)
Samples from the distribution over values 0 through d.length given by d. |
static void |
scale(double[] a,
double b)
Scales the values in this array by b. |
static void |
scale(float[] a,
double b)
Scales the values in this array by b. |
static void |
setToLogDeterministic(double[] a,
int i)
|
static void |
setToLogDeterministic(float[] a,
int i)
|
static void |
shift(double[] a,
double b)
Shifts the values in this array by b. |
static double |
standardErrorOfMean(double[] a)
|
static double |
stdev(double[] a)
|
static int[] |
subArray(int[] a,
int from,
int to)
|
static double[] |
subtract(double[] a,
double[] b)
|
static float[] |
subtract(float[] a,
float[] b)
|
static double |
sum(double[] a)
|
static float |
sum(float[] a)
|
static double |
sumSquaredError(double[] a)
|
static String |
toString(byte[] a)
|
static String |
toString(byte[] a,
NumberFormat nf)
|
static String |
toString(double[] a)
|
static String |
toString(double[][] counts)
|
static String |
toString(double[][] counts,
int cellSize,
Object[] rowLabels,
Object[] colLabels,
NumberFormat nf,
boolean printTotals)
|
static String |
toString(double[] a,
NumberFormat nf)
|
static String |
toString(float[] a)
|
static String |
toString(float[][] counts)
|
static String |
toString(float[][] counts,
int cellSize,
Object[] rowLabels,
Object[] colLabels,
NumberFormat nf,
boolean printTotals)
|
static String |
toString(float[] a,
NumberFormat nf)
|
static String |
toString(int[] a)
|
static String |
toString(int[][] counts)
|
static String |
toString(int[][] counts,
int cellSize,
Object[] rowLabels,
Object[] colLabels,
NumberFormat nf,
boolean printTotals)
|
static String |
toString(int[] a,
NumberFormat nf)
|
static double |
variance(double[] a)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ArrayMath()
Method Detail |
---|
public static float[] doubleArrayToFloatArray(double[] a)
public static double[] floatArrayToDoubleArray(float[] a)
public static double[][] floatArrayToDoubleArray(float[][] a)
public static float[][] doubleArrayToFloatArray(double[][] a)
public static double[] add(double[] a, double c)
public static void addInPlace(double[] a, double b)
public static void addInPlace(double[] a, double[] b)
public static double[] add(double[] a, double[] b)
public static float[] add(float[] a, float[] b)
public static double[] subtract(double[] a, double[] b)
public static float[] subtract(float[] a, float[] b)
public static double[] multiply(double[] a, double c)
public static void multiplyInPlace(double[] a, double c)
public static float[] multiply(float[] a, float c)
public static double average(double[] a)
public static float[] pow(float[] a, float c)
public static void powInPlace(float[] a, float c)
public static void powInPlace(double[] a, double c)
public static double[] pow(double[] a, double c)
public static boolean hasNaN(double[] a)
public static boolean hasInfinite(double[] a)
public static double norm_inf(double[] a)
a
-
public static double norm_inf(float[] a)
a
-
public static double norm_1(double[] a)
a
-
public static double norm_1(float[] a)
a
-
public static double norm(double[] a)
a
-
public static double norm(float[] a)
a
-
public static void scale(double[] a, double b)
public static void scale(float[] a, double b)
public static void shift(double[] a, double b)
public static double[] pairwiseMultiply(double[] a, double[] b)
public static float[] pairwiseMultiply(float[] a, float[] b)
public static void pairwiseMultiply(double[] a, double[] b, double[] result)
public static void pairwiseMultiply(float[] a, float[] b, float[] result)
public static double[] pairwiseAdd(double[] a, double[] b)
public static double sum(double[] a)
public static float sum(float[] a)
public static int argmax(double[] a)
public static double max(double[] a)
public static int argmax(float[] a)
public static float max(float[] a)
public static int argmin(double[] a)
public static double min(double[] a)
public static int argmin(float[] a)
public static float min(float[] a)
public static int argmin(int[] a)
public static int min(int[] a)
public static double[] exp(double[] a)
public static double[] log(double[] a)
public static void expInPlace(double[] a)
public static void logInPlace(double[] a)
public static double innerProduct(double[] a, double[] b)
public static double innerProduct(float[] a, float[] b)
public static int[] subArray(int[] a, int from, int to)
public static String toString(double[] a)
public static String toString(double[] a, NumberFormat nf)
public static String toString(float[] a)
public static String toString(float[] a, NumberFormat nf)
public static String toString(int[] a)
public static String toString(int[] a, NumberFormat nf)
public static String toString(byte[] a)
public static String toString(byte[] a, NumberFormat nf)
public static void normalize(double[] a)
public static void normalize(float[] a)
public static void logNormalize(double[] a)
public static int sampleFromDistribution(double[] d)
d
- the distribution to sample from
public static int sampleFromDistribution(double[] d, Random random)
d
- the distribution to sample from
public static int sampleFromDistribution(float[] d, Random random)
d
- the distribution to sample from
public static double klDivergence(double[] from, double[] to)
public static void setToLogDeterministic(float[] a, int i)
public static void setToLogDeterministic(double[] a, int i)
public static double mean(double[] a)
public static double sumSquaredError(double[] a)
public static double variance(double[] a)
public static double stdev(double[] a)
public static double standardErrorOfMean(double[] a)
public static String toString(int[][] counts)
public static String toString(int[][] counts, int cellSize, Object[] rowLabels, Object[] colLabels, NumberFormat nf, boolean printTotals)
public static String toString(double[][] counts)
public static String toString(double[][] counts, int cellSize, Object[] rowLabels, Object[] colLabels, NumberFormat nf, boolean printTotals)
public static String toString(float[][] counts)
public static String toString(float[][] counts, int cellSize, Object[] rowLabels, Object[] colLabels, NumberFormat nf, boolean printTotals)
public static double logSum(double[] logInputs)
logInputs
- An array of numbers [log(x1), ..., log(xn)]
public static float logSum(float[] logInputs)
logInputs
- An array of numbers [log(x1), ..., log(xn)]
public static double[][] load2DMatrixFromFile(String filename) throws IOException
IOException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |