|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.commons.math.linear.AbstractFieldMatrix<T>
org.apache.commons.math.linear.SparseFieldMatrix<T>
T
- the type of the field elementspublic class SparseFieldMatrix<T extends FieldElement<T>>
Sparse matrix implementation based on an open addressed map.
Field Summary | |
---|---|
private int |
columnDimension
column dimension |
private OpenIntToFieldHashMap<T> |
entries
Storage for (sparse) matrix elements. |
private int |
rowDimension
row dimension |
private static long |
serialVersionUID
Serial id |
Constructor Summary | |
---|---|
SparseFieldMatrix(Field<T> field)
Creates a matrix with no data. |
|
SparseFieldMatrix(Field<T> field,
int rowDimension,
int columnDimension)
Create a new SparseFieldMatrix |
|
SparseFieldMatrix(FieldMatrix<T> other)
Generic copy constructor. |
|
SparseFieldMatrix(SparseFieldMatrix<T> other)
Copy constructor. |
Method Summary | |
---|---|
void |
addToEntry(int row,
int column,
T increment)
Change an entry in the specified row and column. |
private int |
computeKey(int row,
int column)
Compute the key to access a matrix element |
FieldMatrix<T> |
copy()
Returns a (deep) copy of this. |
FieldMatrix<T> |
createMatrix(int rowDimension,
int columnDimension)
Create a new FieldMatrix |
int |
getColumnDimension()
Returns the number of columns in the matrix. |
T |
getEntry(int row,
int column)
Returns the entry in the specified row and column. |
int |
getRowDimension()
Returns the number of rows in the matrix. |
void |
multiplyEntry(int row,
int column,
T factor)
Change an entry in the specified row and column. |
void |
setEntry(int row,
int column,
T value)
Set the entry in the specified row and column. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
private static final long serialVersionUID
private final OpenIntToFieldHashMap<T extends FieldElement<T>> entries
private final int rowDimension
private final int columnDimension
Constructor Detail |
---|
public SparseFieldMatrix(Field<T> field)
field
- field to which the elements belongpublic SparseFieldMatrix(Field<T> field, int rowDimension, int columnDimension) throws java.lang.IllegalArgumentException
field
- field to which the elements belongrowDimension
- the number of rows in the new matrixcolumnDimension
- the number of columns in the new matrix
java.lang.IllegalArgumentException
- if row or column dimension is not positivepublic SparseFieldMatrix(SparseFieldMatrix<T> other)
other
- The instance to copypublic SparseFieldMatrix(FieldMatrix<T> other)
other
- The instance to copyMethod Detail |
---|
public void addToEntry(int row, int column, T increment) throws MatrixIndexException
Row and column indices start at 0 and must satisfy
0 <= row < rowDimension
0 <= column < columnDimension
MatrixIndexException
is thrown.
addToEntry
in interface FieldMatrix<T extends FieldElement<T>>
addToEntry
in class AbstractFieldMatrix<T extends FieldElement<T>>
row
- row location of entry to be setcolumn
- column location of entry to be setincrement
- value to add to the current matrix entry in row,column
MatrixIndexException
- if the row or column index is not validpublic FieldMatrix<T> copy()
copy
in interface FieldMatrix<T extends FieldElement<T>>
copy
in class AbstractFieldMatrix<T extends FieldElement<T>>
public FieldMatrix<T> createMatrix(int rowDimension, int columnDimension) throws java.lang.IllegalArgumentException
createMatrix
in interface FieldMatrix<T extends FieldElement<T>>
createMatrix
in class AbstractFieldMatrix<T extends FieldElement<T>>
rowDimension
- the number of rows in the new matrixcolumnDimension
- the number of columns in the new matrix
java.lang.IllegalArgumentException
- if row or column dimension is not positivepublic int getColumnDimension()
getColumnDimension
in interface AnyMatrix
getColumnDimension
in class AbstractFieldMatrix<T extends FieldElement<T>>
public T getEntry(int row, int column) throws MatrixIndexException
Row and column indices start at 0 and must satisfy
0 <= row < rowDimension
0 <= column < columnDimension
MatrixIndexException
is thrown.
getEntry
in interface FieldMatrix<T extends FieldElement<T>>
getEntry
in class AbstractFieldMatrix<T extends FieldElement<T>>
row
- row location of entry to be fetchedcolumn
- column location of entry to be fetched
MatrixIndexException
- if the row or column index is not validpublic int getRowDimension()
getRowDimension
in interface AnyMatrix
getRowDimension
in class AbstractFieldMatrix<T extends FieldElement<T>>
public void multiplyEntry(int row, int column, T factor) throws MatrixIndexException
Row and column indices start at 0 and must satisfy
0 <= row < rowDimension
0 <= column < columnDimension
MatrixIndexException
is thrown.
multiplyEntry
in interface FieldMatrix<T extends FieldElement<T>>
multiplyEntry
in class AbstractFieldMatrix<T extends FieldElement<T>>
row
- row location of entry to be setcolumn
- column location of entry to be setfactor
- multiplication factor for the current matrix entry in row,column
MatrixIndexException
- if the row or column index is not validpublic void setEntry(int row, int column, T value) throws MatrixIndexException
Row and column indices start at 0 and must satisfy
0 <= row < rowDimension
0 <= column < columnDimension
MatrixIndexException
is thrown.
setEntry
in interface FieldMatrix<T extends FieldElement<T>>
setEntry
in class AbstractFieldMatrix<T extends FieldElement<T>>
row
- row location of entry to be setcolumn
- column location of entry to be setvalue
- matrix entry to be set in row,column
MatrixIndexException
- if the row or column index is not validprivate int computeKey(int row, int column)
row
- row index of the matrix elementcolumn
- column index of the matrix element
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |