public abstract class IMatrix<T>
extends java.lang.Object
implements java.lang.Cloneable, java.io.Serializable
A matrix is a rectangular array of numbers. An item in a matrix is called an entry or an element. Entries are often denoted by a variable with two subscripts. Matrices of the same size can be added and subtracted entrywise and matrices of compatible size can be multiplied. These operations have many of the properties of ordinary arithmetic, except that matrix multiplication is not commutative, that is, AB and BA are not equal in general.
Matrices are a key tool in linear algebra. One use of matrices is to represent linear transformations and matrix multiplication corresponds to composition of linear transformations. Matrices can also keep track of the coefficients in a system of linear equations. For a square matrix, the determinant and inverse matrix (when it exists) govern the behavior of solutions to the corresponding system of linear equations, and eigenvalues and eigenvectors provide insight into the geometry of the associated linear transformation.
There are several methods to render matrices into a more easily accessible form. They are generally referred to as matrix transformation or matrix decomposition techniques. The interest of all these decomposition techniques is that they preserve certain properties of the matrices in question, such as determinant, rank or inverse, so that these quantities can be calculated after applying the transformation, or that certain matrix operations are algorithmically easier to carry out for some types of matrices.
The LU decomposition factors matrices as a product of lower (L) and an upper triangular matrices (U). Once this decomposition is calculated, linear systems can be solved more efficiently, by a simple technique called forward and back substitution. Likewise, inverses of triangular matrices are algorithmically easier to calculate. The QR decomposition factors matrices as a product of an orthogonal (Q) and a right triangular matrix (R). QR decomposition is often used to solve the linear least squares problem, and is the basis for a particular eigenvalue algorithm, the QR algorithm. Singular value decomposition expresses any matrix A as a product UDV', where U and V are unitary matrices and D is a diagonal matrix. The eigendecomposition or diagonalization expresses A as a product VDV-1, where D is a diagonal matrix and V is a suitable invertible matrix. If A can be written in this form, it is called diagonalizable.
| Constructor and Description |
|---|
IMatrix() |
| Modifier and Type | Method and Description |
|---|---|
java.lang.String |
colName(int i)
Returns the name of i-th column.
|
java.lang.String[] |
colNames()
Returns the column names.
|
void |
colNames(java.lang.String[] names)
Sets the column names.
|
abstract T |
mv(T x)
Returns the matrix-vector multiplication A * x.
|
abstract void |
mv(T work,
int inputOffset,
int outputOffset)
Matrix-vector multiplication A * x.
|
abstract void |
mv(T x,
T y)
Matrix-vector multiplication y = A * x.
|
abstract int |
ncols()
Returns the number of columns.
|
abstract int |
nrows()
Returns the number of rows.
|
java.lang.String |
rowName(int i)
Returns the name of i-th row.
|
java.lang.String[] |
rowNames()
Returns the row names.
|
void |
rowNames(java.lang.String[] names)
Sets the row names.
|
abstract long |
size()
Returns the number of stored matrix elements.
|
java.lang.String |
toString() |
java.lang.String |
toString(boolean full)
Returns the string representation of matrix.
|
java.lang.String |
toString(int m,
int n)
Returns the string representation of matrix.
|
abstract T |
tv(T x)
Returns Matrix-vector multiplication A' * x.
|
abstract void |
tv(T work,
int inputOffset,
int outputOffset)
Matrix-vector multiplication A' * x.
|
abstract void |
tv(T x,
T y)
Matrix-vector multiplication y = A' * x.
|
public abstract int nrows()
public abstract int ncols()
public abstract long size()
public java.lang.String[] rowNames()
public void rowNames(java.lang.String[] names)
public java.lang.String rowName(int i)
public java.lang.String[] colNames()
public java.lang.String colName(int i)
public void colNames(java.lang.String[] names)
public java.lang.String toString()
toString in class java.lang.Objectpublic java.lang.String toString(boolean full)
full - Print the full matrix if true. Otherwise,
print only top left 7 x 7 submatrix.public java.lang.String toString(int m,
int n)
m - the number of rows to print.n - the number of columns to print.public abstract void mv(T work, int inputOffset, int outputOffset)
work - the workspace for both input and output vector.inputOffset - the offset of input vector in workspace.outputOffset - the offset of output vector in workspace.public abstract void tv(T work, int inputOffset, int outputOffset)
work - the workspace for both input and output vector.inputOffset - the offset of input vector in workspace.outputOffset - the offset of output vector in workspace.