public class SubMatrixRef extends Object implements Matrix
| Constructor and Description |
|---|
SubMatrixRef(Matrix A)
Constructs a reference to the whole matrix.
|
SubMatrixRef(Matrix A,
int[] rows,
int[] cols)
Constructs a sub-matrix reference.
|
SubMatrixRef(Matrix A,
int rowFrom,
int rowTo,
int colFrom,
int colTo)
Constructs a sub-matrix reference.
|
| Modifier and Type | Method and Description |
|---|---|
Matrix |
add(Matrix that)
this + that
|
SubMatrixRef |
deepCopy()
Returns
this as the reference is immutable. |
double |
get(int i,
int j)
Get the matrix entry at [i,j].
|
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.
|
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()
Gets the number of columns.
|
int |
nRows()
Gets 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)
Scale this matrix, A, by a constant.
|
void |
set(int i,
int j,
double value)
Deprecated.
SubMatrixRef is immutable
|
Matrix |
t()
Get the transpose of this matrix.
|
String |
toString() |
Matrix |
ZERO()
Get a zero matrix that has the same dimension as this matrix.
|
public SubMatrixRef(Matrix A, int[] rows, int[] cols)
A - a matrixrows - the row indicescols - the column indicesIndexOutOfBoundsException - if rowFrom, rowTo, colFrom, or
colTo is invalidpublic SubMatrixRef(Matrix A, int rowFrom, int rowTo, int colFrom, int colTo)
A - a matrixrowFrom - the beginning row indexrowTo - the ending row indexcolFrom - the beginning column indexcolTo - the ending column indexpublic SubMatrixRef(Matrix A)
A - a matrixpublic int nRows()
Tablepublic int nCols()
Tablepublic double get(int i,
int j)
MatrixAccessget in interface MatrixAccessi - the row indexj - the column indexpublic Vector getRow(int i)
Matrixpublic Vector getColumn(int j)
Matrixpublic Matrix add(Matrix that)
MatrixRingadd in interface MatrixRingadd in interface AbelianGroup<Matrix>that - a matrixthis and thatpublic Matrix minus(Matrix that)
MatrixRingminus in interface MatrixRingminus in interface AbelianGroup<Matrix>that - a matrixthis and thatpublic Matrix multiply(Matrix that)
MatrixRingmultiply in interface MatrixRingmultiply in interface Monoid<Matrix>that - a matrixthis and thatpublic Vector multiply(Vector v)
Matrixpublic Matrix scaled(double scalar)
Matrixpublic Matrix opposite()
MatrixRingopposite in interface MatrixRingopposite in interface AbelianGroup<Matrix>public Matrix ZERO()
MatrixRingZERO in interface MatrixRingZERO in interface AbelianGroup<Matrix>public Matrix ONE()
MatrixRingONE in interface MatrixRingONE in interface Monoid<Matrix>public Matrix t()
MatrixRingt in interface MatrixRingpublic SubMatrixRef deepCopy()
this as the reference is immutable.deepCopy in interface MatrixdeepCopy in interface DeepCopyablethis@Deprecated public void set(int i, int j, double value) throws MatrixAccessException
MatrixAccessset in interface MatrixAccessi - the row indexj - the column indexvalue - the value to set A[i,j] toMatrixAccessException - if i or j is out of rangeCopyright © 2010-2020 NM FinTech Ltd.. All Rights Reserved.