public interface Matrix
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.
| Modifier and Type | Method and Description |
|---|---|
Matrix |
aat()
Returns A * A'
|
default double |
apply(int i,
int j)
Returns the entry value at row i and column j.
|
Matrix |
ata()
Returns A' * A
|
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
|
default double[] |
diag()
Returns the diagonal elements.
|
double |
get(int i,
int j)
Returns the entry value at row i and column j.
|
int |
ncols()
Returns the number of columns.
|
int |
nrows()
Returns the number of rows.
|
default double |
trace()
Returns the matrix trace.
|
Matrix |
transpose()
Returns the matrix transpose.
|
int nrows()
int ncols()
Matrix transpose()
double get(int i,
int j)
default double apply(int i,
int j)
default double[] diag()
default double trace()
Matrix ata()
Matrix aat()
double[] ax(double[] x,
double[] y)
double[] axpy(double[] x,
double[] y)
double[] axpy(double[] x,
double[] y,
double b)
double[] atx(double[] x,
double[] y)
double[] atxpy(double[] x,
double[] y)
double[] atxpy(double[] x,
double[] y,
double b)