|
BIJ API |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--bijnum.BIJmatrix
Implements methods for large (by necessity, float) matrices, including covariance of matrix, eigenvectors and others. Syntax is kept similar to Matlab, including order of operations. The basic difference with BIJMatrix is that here the matrices are all float, the syntax is the smae as Matlab and it is active. I do not want to touch BIJMatrix anymore. Copyright (c) 1999-2003, Michael Abramoff. All rights reserved.
Constructor Summary | |
BIJmatrix()
|
Method Summary | |
static float[] |
abs(float[] v)
Return a vector with the absolutes of all elements in vector v. |
static void |
add(float[][] m,
double scalar)
Add a scalar to all entries in a matrix m in place. |
static void |
add(float[][] a,
float[][] b)
Add (elements in) a matrix b to a matrix a. |
static void |
add(float[][] r,
float[][] a,
float[][] b)
Add the elements of two matrices a and b and save the results in a matrix r. |
static float[] |
add(float[] v,
float scalar,
float[] mask)
|
static void |
addElements(double[] r,
double[] a,
double[] b)
|
static float[] |
addElements(float[] a,
float[] b)
|
static void |
addElements(float[] r,
float[] a,
float[] b)
|
static boolean |
checkinverse(double[][] J,
double[][] JI)
Check whether JI is really the inverse of J. |
static float[] |
col(float[][] m,
int n)
Return the n'th column of matrix m as a vector. |
static float[] |
copy(float[] v)
Copy a vector. |
static float[][] |
copy(float[][] m)
Copy a matrix. |
static float |
determinant(float[][] m)
Compute determinant of m. |
static float[][] |
diag(float[] v)
Get a square matrix with v on the diagonal. |
static float[] |
diag(float[][] m)
Get the diagonal vector of (square) matrix m. |
static float[] |
div(float[] v,
double divisor)
Divide each entry in v by divisor. |
static void |
divElements(float[][] m,
double divisor)
Divide each entry in m by divisor. |
static void |
divElements(float[] r,
float[] a,
float[] b)
Divide all elements in vector a by elements in b. |
static float[] |
flatten(float[][] m)
Deprecated. |
static int |
GaussElim(float[] a,
float[] x)
Gaussian elimination method with backward substitution to solve a system of linear equations. |
static float[][] |
inverse(float[][] m)
Invert a symmetric matrix m. |
static void |
ln(float[] r,
float[] v)
Compute the natural logarithmr of each element in vector v and put into r. |
static float[] |
mask(float[] v,
float[] mask)
Return a vector containing only the elements in v that have a mask value != 0. |
static float[] |
minmax(float[] v)
|
static float[] |
minmax(float[][] m)
|
static float[] |
minmaxNot0(float[] v)
|
static float[] |
minmaxNot0(float[][] m)
|
static float[] |
mul(float[][] a,
float[] v)
Compute the outer product of a matrix and a vector v |
static float[][] |
mul(float[][] a,
float[][] b)
Compute the matrix product of m and n. |
static float[][] |
mul(float[][] a,
float[][] b,
boolean doShowProgress)
Compute the matrix product of m and n. |
static void |
mul(float[][] r,
float[][] m,
float scalar)
Multiply each element in matrix m by a scalar and put result in r. |
static void |
mul(float[][] m,
float[][] a,
float[][] b,
boolean doShowProgress)
Compute the matrix product of m and n into r. |
static float[] |
mul(float[] v,
float scalar)
Deprecated. |
static void |
mul(float[] r,
float[][] a,
float[] v)
Compute the outer product of a matrix and a vector v and put the result in r. |
static void |
mulElements(double[] r,
double[] v,
double scalar)
Multiply each element in v by a scalar and put in r. |
static void |
mulElements(double[] r,
double[] a,
double[] b)
Multiply all elements in vector a by elements in b and put in r. |
static float[] |
mulElements(float[] a,
float[] b)
Multiply all elements in vector a by elements in b. |
static void |
mulElements(float[] r,
float[] v,
double scalar)
Multiply each element in v by a scalar and put in r. |
static void |
mulElements(float[] r,
float[] a,
float[] b)
Multiply all elements in vector a by elements in b and put in r. |
static float[][] |
mulOuter(float[] a,
float[] b)
Compute outer product of vector a and b. |
static float[][] |
mulT(float[][] a,
float[][] b,
boolean doShowProgress)
Compute the |
static float |
norm(float[] v)
Return length or norm of vector v. |
static void |
pow(double[] r,
double[] v,
double power)
Compute the power'th power of each element in vector v and put into r. |
static float[][] |
pow(float[][] m,
float power)
Compute the power'th power of each entry in the matrix m. |
static void |
pow(float[] r,
float[] v,
double power)
Compute the power'th power of each element in vector v and put into r. |
static void |
pow(float[] r,
float[] v,
float power)
Compute the power'th power of each element in vector v and put into r. |
static double |
pseudoinverse(double[][] JI,
double[][] J,
double singularLimit)
Deprecated. |
static float |
pseudoinverse(float[][] JI,
float[][] J,
double singularLimit)
Deprecated. |
static float[][] |
repmat(float[][] a,
int n,
int m)
repmat replicates a matrix in tiled form. |
static float[][] |
repmat(float[] a,
int n,
int m)
repmat replicates a vector in tiled form. |
static int[] |
sort(float[] v)
Sort a vector, but return the result as a vector of indices, conserving the original vector. |
static void |
sort(float[] indicator,
float[] v,
float[][] m)
Sort a vector and a matrix simultaneously based on the order of items in a third vector. |
static void |
sub(float[][] r,
float[][] m,
float[] v)
Subtract the elements of a vector v from each element of a matrix m, columnwise. |
static void |
sub(float[][] r,
float[][] m,
float[][] n)
Subtract a matrix n from a matrix m. |
static float[] |
sub(float[] a,
float[] b)
|
static void |
sub(float[] r,
float[] a,
float scalar)
|
static void |
subElements(float[] r,
float[] a,
float[] b)
|
static float[][] |
subset(float[][] m,
int[] indices)
Make a subset of m, include only those row vectors with an index which is in indices. |
static float[][] |
subset(float[][] m,
int start,
int last)
Make a subset of m, including only those with an index which is equal or larger than start up to and including last. |
static float[] |
subset(float[] v,
int start)
Make a subset of v, including only those with an index which is equal or larger than start. |
static float[] |
subset(float[] v,
int[] indices)
Make a subset of v, including only those with an index which is in indices. |
static float[] |
subset(float[] v,
int start,
int last)
Make a subset of v, including only those with an index which is equal or larger than start up to and including last. |
static float[][] |
subsetColumns(float[][] m,
int[] indices)
Make a subset of m, including only those columns of the row vectors with an index which is in indices. |
static void |
test()
|
static float[][] |
transpose(float[][] m)
Compute the transpose of a matrix m. |
static float[][] |
trunc(float[][] m,
int n)
Truncate a matrix to a new column length n. |
static float[] |
trunc(float[] v,
int n)
Truncate a vector to a new length n. |
Methods inherited from class java.lang.Object |
|
Constructor Detail |
public BIJmatrix()
Method Detail |
public static float[][] mul(float[][] a, float[][] b)
a
- a matrix of float[N][M]b
- a matrix of float[M][N]public static float[][] mul(float[][] a, float[][] b, boolean doShowProgress)
a
- a matrix of float[N][M]b
- a matrix of float[M][N]public static void mul(float[][] m, float[][] a, float[][] b, boolean doShowProgress)
r
- a matrix of float[N][N]a
- a matrix of float[N][M]b
- a matrix of float[M][N]public static float[] mul(float[][] a, float[] v) throws java.lang.IllegalArgumentException
a
- a float[][] matrixv
- a float[] vector.public static void mulElements(double[] r, double[] a, double[] b)
r
- a double[] vectora
- a double[] vectorb
- a double[] vectorpublic static void mulElements(float[] r, float[] a, float[] b)
r
- a float[] vectora
- a float[] vectorb
- a float[] vectorpublic static float[] mulElements(float[] a, float[] b)
a
- a float[] vectorb
- a float[] vectorpublic static void divElements(float[] r, float[] a, float[] b)
r
- a float[] vector for the result.a
- a float[] vectorb
- a float[] vectorpublic static float[][] mulOuter(float[] a, float[] b)
a
- a float[] vector.b
- a float[] vector.public static float[][] mulT(float[][] a, float[][] b, boolean doShowProgress)
a
- a matrix of float[M][N]b
- a matrix of float[M][N]public static float[] mul(float[] v, float scalar)
v
- a float[] vector.scalar
- the value to multiply by.public static void mulElements(float[] r, float[] v, double scalar)
r
- a float[] vector for the resultv
- a float[] vector.scalar
- the value to multiply by.public static void mulElements(double[] r, double[] v, double scalar)
r
- a float[] vector for the resultv
- a float[] vector.scalar
- the value to multiply by.public static void mul(float[][] r, float[][] m, float scalar)
r
- a float[][] matrix that will receive the result.m
- a float[][] matrix.scalar
- the value to multiply bypublic static void mul(float[] r, float[][] a, float[] v) throws java.lang.IllegalArgumentException
a
- a float[][] matrixv
- a float[] vector.public static float[] flatten(float[][] m)
m
- the matrixpublic static float[][] transpose(float[][] m)
m
- a float[][] matrix.public static float[] minmax(float[][] m)
public static float[] minmax(float[] v)
public static float[] minmaxNot0(float[] v)
public static float[] minmaxNot0(float[][] m)
public static float[] abs(float[] v)
a
- float[] vectorpublic static float[] mask(float[] v, float[] mask)
v
- a vector.mask
- a vector of the same size as v, containing non-zero values for all elements in v that are valid.public static float[] add(float[] v, float scalar, float[] mask)
public static void addElements(double[] r, double[] a, double[] b)
public static void addElements(float[] r, float[] a, float[] b)
public static void add(float[][] r, float[][] a, float[][] b)
r
- a float[][] matrix for the result.a
- a float[][] matrix.b
- a float[][] matrix.public static float[] addElements(float[] a, float[] b)
public static float[][] pow(float[][] m, float power)
m
- a float[][] matrix.power
- the exponent to subtract.public static float norm(float[] v)
v
- a float[] matrix.public static void ln(float[] r, float[] v)
r
- a float[] vector for the result.v
- a float[] vector.public static void pow(float[] r, float[] v, float power)
r
- a float[] vector for the result.v
- a float[] vector.power
- the power the exponent.public static void pow(double[] r, double[] v, double power)
r
- a float[] vector for the result.v
- a float[] vector.power
- the power the exponent.public static void pow(float[] r, float[] v, double power)
r
- a float[] vector for the result.v
- a float[] vector.power
- the power the exponent.public static float[] div(float[] v, double divisor)
v
- a float[] vector.divisor
- the value to divide by.public static void divElements(float[][] m, double divisor)
m
- a float[] matrix.divisor
- the value to divide by.public static float[] copy(float[] v)
v
- a float[] vector.public static float[][] copy(float[][] m)
m
- a float[][] matrix.public static void add(float[][] m, double scalar)
m
- a float[][] matrix.scalar
- a scalar to subtract.public static void add(float[][] a, float[][] b) throws java.lang.IllegalArgumentException
m
- a float[][] matrix.n
- a float[][] matrix.public static void sub(float[][] r, float[][] m, float[][] n)
r
- a float[][] matrix for the result.m
- a float[][] matrix.n
- a float[][] matrix.public static void sub(float[][] r, float[][] m, float[] v) throws java.lang.IllegalArgumentException
r
- a float[][] matrix for the result.m
- a float[][] matrix.v
- a float[] vector.public static float[] sub(float[] a, float[] b) throws java.lang.IllegalArgumentException
public static void subElements(float[] r, float[] a, float[] b)
public static void sub(float[] r, float[] a, float scalar)
public static float[] diag(float[][] m)
m
- a float[][] matrix.public static float[][] diag(float[] v)
v
- a float[]public static float[] trunc(float[] v, int n)
v
- a float[] vector.public static float[][] trunc(float[][] m, int n)
m
- a float[][] matrix.public static float[] subset(float[] v, int[] indices)
v
- a float[] vectorindices
- an int[] vector containing the valid indices for the subsetpublic static float[] subset(float[] v, int start)
v
- a float[] vectorstart
- the start index of the setpublic static float[] subset(float[] v, int start, int last)
v
- a float[] vectorstart
- the start index of the setpublic static float[][] subset(float[][] m, int start, int last)
v
- a float[] vectorstart
- the start index of the setpublic static float[][] subset(float[][] m, int[] indices)
m
- a float[][] matrixindices
- an int[] vector containing the valid indices for the subsetpublic static float[][] subsetColumns(float[][] m, int[] indices)
m
- a MxP float[][] matrixindices
- an 1xN int[] vector containing the valid indices for the subsetpublic static float[] col(float[][] m, int n)
m
- a float[][] matrix.n
- the column desired.public static float[][] repmat(float[] a, int n, int m)
public static float[][] repmat(float[][] a, int n, int m)
public static float[][] inverse(float[][] m) throws java.lang.IllegalArgumentException
m
- the matrix to be inverted.java.lang.IllegalArgumentException
- public static int GaussElim(float[] a, float[] x)
a
- a vector containing the matrix of coefficients a1,1...an,n and
also the y's which are called a1,n+1...an,n+1.x
- a vector containingpublic static float determinant(float[][] m)
m
- a 2x2 or 3x3 double[][] matrixpublic static void test() throws java.lang.Exception
public static void sort(float[] indicator, float[] v, float[][] m)
public static int[] sort(float[] v)
v
- a vectorpublic static float pseudoinverse(float[][] JI, float[][] J, double singularLimit) throws BIJException
public static double pseudoinverse(double[][] JI, double[][] J, double singularLimit) throws BIJException
JI
- the inverse of J after the call.J
- the matrix for which the pseudoinverse will be computed.singularLimit,
- the threshold for computed values in the matrix below which they are treated as 0.public static boolean checkinverse(double[][] J, double[][] JI)
|
BIJ API |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |