public interface Matrix extends MatrixTable, MatrixRing, DeepCopyable
Matrix as a Ring, a Table,
and a few more methods not already defined in its mathematical definition.
The interface is made minimal to avoid listing all possible matrix
operations. Instead, matrix operations are grouped into packages and classes
by their properties. This is to avoid interface "pollution", lengthy and
cumbersome design.
Row and column indices start at 1. A matrix with
nRows() rows and nCols() columns has entries
get(1, 1) through get(nRows(), nCols()). Java arrays passed
into constructors still use ordinary zero-based indexing.
For A.multiply(B), the number of columns of A must equal
the number of rows of B. For A.multiply(v),
A.nCols() == v.size(); the result has A.nRows() entries.
Choose a concrete representation such as
DenseMatrix
to construct data. Check that representation's constructor documentation
before reusing its backing arrays.
| Modifier and Type | Method and Description |
|---|---|
Matrix |
deepCopy()
The implementation returns an instance created from
this by the copy
constructor of the class, or just this if the instance itself is
immutable. |
Vector |
getColumn(int j)
Get the specified column in the matrix as a vector.
|
Vector |
getRow(int i)
Get the specified row in the matrix as a vector.
|
Vector |
multiply(Vector v)
Right multiply this matrix, A, by a vector.
|
Matrix |
scaled(double c)
Scale this matrix, A, by a constant.
|
default String |
toCSV() |
get, setVector multiply(Vector v)
v - a vectorMatrix scaled(double c)
c - a doubleVector getRow(int i) throws MatrixAccessException
i - the row indexMatrixAccessException - when i < 1, or when i >
the number of rowsVector getColumn(int j) throws MatrixAccessException
j - the column indexMatrixAccessException - when j < 1, or when j >
the number of columnsMatrix deepCopy()
DeepCopyablethis by the copy
constructor of the class, or just this if the instance itself is
immutable.deepCopy in interface DeepCopyabledefault String toCSV()
Copyright © 2010-2026 NM Group. All Rights Reserved.