# Interface MatrixAccess

All Superinterfaces:
Table
All Known Subinterfaces:
Matrix, MatrixTable, SparseMatrix
All Known Implementing Classes:
BidiagonalMatrix, BorderedHessian, ColumnBindMatrix, CongruentMatrix, CorrelationMatrix, CSCSparseMatrix, CSRSparseMatrix, DefaultMatrixStorage, DenseData, DenseMatrix, DiagonalMatrix, DiagonalSum, DOKSparseMatrix, ElementaryOperation, FastKroneckerProduct, FlexibleTable, GivensMatrix, GoldfeldQuandtTrotter, Hessian, HilbertMatrix, ImmutableMatrix, Inverse, Jacobian, KroneckerProduct, LILSparseMatrix, LowerTriangularMatrix, MAT, MatrixRootByDiagonalization, MatthewsDavies, OuterProduct, PermutationMatrix, PositiveDefiniteMatrixByPositiveDiagonal, PositiveSemiDefiniteMatrixNonNegativeDiagonal, Pow, PseudoInverse, ReturnsMatrix, SampleCovariance, SimilarMatrix, SimplexTable, SubMatrixRef, SymmetricKronecker, SymmetricMatrix, TridiagonalMatrix, UpperTriangularMatrix

public interface MatrixAccess extends Table
This interface defines the methods for accessing entries in a matrix. Indices count from 1, e.g., get(1,1). This 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 calling set(int, int, double). Other operations that "change" the matrix actually creates a new and independent copy.
• ## Method Summary

Modifier and Type
Method
Description
double
get(int i, int j)
Get the matrix entry at [i,j].
void
set(int i, int j, double value)
Set the matrix entry at [i,j] to a value.

### Methods inherited from interface dev.nm.misc.datastructure.Table

nCols, nRows
• ## Method Details

• ### set

void set(int i, int j, double value) throws MatrixAccessException
Set the matrix entry at [i,j] to a value. This is the only method that may change a matrix.
Parameters:
i - the row index
j - the column index
value - the value to set A[i,j] to
Throws:
MatrixAccessException - if i or j is out of range
• ### get

double get(int i, int j) throws MatrixAccessException
Get the matrix entry at [i,j].
Parameters:
i - the row index
j - the column index
Returns:
A[i,j]
Throws:
MatrixAccessException - if i or j is out of range