|
SuanShu, a Java numerical and statistical library | |||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectcom.numericalmethod.suanshu.matrix.doubles.operation.ImmutableKroneckerProduct
public class ImmutableKroneckerProduct
This immutable version of KroneckerProduct is fast and efficient for
construction and read-only operations. The constructor just copies and stores
the two input matrices, hence, saves much memory space. The accessor method,
get(int, int) computes the requested entry value from the two matrices upon
each call.
However, if the Kronecker product is reused for matrix operations frequently,
the class KroneckerProduct, in which all entries are computed at
construction, should be used instead.
KroneckerProduct| Constructor Summary | |
|---|---|
ImmutableKroneckerProduct(Matrix a,
Matrix b)
Construct a read-only Kronecker product representation. |
|
| Method Summary | |
|---|---|
Matrix |
add(Matrix that)
this + that |
Matrix |
deepCopy()
Return 'this' as this Matrix is immutable. |
double |
get(int row,
int col)
Get the matrix entry at [row, col]. |
Vector |
getColumn(int col)
Get a specified column as a vector. |
Vector |
getRow(int row)
Get a specified row as a vector. |
Matrix |
minus(Matrix that)
this - that |
Matrix |
multiply(Matrix that)
this %*% that |
Vector |
multiply(Vector v)
Right multiply this matrix, A by a vector. |
int |
nCols()
Get the number of columns. |
int |
nRows()
Get the number of rows. |
Matrix |
ONE()
Get an identity matrix that has the same dimension as this matrix. |
Matrix |
opposite()
Get the opposite of this matrix. |
Matrix |
scaled(double scalar)
scalar * this |
void |
set(int row,
int col,
double value)
Set the matrix entry at [row, col] to value. |
Matrix |
t()
t(this)
Compute the transpose of this matrix. |
Matrix |
ZERO()
Get a zero matrix that has the same dimension as this matrix. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ImmutableKroneckerProduct(Matrix a,
Matrix b)
a - a matrixb - another matrix| Method Detail |
|---|
public int nRows()
MatrixDimension
nRows in interface MatrixDimensionpublic int nCols()
MatrixDimension
nCols in interface MatrixDimension
public void set(int row,
int col,
double value)
throws MatrixAccessException
MatrixAccessor[row, col] to value.
This is the only method that may change the entries of a matrix.
set in interface MatrixAccessorrow - the row indexcol - the column indexvalue - the value to set A[row, col] to
MatrixAccessException - if row or col is out of range
public double get(int row,
int col)
throws MatrixAccessException
MatrixAccessor[row, col].
get in interface MatrixAccessorrow - the row indexcol - the column index
A[row, col]
MatrixAccessException - if row or col is out of range
public Vector getRow(int row)
throws MatrixAccessException
MatrixAccessor
getRow in interface MatrixAccessorrow - the row index
A[row, ]
MatrixAccessException - when row < 1, or when row > number of rows
public Vector getColumn(int col)
throws MatrixAccessException
MatrixAccessor
getColumn in interface MatrixAccessorcol - the column index
A[, col]
MatrixAccessException - when col < 1, or when col > number of columnspublic Matrix add(Matrix that)
MatrixRingthis + that
add in interface AbelianGroup<Matrix>add in interface MatrixRingthat - another matrix
this and thatpublic Matrix minus(Matrix that)
MatrixRingthis - that
minus in interface AbelianGroup<Matrix>minus in interface MatrixRingthat - another matrix
this and thatpublic Matrix multiply(Matrix that)
MatrixRingthis %*% that
multiply in interface Monoid<Matrix>multiply in interface MatrixRingthat - another matrix
this and thatpublic Vector multiply(Vector v)
MatrixA by a vector.
multiply in interface Matrixv - a vector
A %*% vpublic Matrix scaled(double scalar)
Matrixscalar * this
scaled in interface Matrixscalar - a double
scalar * thispublic Matrix opposite()
MatrixRing
opposite in interface AbelianGroup<Matrix>opposite in interface MatrixRing-thispublic Matrix ZERO()
MatrixRing
ZERO in interface AbelianGroup<Matrix>ZERO in interface MatrixRingpublic Matrix ONE()
MatrixRingFor a non-square matrix, it zeros out the rows (columns) with index > nCols (nRows).
ONE in interface Monoid<Matrix>ONE in interface MatrixRingpublic Matrix t()
MatrixRingt(this)
Compute the transpose of this matrix. The original matrix does not change. The returned value is independent and can be modified anyhow.
This is the involution on the matrix ring.
t in interface MatrixRingpublic Matrix deepCopy()
Matrix is immutable. To produce a mutable
copy, please use KroneckerProduct.
deepCopy in interface DeepCopyabledeepCopy in interface Matrix
|
SuanShu, a Java numerical and statistical library | |||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||