|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectsbrt.kernel.math.algebra.AbstractMdMatrix<R,C>
sbrt.kernel.math.algebra.AbstractSmdMatrix<R,C>
sbrt.kernel.math.algebra.HashMatrix<R,C>
R
- the row type.C
- the column type.public class HashMatrix<R,C>
This class is a java.util.LinkedHashMap
based implementation of SmdMatrix.
The hash codes of the provided variables are used extenstively in this
implementation to provide constant-time lookup for internally stored
information.
HashMap
Constructor Summary | |
---|---|
HashMatrix()
Constructs an emtpy HashMatrix with the default
initial capacity (16) and the default load factor (0.75). |
|
HashMatrix(int initialRowCapacity,
int initialColumnCapacity,
float loadFactor)
Constructs an empty HashMatrix with the provided
initial capacities and load factor. |
Method Summary | ||
---|---|---|
int |
columns()
Returns the number of columns in this matrix. |
|
java.util.Set<C> |
getColIndNzEl(java.lang.Object rowIndex)
Returns the set of column indices whose elements are nonzero in the row corresponding to the provided index. |
|
HashMatrix<R,C> |
getColumn(java.lang.Object columnIndex)
Returns the column corresponding to the provided column index. |
|
java.util.Set<C> |
getColumnIndices()
Returns the set of column indices contained in this matrix. |
|
java.lang.Double |
getElement(java.lang.Object rowIndex,
java.lang.Object columnIndex)
Returns the element of this matrix at the provided row and column indices. |
|
HashMatrix<R,C> |
getRow(java.lang.Object rowIndex)
Returns the row corresponding to the provided row index. |
|
java.util.Set<R> |
getRowIndices()
Returns the set of row indices contained in this matrix. |
|
java.util.Set<R> |
getRowIndNzEl(java.lang.Object columnIndex)
Returns the set of row indices whose elements are nonzero in the column corresponding to the provided index. |
|
int |
hashCode()
Returns a content-based hash code for this matrix. |
|
boolean |
isColumnIndex(java.lang.Object obj)
Indicates if the provided object is a column index in this matrix. |
|
boolean |
isRowIndex(java.lang.Object obj)
Indicates if the provided object is a row index in this matrix. |
|
void |
removeColumn(java.lang.Object columnIndex)
Removes the column corresponding to the provided column index. |
|
void |
removeRow(java.lang.Object rowIndex)
Removes the row corresponding to the provided row index. |
|
int |
rows()
Returns the number of rows in this matrix. |
|
|
setElement(X rowIndex,
Y columnIndex,
Z value)
Sets the element at the provided row and column indices to the provided double precision value. |
Methods inherited from class sbrt.kernel.math.algebra.AbstractSmdMatrix |
---|
equals, setElement, setElements, setElements, setElements, toLinearCombs |
Methods inherited from class sbrt.kernel.math.algebra.AbstractMdMatrix |
---|
isEmpty, setElements, toString |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface sbrt.kernel.math.algebra.DoubleMatrixBuilder |
---|
setElements |
Methods inherited from interface sbrt.kernel.math.algebra.Matrix |
---|
isEmpty, toString |
Constructor Detail |
---|
public HashMatrix()
HashMatrix
with the default
initial capacity (16) and the default load factor (0.75).
public HashMatrix(int initialRowCapacity, int initialColumnCapacity, float loadFactor)
HashMatrix
with the provided
initial capacities and load factor.
initialRowCapacity
- the initial row capacity.initialColumnCapacity
- the initial column capacity.loadFactor
- the load factor.Method Detail |
---|
public <X extends R,Y extends C,Z extends java.lang.Double> void setElement(X rowIndex, Y columnIndex, Z value)
X
- a type extending the primary row type.Y
- a type extending the primary column type.Z
- Double.rowIndex
- the row index.columnIndex
- the column index.value
- the double precision element value.public boolean isRowIndex(java.lang.Object obj)
obj
- the potential row index.
true
if the provided object is a row
index in this matrix; false
otherwise.public boolean isColumnIndex(java.lang.Object obj)
obj
- the potential column index.
true
if the provided object is a column
index in this matrix; false
otherwise.public HashMatrix<R,C> getRow(java.lang.Object rowIndex)
rowIndex
- the index of the row to be returned.
public HashMatrix<R,C> getColumn(java.lang.Object columnIndex)
columnIndex
- the index of the column to be returned.
public void removeRow(java.lang.Object rowIndex)
rowIndex
- the index of the row to be removed.public void removeColumn(java.lang.Object columnIndex)
columnIndex
- the index of the column to be removed.public java.lang.Double getElement(java.lang.Object rowIndex, java.lang.Object columnIndex)
rowIndex
- the row index.columnIndex
- the column index.
public java.util.Set<C> getColumnIndices()
public java.util.Set<R> getRowIndices()
public java.util.Set<R> getRowIndNzEl(java.lang.Object columnIndex)
columnIndex
- the column index.
public java.util.Set<C> getColIndNzEl(java.lang.Object rowIndex)
rowIndex
- the row index.
public int rows()
public int columns()
public int hashCode()
hashCode
in interface Matrix<R,C,java.lang.Double>
hashCode
in class AbstractSmdMatrix<R,C>
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |