|
SuanShu, a Java numerical and statistical library | |||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
public interface MatrixAccessor
This interface defines methods for accessing elements in a matrix.
Indices count from 1, e.g., get(1,1),
which is what mathematicians (not programmers) are accustomed to.
Invalid access such as using out-of-range indices or altering immutable matrix
will lead to MatrixAccessException.
The only way to change a matrix is by set(int, int, double).
Other operations that "change" the matrix actually creates a new and independent copy.
| Method Summary | |
|---|---|
double |
get(int row,
int col)
Get the matrix entry at [row, col]. |
Vector |
getColumn(int col)
Get a specified column as a vector. |
Vector |
getRow(int row)
Get a specified row as a vector. |
void |
set(int row,
int col,
double value)
Set the matrix entry at [row, col] to value. |
| Method Detail |
|---|
void set(int row,
int col,
double value)
throws MatrixAccessException
[row, col] to value.
This is the only method that may change the entries of a matrix.
row - the row indexcol - the column indexvalue - the value to set A[row, col] to
MatrixAccessException - if row or col is out of range
double get(int row,
int col)
throws MatrixAccessException
[row, col].
row - the row indexcol - the column index
A[row, col]
MatrixAccessException - if row or col is out of range
Vector getRow(int row)
throws MatrixAccessException
row - the row index
A[row, ]
MatrixAccessException - when row < 1, or when row > number of rows
Vector getColumn(int col)
throws MatrixAccessException
col - the column index
A[, col]
MatrixAccessException - when col < 1, or when col > number of columns
|
SuanShu, a Java numerical and statistical library | |||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||