|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectedu.northwestern.at.utils.math.matrix.AbstractMatrix
edu.northwestern.at.utils.math.matrix.SparseMatrix
public class SparseMatrix
Implements a sparse matrix using a hash map.
| Field Summary | |
|---|---|
protected java.util.HashMap |
matrixData
The matrix contents as a two-dimensional array of doubles. |
| Fields inherited from class edu.northwestern.at.utils.math.matrix.AbstractMatrix |
|---|
columns, rows |
| Constructor Summary | |
|---|---|
protected |
SparseMatrix()
Don't allow instantiation without size specification. |
|
SparseMatrix(int rows,
int columns)
Create a matrix of the specified size. |
| Method Summary | |
|---|---|
double |
get(int row,
int column)
Gets value of element at given row and column. |
int |
getUsed()
|
void |
set(int row,
int column,
double value)
Set an element at the given position to a new value. |
| Methods inherited from class edu.northwestern.at.utils.math.matrix.AbstractMatrix |
|---|
columns, get, getColumn, getColumnData, getColumns, getColumns, getCopy, getRow, getRowData, getRows, getRows, getSubMatrix, getSubMatrix, getSubMatrix, getSubMatrix, rows, set, set, setColumn, setColumnData, setColumnData, setRow, setRowData, toString |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface edu.northwestern.at.utils.math.matrix.Matrix |
|---|
columns, get, getColumn, getColumnData, getColumns, getColumns, getCopy, getRow, getRowData, getRows, getRows, getSubMatrix, getSubMatrix, getSubMatrix, getSubMatrix, rows, set, set, setColumn, setColumnData, setColumnData, setRow, setRowData, toString |
| Field Detail |
|---|
protected java.util.HashMap matrixData
| Constructor Detail |
|---|
protected SparseMatrix()
public SparseMatrix(int rows,
int columns)
rows - Number of rows.columns - Number of columns.
Each element of the result matrix will be set to zero.
| Method Detail |
|---|
public void set(int row,
int column,
double value)
set in interface Matrixset in class AbstractMatrixrow - Row in which the element occurs.column - Column in which the element occurs.value - The new value to be set.
Note: only non-zero values are stored.
public double get(int row,
int column)
get in interface Matrixget in class AbstractMatrixrow - Row in which the element occurs.column - Column in which the element occurs.
public int getUsed()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||