|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.astrogrid.matrix.MatrixUtils
public class MatrixUtils
Utility functions that operate on matrices. These are intended to operate in the same fashion as the similarly named MATLAB functions.
Constructor Summary | |
---|---|
MatrixUtils()
|
Method Summary | |
---|---|
static Matrix |
add(double eps,
Matrix q)
|
static no.uib.cipr.matrix.Vector |
add(double d,
no.uib.cipr.matrix.Vector v)
|
static Matrix |
add(Matrix q,
double eps)
|
static AGDenseMatrix |
add(no.uib.cipr.matrix.Matrix a,
no.uib.cipr.matrix.Matrix b)
R = A+B. |
static no.uib.cipr.matrix.Vector |
add(no.uib.cipr.matrix.Vector v,
double d)
|
static no.uib.cipr.matrix.Vector |
add(no.uib.cipr.matrix.Vector a,
no.uib.cipr.matrix.Vector b)
Elementwise addition of vectors. |
static Matrix |
cov(Matrix x)
Forms the covariance matrix. |
static no.uib.cipr.matrix.DenseVector |
delElement(no.uib.cipr.matrix.DenseVector v,
int i)
|
static double |
det(Matrix m)
|
static no.uib.cipr.matrix.Vector |
diag(no.uib.cipr.matrix.Matrix x)
|
static Matrix |
diag(no.uib.cipr.matrix.Vector v)
|
static Matrix |
dirichlet_sample(no.uib.cipr.matrix.Vector m,
int j)
|
static Matrix |
divide(Matrix a,
Matrix b)
Elementwise divide of matrix. |
static no.uib.cipr.matrix.Vector |
divide(no.uib.cipr.matrix.Vector a,
no.uib.cipr.matrix.Vector b)
Elementwise divide of vector. |
static Matrix |
exp(Matrix m)
|
static no.uib.cipr.matrix.Vector |
exp(no.uib.cipr.matrix.Vector v)
|
static Matrix |
eye(int ndim)
produces square identity matrix. |
static Matrix |
eye(int ndim,
double val)
produces square diagonal matrix using val. |
static Matrix |
inv(Matrix a)
|
static Matrix |
log(Matrix m)
|
static no.uib.cipr.matrix.Vector |
log(no.uib.cipr.matrix.Vector v)
|
static no.uib.cipr.matrix.Vector |
max(Matrix im)
|
static double |
max(no.uib.cipr.matrix.Vector iv)
|
static int |
min(no.uib.cipr.matrix.Vector v)
|
static AGDenseMatrix |
mult(no.uib.cipr.matrix.Matrix a,
no.uib.cipr.matrix.Matrix b)
C = AB |
static AGDenseMatrix |
mult(no.uib.cipr.matrix.Matrix a,
no.uib.cipr.matrix.Vector b)
C = AB |
static Matrix |
mult(no.uib.cipr.matrix.Vector a,
no.uib.cipr.matrix.Matrix b)
a*b - treating a as a column vector. |
static Matrix |
multABAT(no.uib.cipr.matrix.Matrix a,
no.uib.cipr.matrix.Matrix b)
C = A*B*AT |
static AGDenseMatrix |
multAt(no.uib.cipr.matrix.Matrix a,
no.uib.cipr.matrix.Matrix b)
C = ATB |
static AGDenseMatrix |
multAt(no.uib.cipr.matrix.Vector v,
no.uib.cipr.matrix.Matrix b)
C = ATB. |
static Matrix |
multATBA(no.uib.cipr.matrix.DenseVector v,
no.uib.cipr.matrix.Matrix b)
C = AT*B*A |
static AGDenseMatrix |
multBt(no.uib.cipr.matrix.Matrix a,
no.uib.cipr.matrix.Matrix b)
C = ABT |
static Matrix |
ones(int n)
|
static Matrix |
ones(int n,
int m)
|
static Matrix |
pow(Matrix m,
double exp)
raise each member to the power. |
static no.uib.cipr.matrix.Vector |
pow(no.uib.cipr.matrix.Vector v,
double exp)
|
static double |
psi(double d)
|
static Matrix |
psi(Matrix m)
|
static Matrix |
rand(int i,
int j)
|
static Matrix |
recip(double a,
Matrix m)
Form the elementwise a/mij. |
static no.uib.cipr.matrix.Vector |
recip(double a,
no.uib.cipr.matrix.Vector v)
Form the elementwise a/vi. |
static Matrix |
recip(Matrix m)
|
static no.uib.cipr.matrix.Vector |
recip(no.uib.cipr.matrix.Vector v)
|
static Matrix |
repmat(Matrix v,
int ni,
int nj)
|
static Matrix |
repmat(no.uib.cipr.matrix.Vector v,
int ni,
int nj)
Repeat a vector into a matrix treating the vector as a column vector. |
static Matrix |
repmatt(no.uib.cipr.matrix.Vector v,
int ni,
int nj)
Repeat a vector into a matrix treating the vector as a row vector. |
static Matrix |
repmatv(no.uib.cipr.matrix.Vector v,
int ni,
int nj)
|
static AGDenseMatrix |
reshape(Matrix m,
int ni,
int nj)
|
static AGDenseMatrix |
reshape(no.uib.cipr.matrix.Vector v,
int ni,
int nj)
|
static no.uib.cipr.matrix.Vector |
seq(int n)
Return a vector filled with a sequence from 1 to n; |
static no.uib.cipr.matrix.Vector |
sub(double d,
no.uib.cipr.matrix.Vector v)
R= d-v = elementwise subtraction. |
static Matrix |
sub(no.uib.cipr.matrix.Matrix a,
double b)
|
static Matrix |
sub(no.uib.cipr.matrix.Matrix a,
no.uib.cipr.matrix.Matrix b)
R = A-B. |
static no.uib.cipr.matrix.Vector |
sub(no.uib.cipr.matrix.Vector v,
double d)
|
static no.uib.cipr.matrix.Vector |
sub(no.uib.cipr.matrix.Vector a,
no.uib.cipr.matrix.Vector b)
Elementwise difference of vectors. |
static no.uib.cipr.matrix.Vector |
sum(Matrix m)
|
static no.uib.cipr.matrix.Vector |
sum(Matrix x,
int dim)
|
static double |
sum(no.uib.cipr.matrix.Vector v)
|
static Matrix |
sumsq(Matrix m)
produces a matrix which is the sum of the squares of each row. |
static Matrix |
times(double b,
Matrix a)
|
static no.uib.cipr.matrix.Vector |
times(double b,
no.uib.cipr.matrix.Vector a)
Elementwise product of vectors and double |
static Matrix |
times(Matrix a,
double b)
|
static Matrix |
times(no.uib.cipr.matrix.Matrix a,
no.uib.cipr.matrix.Matrix b)
Elementwise multiply of matrix. |
static no.uib.cipr.matrix.Vector |
times(no.uib.cipr.matrix.Vector a,
double b)
Elementwise product of vectors and double |
static no.uib.cipr.matrix.Vector |
times(no.uib.cipr.matrix.Vector a,
no.uib.cipr.matrix.Vector b)
Elementwise product of vectors. |
static double |
trace(Matrix m)
|
static AGDenseMatrix |
transpose(no.uib.cipr.matrix.Matrix a)
|
static Matrix |
vprod(no.uib.cipr.matrix.Vector a)
Forms the vector product of the two vectors -i.e. |
static Matrix |
vprod(no.uib.cipr.matrix.Vector a,
no.uib.cipr.matrix.Vector b)
Forms the vector product of the two vectors -i.e. |
static AGDenseMatrix |
zeros(int n)
|
static AGDenseMatrix |
zeros(int n,
int m)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public MatrixUtils()
Method Detail |
---|
public static Matrix cov(Matrix x)
x
-
public static AGDenseMatrix zeros(int n)
public static AGDenseMatrix zeros(int n, int m)
public static Matrix ones(int n)
public static Matrix ones(int n, int m)
public static no.uib.cipr.matrix.Vector sum(Matrix x, int dim)
public static double sum(no.uib.cipr.matrix.Vector v)
public static no.uib.cipr.matrix.Vector sum(Matrix m)
public static no.uib.cipr.matrix.Vector diag(no.uib.cipr.matrix.Matrix x)
public static Matrix diag(no.uib.cipr.matrix.Vector v)
public static Matrix repmatv(no.uib.cipr.matrix.Vector v, int ni, int nj)
public static Matrix repmat(Matrix v, int ni, int nj)
public static Matrix repmat(no.uib.cipr.matrix.Vector v, int ni, int nj)
v
- ni
- nj
-
public static Matrix repmatt(no.uib.cipr.matrix.Vector v, int ni, int nj)
v
- ni
- nj
-
public static AGDenseMatrix reshape(Matrix m, int ni, int nj)
public static AGDenseMatrix reshape(no.uib.cipr.matrix.Vector v, int ni, int nj)
public static double det(Matrix m)
public static double trace(Matrix m)
public static Matrix divide(Matrix a, Matrix b)
a
- b
-
public static Matrix times(no.uib.cipr.matrix.Matrix a, no.uib.cipr.matrix.Matrix b)
a
- b
-
public static no.uib.cipr.matrix.Vector divide(no.uib.cipr.matrix.Vector a, no.uib.cipr.matrix.Vector b)
a
- b
-
public static no.uib.cipr.matrix.Vector add(no.uib.cipr.matrix.Vector a, no.uib.cipr.matrix.Vector b)
a
- b
-
public static no.uib.cipr.matrix.Vector times(no.uib.cipr.matrix.Vector a, no.uib.cipr.matrix.Vector b)
a
- b
-
public static no.uib.cipr.matrix.Vector times(no.uib.cipr.matrix.Vector a, double b)
a
- b
-
public static no.uib.cipr.matrix.Vector times(double b, no.uib.cipr.matrix.Vector a)
a
- b
-
public static Matrix times(double b, Matrix a)
public static Matrix times(Matrix a, double b)
public static no.uib.cipr.matrix.Vector sub(no.uib.cipr.matrix.Vector a, no.uib.cipr.matrix.Vector b)
a
- b
-
public static Matrix inv(Matrix a)
public static AGDenseMatrix mult(no.uib.cipr.matrix.Matrix a, no.uib.cipr.matrix.Matrix b)
a
- b
-
public static AGDenseMatrix mult(no.uib.cipr.matrix.Matrix a, no.uib.cipr.matrix.Vector b)
a
- b
-
public static AGDenseMatrix multBt(no.uib.cipr.matrix.Matrix a, no.uib.cipr.matrix.Matrix b)
a
- b
-
public static AGDenseMatrix multAt(no.uib.cipr.matrix.Matrix a, no.uib.cipr.matrix.Matrix b)
a
- b
-
public static Matrix multABAT(no.uib.cipr.matrix.Matrix a, no.uib.cipr.matrix.Matrix b)
a
- b
-
public static Matrix multATBA(no.uib.cipr.matrix.DenseVector v, no.uib.cipr.matrix.Matrix b)
a
- b
-
public static Matrix mult(no.uib.cipr.matrix.Vector a, no.uib.cipr.matrix.Matrix b)
a
- b
-
public static AGDenseMatrix multAt(no.uib.cipr.matrix.Vector v, no.uib.cipr.matrix.Matrix b)
a
- b
-
public static AGDenseMatrix add(no.uib.cipr.matrix.Matrix a, no.uib.cipr.matrix.Matrix b)
a
- b
-
public static no.uib.cipr.matrix.Vector add(no.uib.cipr.matrix.Vector v, double d)
public static no.uib.cipr.matrix.Vector add(double d, no.uib.cipr.matrix.Vector v)
public static Matrix add(Matrix q, double eps)
public static Matrix add(double eps, Matrix q)
public static Matrix sub(no.uib.cipr.matrix.Matrix a, no.uib.cipr.matrix.Matrix b)
a
- b
-
public static Matrix sub(no.uib.cipr.matrix.Matrix a, double b)
public static no.uib.cipr.matrix.Vector sub(double d, no.uib.cipr.matrix.Vector v)
d
- v
-
public static no.uib.cipr.matrix.Vector sub(no.uib.cipr.matrix.Vector v, double d)
public static Matrix eye(int ndim, double val)
ndim
- val
- - the value to put on the diagonal.
public static Matrix eye(int ndim)
ndim
- - the dimension of the matrix
public static AGDenseMatrix transpose(no.uib.cipr.matrix.Matrix a)
public static double max(no.uib.cipr.matrix.Vector iv)
public static no.uib.cipr.matrix.Vector max(Matrix im)
public static Matrix rand(int i, int j)
public static Matrix dirichlet_sample(no.uib.cipr.matrix.Vector m, int j)
public static Matrix psi(Matrix m)
public static double psi(double d)
public static Matrix log(Matrix m)
public static Matrix exp(Matrix m)
public static no.uib.cipr.matrix.Vector exp(no.uib.cipr.matrix.Vector v)
public static no.uib.cipr.matrix.Vector log(no.uib.cipr.matrix.Vector v)
public static Matrix pow(Matrix m, double exp)
m
- exp
-
public static no.uib.cipr.matrix.Vector pow(no.uib.cipr.matrix.Vector v, double exp)
public static Matrix recip(Matrix m)
public static no.uib.cipr.matrix.Vector recip(no.uib.cipr.matrix.Vector v)
public static Matrix recip(double a, Matrix m)
m
- a
-
public static no.uib.cipr.matrix.Vector recip(double a, no.uib.cipr.matrix.Vector v)
m
- a
-
public static Matrix sumsq(Matrix m)
m
-
public static no.uib.cipr.matrix.Vector seq(int n)
n
-
public static Matrix vprod(no.uib.cipr.matrix.Vector a, no.uib.cipr.matrix.Vector b)
a
- b
-
public static Matrix vprod(no.uib.cipr.matrix.Vector a)
a
- b
-
public static no.uib.cipr.matrix.DenseVector delElement(no.uib.cipr.matrix.DenseVector v, int i)
public static int min(no.uib.cipr.matrix.Vector v)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |