public final class DenseMatrix<F extends Field<F>> extends Matrix<F>
This class represents a matrix made of dense
vectors (as rows). To create a dense matrix made of column vectors the
transpose() method can be used.
For example:[code]
DenseVector
As for any concrete structure, this class is declared final (otherwise most
operations would have to be overridden to return the appropriate type).
Specialized dense matrix should sub-class Matrix directly.
For example:[code]
// Extension through composition.
final class TriangularMatrix
| Modifier and Type | Method and Description |
|---|---|
DenseMatrix<F> |
adjoint()
Returns the adjoint of this matrix.
|
F |
cofactor(int i,
int j)
Returns the cofactor of an element in this matrix.
|
DenseMatrix<F> |
copy()
Returns a copy of this matrix
allocated
by the calling thread (possibly on the stack). |
F |
determinant()
Returns the determinant of this matrix.
|
F |
get(int i,
int j)
Returns a single element from this matrix.
|
DenseVector<F> |
getColumn(int j)
Returns the column identified by the specified index in this matrix.
|
DenseVector<F> |
getDiagonal()
Returns the diagonal vector.
|
int |
getNumberOfColumns()
Returns the number of columns
n for this matrix. |
int |
getNumberOfRows()
Returns the number of rows
m for this matrix. |
DenseVector<F> |
getRow(int i)
Returns the row identified by the specified index in this matrix.
|
DenseMatrix<F> |
inverse()
Returns the inverse of this matrix (must be square).
|
DenseMatrix<F> |
minus(Matrix<F> that)
Returns the difference between this matrix and the one specified.
|
DenseMatrix<F> |
opposite()
Returns the negation of this matrix.
|
DenseMatrix<F> |
plus(Matrix<F> that)
Returns the sum of this matrix with the one specified.
|
Matrix<F> |
tensor(Matrix<F> that)
Returns the linear algebraic matrix tensor product of this matrix
and another (Kronecker product).
|
DenseMatrix<F> |
times(F k)
Returns the product of this matrix by the specified factor.
|
DenseMatrix<F> |
times(Matrix<F> that)
Returns the product of this matrix with the one specified.
|
DenseVector<F> |
times(Vector<F> v)
Returns the product of this matrix by the specified vector.
|
DenseMatrix<F> |
transpose()
Returns the transpose of this matrix.
|
static <F extends Field<F>> |
valueOf(DenseVector<F>... rows)
Returns a dense matrix holding the specified row vectors
(column vectors if
transposed). |
static <F extends Field<F>> |
valueOf(F[][] elements)
Returns a dense matrix from the specified 2-dimensional array.
|
static <F extends Field<F>> |
valueOf(List<DenseVector<F>> rows)
Returns a dense matrix holding the row vectors from the specified
collection (column vectors if
transposed). |
static <F extends Field<F>> |
valueOf(Matrix<F> that)
Returns a dense matrix equivalent to the specified matrix.
|
Vector<F> |
vectorization()
Returns the vectorization of this matrix.
|
public static <F extends Field<F>> DenseMatrix<F> valueOf(F[][] elements)
elements - this matrix elements.DimensionException - if rows have different length.DenseMatrixpublic static <F extends Field<F>> DenseMatrix<F> valueOf(DenseVector<F>... rows)
transposed).rows - the row vectors.DimensionException - if the rows do not have the same dimension.public static <F extends Field<F>> DenseMatrix<F> valueOf(List<DenseVector<F>> rows)
transposed).rows - the list of row vectors.DimensionException - if the rows do not have the same dimension.public static <F extends Field<F>> DenseMatrix<F> valueOf(Matrix<F> that)
that - the matrix to convert.that or a dense matrix holding the same elements
as the specified matrix.public int getNumberOfRows()
Matrixm for this matrix.getNumberOfRows in class Matrix<F extends Field<F>>public int getNumberOfColumns()
Matrixn for this matrix.getNumberOfColumns in class Matrix<F extends Field<F>>public F get(int i, int j)
Matrixpublic DenseVector<F> getRow(int i)
Matrixpublic DenseVector<F> getColumn(int j)
Matrixpublic DenseVector<F> getDiagonal()
MatrixgetDiagonal in class Matrix<F extends Field<F>>public DenseMatrix<F> opposite()
Matrixpublic DenseMatrix<F> plus(Matrix<F> that)
Matrixpublic DenseMatrix<F> minus(Matrix<F> that)
Matrixpublic DenseMatrix<F> times(F k)
Matrixpublic DenseVector<F> times(Vector<F> v)
Matrixpublic DenseMatrix<F> times(Matrix<F> that)
Matrixpublic DenseMatrix<F> inverse()
Matrixpublic F determinant()
Matrixdeterminant in class Matrix<F extends Field<F>>public DenseMatrix<F> transpose()
Matrixpublic F cofactor(int i, int j)
Matrixpublic DenseMatrix<F> adjoint()
Matrixpublic Matrix<F> tensor(Matrix<F> that)
MatrixDenseMatrix.public Vector<F> vectorization()
MatrixDenseVector.vectorization in class Matrix<F extends Field<F>>public DenseMatrix<F> copy()
Matrixallocated
by the calling thread (possibly on the stack).