public class JMatrix extends DenseMatrix
| Constructor and Description |
|---|
JMatrix(double[] A)
Constructor of a column vector/matrix with given array as the internal storage.
|
JMatrix(double[][] A)
Constructor.
|
JMatrix(int rows,
int cols)
Constructor of all-zero matrix.
|
JMatrix(int rows,
int cols,
double value)
Constructor.
|
JMatrix(int rows,
int cols,
double[] value)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
JMatrix |
aat()
Returns A * A'
|
JMatrix |
abmm(DenseMatrix B)
Returns the result of matrix multiplication A * B.
|
JMatrix |
abtmm(DenseMatrix B)
Returns the result of matrix multiplication A * B'.
|
JMatrix |
add(DenseMatrix b)
In place addition A = A + B
|
DenseMatrix |
add(DenseMatrix b,
DenseMatrix c)
C = A + B
|
JMatrix |
add(double x)
In place element-wise addition A = A + x
|
DenseMatrix |
add(double x,
DenseMatrix c)
Element-wise addition C = A + x
|
JMatrix |
add(double x,
JMatrix c) |
double |
add(int i,
int j,
double x)
A[i][j] += x
|
JMatrix |
add(JMatrix b) |
JMatrix |
add(JMatrix b,
JMatrix c) |
JMatrix |
ata()
Returns A' * A
|
JMatrix |
atbmm(DenseMatrix B)
Returns the result of matrix multiplication A' * B.
|
double[] |
atx(double[] x,
double[] y)
y = A' * x
|
double[] |
atxpy(double[] x,
double[] y)
y = A' * x + y
|
double[] |
atxpy(double[] x,
double[] y,
double b)
y = A' * x + b * y
|
double[] |
ax(double[] x,
double[] y)
y = A * x
|
double[] |
axpy(double[] x,
double[] y)
y = A * x + y
|
double[] |
axpy(double[] x,
double[] y,
double b)
y = A * x + b * y
|
Cholesky |
cholesky()
Cholesky decomposition for symmetric and positive definite matrix.
|
JMatrix |
copy()
Returns a copy of this matrix.
|
double[] |
data()
Returns the array of storing the matrix.
|
JMatrix |
div(DenseMatrix b)
In place element-wise division A = A / B
A = A - B
|
DenseMatrix |
div(DenseMatrix b,
DenseMatrix c)
C = A / B
|
JMatrix |
div(double x)
In place element-wise division A = A / x
|
DenseMatrix |
div(double x,
DenseMatrix c)
Element-wise addition C = A / x
|
JMatrix |
div(double x,
JMatrix c) |
double |
div(int i,
int j,
double x)
A[i][j] /= x
|
JMatrix |
div(JMatrix b) |
JMatrix |
div(JMatrix b,
JMatrix c) |
double[] |
eig()
Returns the eigen values in an array of size 2N.
|
EVD |
eigen()
Returns the eigen value decomposition.
|
double |
get(int i,
int j)
Returns the entry value at row i and column j.
|
int |
ld()
The LDA (and LDB, LDC, etc.) parameter in BLAS is effectively
the stride of the matrix as it is laid out in linear memory.
|
LU |
lu()
LU decomposition is computed by a "left-looking", dot-product, Crout/Doolittle algorithm.
|
JMatrix |
mul(DenseMatrix b)
In place element-wise multiplication A = A * B
|
DenseMatrix |
mul(DenseMatrix b,
DenseMatrix c)
C = A * B
|
JMatrix |
mul(double x)
In place element-wise multiplication A = A * x
|
DenseMatrix |
mul(double x,
DenseMatrix c)
Element-wise addition C = A * x
|
JMatrix |
mul(double x,
JMatrix c) |
double |
mul(int i,
int j,
double x)
A[i][j] *= x
|
JMatrix |
mul(JMatrix b) |
JMatrix |
mul(JMatrix b,
JMatrix c) |
int |
ncols()
Returns the number of columns.
|
int |
nrows()
Returns the number of rows.
|
QR |
qr()
QR Decomposition is computed by Householder reflections.
|
JMatrix |
replaceNaN(double x)
Replaces NaN's with given value.
|
double |
set(int i,
int j,
double x)
Set the entry value at row i and column j.
|
protected static void |
sort(double[] d,
double[] e)
Sort eigenvalues.
|
protected static void |
sort(double[] d,
double[] e,
DenseMatrix V)
Sort eigenvalues and eigenvectors.
|
JMatrix |
sub(DenseMatrix b)
In place subtraction A = A - B
|
DenseMatrix |
sub(DenseMatrix b,
DenseMatrix c)
C = A - B
|
JMatrix |
sub(double x)
In place element-wise subtraction A = A - x
|
DenseMatrix |
sub(double x,
DenseMatrix c)
Element-wise addition C = A - x
|
JMatrix |
sub(double x,
JMatrix c) |
double |
sub(int i,
int j,
double x)
A[i][j] -= x
|
JMatrix |
sub(JMatrix b) |
JMatrix |
sub(JMatrix b,
JMatrix c) |
double |
sum()
Returns the sum of all elements in the matrix.
|
SVD |
svd()
Returns the singular value decomposition.
|
JMatrix |
transpose()
Returns the matrix transpose.
|
array, cholesky, colMeans, colSums, eig, eigen, inverse, inverse, lu, norm, norm1, norm2, normFro, normInf, qr, rowMeans, rowSums, svd, update, xaxapply, diag, diag, eigen, eigen, eye, eye, isSymmetric, newInstance, newInstance, newInstance, ones, randn, randn, setSymmetric, svd, svd, toString, toString, trace, zerospublic JMatrix(double[][] A)
A - the array of matrix.public JMatrix(double[] A)
A - the array of column vector.public JMatrix(int rows,
int cols)
public JMatrix(int rows,
int cols,
double value)
public JMatrix(int rows,
int cols,
double[] value)
value - the array of matrix values arranged in column major formatpublic JMatrix copy()
DenseMatrixcopy in class DenseMatrixpublic double[] data()
DenseMatrixdata in class DenseMatrixpublic JMatrix transpose()
DenseMatrixtranspose in class DenseMatrixpublic int nrows()
Matrixpublic int ncols()
Matrixpublic int ld()
DenseMatrixld in class DenseMatrixpublic double get(int i,
int j)
Matrixpublic double set(int i,
int j,
double x)
DenseMatrixset in class DenseMatrixpublic double add(int i,
int j,
double x)
DenseMatrixadd in class DenseMatrixpublic double sub(int i,
int j,
double x)
DenseMatrixsub in class DenseMatrixpublic double mul(int i,
int j,
double x)
DenseMatrixmul in class DenseMatrixpublic double div(int i,
int j,
double x)
DenseMatrixdiv in class DenseMatrixpublic JMatrix add(DenseMatrix b)
DenseMatrixadd in class DenseMatrixpublic DenseMatrix add(DenseMatrix b, DenseMatrix c)
DenseMatrixadd in class DenseMatrixpublic JMatrix sub(DenseMatrix b)
DenseMatrixsub in class DenseMatrixpublic DenseMatrix sub(DenseMatrix b, DenseMatrix c)
DenseMatrixsub in class DenseMatrixpublic JMatrix mul(DenseMatrix b)
DenseMatrixmul in class DenseMatrixpublic DenseMatrix mul(DenseMatrix b, DenseMatrix c)
DenseMatrixmul in class DenseMatrixpublic JMatrix div(DenseMatrix b)
DenseMatrixdiv in class DenseMatrixpublic DenseMatrix div(DenseMatrix b, DenseMatrix c)
DenseMatrixdiv in class DenseMatrixpublic JMatrix add(double x)
DenseMatrixadd in class DenseMatrixpublic DenseMatrix add(double x, DenseMatrix c)
DenseMatrixadd in class DenseMatrixpublic JMatrix sub(double x)
DenseMatrixsub in class DenseMatrixpublic DenseMatrix sub(double x, DenseMatrix c)
DenseMatrixsub in class DenseMatrixpublic JMatrix mul(double x)
DenseMatrixmul in class DenseMatrixpublic DenseMatrix mul(double x, DenseMatrix c)
DenseMatrixmul in class DenseMatrixpublic JMatrix div(double x)
DenseMatrixdiv in class DenseMatrixpublic DenseMatrix div(double x, DenseMatrix c)
DenseMatrixdiv in class DenseMatrixpublic JMatrix replaceNaN(double x)
DenseMatrixreplaceNaN in class DenseMatrixpublic double sum()
DenseMatrixsum in class DenseMatrixpublic JMatrix ata()
Matrixata in class DenseMatrixpublic JMatrix aat()
Matrixaat in class DenseMatrixpublic double[] ax(double[] x,
double[] y)
Matrixpublic double[] axpy(double[] x,
double[] y)
Matrixpublic double[] axpy(double[] x,
double[] y,
double b)
Matrixpublic double[] atx(double[] x,
double[] y)
Matrixpublic double[] atxpy(double[] x,
double[] y)
Matrixpublic double[] atxpy(double[] x,
double[] y,
double b)
Matrixpublic JMatrix abmm(DenseMatrix B)
MatrixMultiplicationpublic JMatrix abtmm(DenseMatrix B)
MatrixMultiplicationpublic JMatrix atbmm(DenseMatrix B)
MatrixMultiplicationpublic LU lu()
lu in class DenseMatrixpublic Cholesky cholesky()
cholesky in class DenseMatrixjava.lang.IllegalArgumentException - if the matrix is not positive definite.public QR qr()
qr in class DenseMatrixpublic SVD svd()
DenseMatrixsvd in class DenseMatrixpublic double[] eig()
DenseMatrixeig in class DenseMatrixpublic EVD eigen()
DenseMatrixeigen in class DenseMatrixprotected static void sort(double[] d,
double[] e)
protected static void sort(double[] d,
double[] e,
DenseMatrix V)