public class RowMajorMatrix extends java.lang.Object implements DenseMatrix
| Constructor and Description |
|---|
RowMajorMatrix(double[] diag)
Constructor of a square diagonal matrix with the elements of vector diag on the main diagonal.
|
RowMajorMatrix(double[][] A)
Constructor.
|
RowMajorMatrix(int rows,
int cols)
Constructor of all-zero matrix.
|
RowMajorMatrix(int rows,
int cols,
double value)
Constructor.
|
RowMajorMatrix(int rows,
int cols,
double[] value)
Constructor.
|
RowMajorMatrix(int rows,
int cols,
double mu,
double sigma)
Constructor of matrix with normal random values with given mean and standard dev.
|
| Modifier and Type | Method and Description |
|---|---|
RowMajorMatrix |
aat()
Returns A * A'
|
RowMajorMatrix |
abmm(DenseMatrix B)
Returns the result of matrix multiplication A * B.
|
RowMajorMatrix |
abtmm(DenseMatrix B)
Returns the result of matrix multiplication A * B'.
|
RowMajorMatrix |
add(double x)
In place element-wise addition A = A + x
|
double |
add(int i,
int j,
double x)
A[i][j] += x
|
RowMajorMatrix |
add(RowMajorMatrix b) |
RowMajorMatrix |
ata()
Returns A' * A
|
RowMajorMatrix |
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
|
RowMajorMatrix |
copy()
Returns a copy of this matrix.
|
RowMajorMatrix |
div(double x)
In place element-wise division A = A / x
|
double |
div(int i,
int j,
double x)
A[i][j] /= x
|
RowMajorMatrix |
div(RowMajorMatrix b) |
static RowMajorMatrix |
eye(int n)
Returns an n-by-n identity matrix with ones on the main diagonal and zeros elsewhere.
|
static RowMajorMatrix |
eye(int m,
int n)
Returns an n-by-n identity matrix with ones on the main diagonal and zeros elsewhere.
|
double |
get(int i,
int j)
Returns the entry value at row i and column j.
|
RowMajorMatrix |
mul(double x)
In place element-wise multiplication A = A * x
|
double |
mul(int i,
int j,
double x)
A[i][j] *= x
|
RowMajorMatrix |
mul(RowMajorMatrix b) |
int |
ncols()
Returns the number of columns.
|
int |
nrows()
Returns the number of rows.
|
RowMajorMatrix |
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.
|
RowMajorMatrix |
sub(double x)
In place element-wise subtraction A = A - x
|
double |
sub(int i,
int j,
double x)
A[i][j] -= x
|
RowMajorMatrix |
sub(RowMajorMatrix b) |
double |
sum()
Returns the sum of all elements in the matrix.
|
java.lang.String |
toString() |
ColumnMajorMatrix |
transpose()
Returns the transpose that shares the same underlying array
with this matrix.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitpublic RowMajorMatrix(double[][] A)
A - the array of matrix.public RowMajorMatrix(int rows,
int cols)
public RowMajorMatrix(int rows,
int cols,
double value)
public RowMajorMatrix(int rows,
int cols,
double[] value)
value - the array of matrix values arranged in row major formatpublic RowMajorMatrix(double[] diag)
public RowMajorMatrix(int rows,
int cols,
double mu,
double sigma)
public static RowMajorMatrix eye(int n)
public static RowMajorMatrix eye(int m, int n)
public java.lang.String toString()
toString in class java.lang.Objectpublic RowMajorMatrix copy()
DenseMatrixcopy in interface DenseMatrixpublic ColumnMajorMatrix transpose()
transpose in interface DenseMatrixtranspose in interface Matrixpublic int nrows()
Matrixpublic int ncols()
Matrixpublic double get(int i,
int j)
Matrixpublic double set(int i,
int j,
double x)
DenseMatrixset in interface DenseMatrixpublic double add(int i,
int j,
double x)
DenseMatrixadd in interface DenseMatrixpublic double sub(int i,
int j,
double x)
DenseMatrixsub in interface DenseMatrixpublic double mul(int i,
int j,
double x)
DenseMatrixmul in interface DenseMatrixpublic double div(int i,
int j,
double x)
DenseMatrixdiv in interface DenseMatrixpublic RowMajorMatrix add(RowMajorMatrix b)
public RowMajorMatrix sub(RowMajorMatrix b)
public RowMajorMatrix mul(RowMajorMatrix b)
public RowMajorMatrix div(RowMajorMatrix b)
public RowMajorMatrix add(double x)
DenseMatrixadd in interface DenseMatrixpublic RowMajorMatrix sub(double x)
DenseMatrixsub in interface DenseMatrixpublic RowMajorMatrix mul(double x)
DenseMatrixmul in interface DenseMatrixpublic RowMajorMatrix div(double x)
DenseMatrixdiv in interface DenseMatrixpublic RowMajorMatrix replaceNaN(double x)
DenseMatrixreplaceNaN in interface DenseMatrixpublic double sum()
DenseMatrixsum in interface DenseMatrixpublic RowMajorMatrix ata()
Matrixata in interface DenseMatrixata in interface Matrixpublic RowMajorMatrix aat()
Matrixaat in interface DenseMatrixaat in interface Matrixpublic 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 RowMajorMatrix abmm(DenseMatrix B)
MatrixMultiplicationabmm in interface MatrixMultiplication<DenseMatrix,DenseMatrix>public RowMajorMatrix abtmm(DenseMatrix B)
MatrixMultiplicationabtmm in interface MatrixMultiplication<DenseMatrix,DenseMatrix>public RowMajorMatrix atbmm(DenseMatrix B)
MatrixMultiplicationatbmm in interface MatrixMultiplication<DenseMatrix,DenseMatrix>