|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objecttpp.MatrixUtils
public class MatrixUtils
Matrix Utilities !!TODO make all methods instance rather than static !!TODO change all these methods to just work on Matrix objects rather than double arrays -- and change the rest of the application to use double arrays less.
Constructor Summary | |
---|---|
MatrixUtils()
|
Method Summary | |
---|---|
static double[] |
abs(double[] x)
|
static double[] |
add(double[] a1,
double[] a2)
add a1 to a2. |
static java.lang.String |
array2String(double[][] array)
|
static Matrix |
columnarTimes(Matrix mx,
double[] scalars)
Create a new matrix, the result of multiplying each column of the given matrix by the corresponding scalar value in the array. |
static double[] |
columnMeans(double[][] m)
The means of each column |
static Matrix |
columnMeans(Matrix m)
The means of each column |
static double[] |
columnStdev(double[][] m)
The stdev of each column |
static double[] |
columnStdev(Matrix m)
The stdev of each column |
static double |
dissimilarity(double[][] a,
double[][] b)
The size of the difference between two arrays |
static double[][] |
distances(double[][] a)
|
static double[] |
getColumn(double[][] m,
int col)
|
static double[] |
getColumn(Matrix m,
int col)
|
static double[] |
getRow(Matrix m,
int r)
|
static Matrix |
insertRow(Matrix m,
double[] row)
Insert a row of values into the bottom of the given matrix. |
static double |
length(double[] a)
Euclidean length of a row vector |
static double[] |
localMean(double[] x,
int neighbours)
Find the local mean -- ie the mean of the n neighbours on either side. |
static double |
localVolatility(double[] x,
int neighbours)
Find the local volatility -- ie the root sum square distance from the local mean. |
static double |
logistic(double x)
The logistic function of a double L(x) = 1 / (1+exp(-x) |
static double[] |
logistic(double[] x)
The logistic function of an array of doubles |
static void |
main(java.lang.String[] args)
|
static double |
maxAbsValue(Matrix mx)
The maximum absolute value of components in the matrix. |
static double[] |
maxAbsValueCol(Matrix mx)
The maximum absolute value of components in each column of the matrix. |
static double |
mean(double[] x)
Find the mean of an array of doubles. |
static double[] |
minMax(double[] a)
The min and max of a set of numbers |
static double[] |
normalise(double[] x)
Normalise by dividing by root mean square |
static Matrix |
numeric2matrix(Instances instances)
Construct a matrix from (the numeric attributes of ) a set of instances. |
static int[] |
rank(double[] data)
Sort the array of doubles, returning the indices of the doubles in order of size -- largest first |
static double[][] |
removeRows(double[][] m,
int[] rowsToRemove)
|
static double[] |
rowNorm2(Matrix mx)
Return an array comprising the Euclidean norm of each row |
static void |
setColumn(Matrix m,
int col,
double value)
|
static void |
setColumn(Matrix m,
int col,
double[] values)
|
static void |
setRow(Matrix m,
int row,
double[] values)
|
static double |
stdev(double[] x)
Find the stdev of an array of doubles. |
static double[][] |
times(double[][] a,
double[][] b)
matrix multiplication |
static double[] |
times(double[] a,
double d)
times a by d. |
static double[] |
times(double[] a,
double[][] b)
Multiply a row by a matrix |
static java.lang.String |
toString(double[] x)
|
static java.lang.String |
toString(double[][] a)
|
static java.lang.String |
toString(int[] x)
|
static double[][] |
transpose(double[][] a)
|
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public MatrixUtils()
Method Detail |
---|
public static Matrix numeric2matrix(Instances instances)
public static double[][] distances(double[][] a)
public static double[] rowNorm2(Matrix mx)
public static int[] rank(double[] data)
public static Matrix columnarTimes(Matrix mx, double[] scalars)
public static java.lang.String array2String(double[][] array)
public static double maxAbsValue(Matrix mx)
public static double[] maxAbsValueCol(Matrix mx)
public static double stdev(double[] x)
public static double mean(double[] x)
public static double[] localMean(double[] x, int neighbours)
public static double localVolatility(double[] x, int neighbours)
public static double[] normalise(double[] x)
public static double[][] removeRows(double[][] m, int[] rowsToRemove)
public static double[] getColumn(Matrix m, int col)
public static double[] getColumn(double[][] m, int col)
public static void setColumn(Matrix m, int col, double[] values)
public static void setColumn(Matrix m, int col, double value)
public static double[] getRow(Matrix m, int r)
public static void setRow(Matrix m, int row, double[] values)
public static double[] abs(double[] x)
public static java.lang.String toString(double[] x)
public static java.lang.String toString(int[] x)
public static double[] add(double[] a1, double[] a2)
public static double[] times(double[] a, double d)
public static double[][] times(double[][] a, double[][] b)
public static double[] times(double[] a, double[][] b)
public static java.lang.String toString(double[][] a)
public static Matrix insertRow(Matrix m, double[] row)
public static Matrix columnMeans(Matrix m)
public static double[] columnMeans(double[][] m)
public static double[] columnStdev(Matrix m)
public static double[] columnStdev(double[][] m)
public static double length(double[] a)
public static double dissimilarity(double[][] a, double[][] b)
public static void main(java.lang.String[] args)
public static double[][] transpose(double[][] a)
public static double[] minMax(double[] a)
public static double logistic(double x)
public static double[] logistic(double[] x)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |