public class NaiveMatrix extends java.lang.Object implements DenseMatrix
RowMajorMatrix,
ColumnMajorMatrix| Constructor and Description |
|---|
NaiveMatrix(double[] diag)
Constructor of a square diagonal matrix with the elements of vector diag on the main diagonal.
|
NaiveMatrix(double[][] A)
Constructor.
|
NaiveMatrix(int rows,
int cols)
Constructor of all-zero matrix.
|
NaiveMatrix(int rows,
int cols,
double value)
Constructor.
|
NaiveMatrix(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 |
|---|---|
NaiveMatrix |
aat()
Returns A * A'
|
NaiveMatrix |
abmm(DenseMatrix b)
Returns the result of matrix multiplication A * B.
|
NaiveMatrix |
abtmm(DenseMatrix b)
Returns the result of matrix multiplication A * B'.
|
double |
add(int i,
int j,
double x)
A[i][j] += x
|
double[][] |
array()
Return the two-dimensional array of matrix.
|
NaiveMatrix |
ata()
Returns A' * A
|
NaiveMatrix |
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
|
ColumnMajorMatrix |
copy()
Returns a copy of this matrix.
|
double |
div(int i,
int j,
double x)
A[i][j] /= x
|
static NaiveMatrix |
eye(int n)
Returns an n-by-n identity matrix with ones on the main diagonal and zeros elsewhere.
|
static NaiveMatrix |
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.
|
double |
mul(int i,
int j,
double x)
A[i][j] *= x
|
int |
ncols()
Returns the number of columns.
|
int |
nrows()
Returns the number of rows.
|
double |
set(int i,
int j,
double x)
Set the entry value at row i and column j.
|
double |
sub(int i,
int j,
double x)
A[i][j] -= x
|
java.lang.String |
toString() |
NaiveMatrix |
transpose()
Returns the matrix transpose.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitpublic NaiveMatrix(double[][] A)
A - the array of matrix.public NaiveMatrix(int rows,
int cols)
public NaiveMatrix(int rows,
int cols,
double value)
public NaiveMatrix(double[] diag)
public NaiveMatrix(int rows,
int cols,
double mu,
double sigma)
public static NaiveMatrix eye(int n)
public static NaiveMatrix eye(int m, int n)
public java.lang.String toString()
toString in class java.lang.Objectpublic ColumnMajorMatrix copy()
DenseMatrixcopy in interface DenseMatrixpublic double[][] array()
DenseMatrixarray in interface DenseMatrixpublic 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 NaiveMatrix ata()
Matrixata in interface DenseMatrixata in interface Matrixpublic NaiveMatrix 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 NaiveMatrix abmm(DenseMatrix b)
MatrixMultiplicationabmm in interface MatrixMultiplication<DenseMatrix,DenseMatrix>public NaiveMatrix abtmm(DenseMatrix b)
MatrixMultiplicationabtmm in interface MatrixMultiplication<DenseMatrix,DenseMatrix>public NaiveMatrix atbmm(DenseMatrix b)
MatrixMultiplicationatbmm in interface MatrixMultiplication<DenseMatrix,DenseMatrix>public NaiveMatrix transpose()
transpose in interface DenseMatrixtranspose in interface Matrix