|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--drasys.or.matrix.RealContainer | +--drasys.or.matrix.Matrix | +--drasys.or.matrix.CompressedMatrix | +--drasys.or.matrix.CompressedRowMatrix
A sparse compressed resizable row-major matrix of double values.
This matrix is efficient for numerical computing, especially row-wise computations.
Its also efficient for adding new rows and new elements to the last row.
The most efficient way to build this matrix is row-wise by adding elements only to the last row.
This reduces the memory copying caused by adding elements at the head of the arrays.
The attribute 'fillInSpace' can be used to reserve some extra elements for each row fill-in is unavoidable.
If the matrix is constructed strictly row-wise then 'fillInSpace' should be set to zero to conserve memory.
There is more detailed information available about the
internal storage format.
References:
Matrix Computations (Johns Hopkins Studies in the Mathematical Sciences)
Gene H. Golub, Charles F. Van Loan (Contributor) / Paperback / Published 1996
Numerical Recipes in C : The Art of Scientific Computing
William H. Press, et al / Hardcover / Published 1993
Parallel Algorithms for Matrix Computations
K.A. Gallivan / Paperback / Published 1990
Fields inherited from class drasys.or.matrix.RealContainer |
_epsilon,
_globalEpsilon |
Constructor Summary | |
CompressedRowMatrix(double[][] array,
int fillInSpace)
Creates a sparse matrix from the contents of 'array'. |
|
CompressedRowMatrix(double[][] array,
int fillInSpace,
double epsilon)
Creates a sparse matrix from the contents of 'array'. |
|
CompressedRowMatrix(int capacityOfRows,
int sizeOfColumns,
int fillInSpace)
Constructs a compressed sparse row-major matrix with an explicit row capacity and column size. |
|
CompressedRowMatrix(int capacityOfRows,
int sizeOfColumns,
int fillInSpace,
int capacityOfElements)
|
|
CompressedRowMatrix(MatrixI matrix,
int fillInSpace)
|
|
CompressedRowMatrix(VectorI vector,
int fillInSpace)
|
Method Summary | |
void |
addColumn(VectorI vector)
Adds a new column and any non-null elements in vector to the end of the matrix . |
void |
addRow(VectorI vector)
Adds a new row and any non-null elements in vector to the end of the matrix . |
void |
buildColumnIndex()
Build the column index structure. |
int |
capacityOfColumns()
Returns the number of columns the matrix can hold without allocating more memory. |
int |
capacityOfRows()
Returns the number of rows the matrix can hold without allocating more memory. |
java.util.Enumeration |
columnElements(int column)
Returns an enumeration of the non-null elements in a column. |
void |
deleteColumnIndex()
Delete the column index structure. |
double |
elementAt(int row,
int column)
Gets an element's value from the matrix. |
java.util.Enumeration |
elements()
Returns an enumeration of the non-null elements in the matrix. |
double[][] |
getArray()
Returns a new two-dimensional array containing the values in matrix. |
int[] |
getColumnEndArray()
Return the array used to indicate the end of each column in the column index. |
int[] |
getColumnIndexArray()
Return the array used to hold the column indices. |
int[] |
getRowBeginArray()
Return the array used to hold the index of the first element in each row. |
int[] |
getRowIndexArray()
Return the array used to hold the row indices for the column index. |
int[] |
getRowSizeArray()
Return the array used to hold the number of elements in each row. |
int[] |
getValueIndexArray()
Return the array used to hold the value indices for the column index. |
boolean |
isColumnMajor()
Returns true if the matrix is column-major. |
boolean |
isNull(int row,
int column)
Returns true if an element has no value associated with it. |
boolean |
isRowMajor()
Returns true if the matrix is row-major. |
java.util.Enumeration |
rowElements(int row)
Returns an enumeration of the non-null elements in a row. |
void |
setCapacity(int capacityOfRows,
int capacityOfColumns)
Allocates memory so the matrix can hold this many rows and columns without reallocating memory. |
void |
setElementAt(int row,
int column,
double value)
Sets an element's value in the matrix. |
void |
setSize(int sizeOfRows,
int sizeOfColumns)
Sets the number of rows and columns in the matrix. |
int |
sizeOfElements()
Returns the number of non-null elements in the matrix. |
double |
sum(int rowBegin,
int rowEnd,
int columnBegin,
int columnEnd)
Returns the sum of all of the elements in the sub-matrix. Computes sum(a[i][j]). Where: i = {rowBegin,...,(rowEnd-1)} j = {columBegin,...,(columnEnd-1)} |
double |
sumOfSquaredDifferences(int rowBegin,
int rowEnd,
int columnBegin,
int columnEnd,
double scaler)
Returns the sum of the squared differences between the elements and a scaler. Computes sum((a[i][j]-scaler)^2). Where: i = {rowBegin,...,(rowEnd-1)} j = {columBegin,...,(columnEnd-1)} |
double |
sumOfSquares(int rowBegin,
int rowEnd,
int columnBegin,
int columnEnd)
Returns the sum of the squares of all of the elements in the sub-matrix. Computes sum(a[i][j]^2). Where: i = {rowBegin,...,(rowEnd-1)} j = {columBegin,...,(columnEnd-1)} |
Methods inherited from class drasys.or.matrix.CompressedMatrix |
getValueArray,
setCapacityOfElements,
setElements,
sizeOfColumns,
sizeOfRows |
Methods inherited from class drasys.or.matrix.Matrix |
equals,
equals,
setColumn,
setDiagonal,
setElements,
setRow,
sum,
sum,
sumOfSquaredDifferences,
sumOfSquaredDifferences,
sumOfSquares,
sumOfSquares,
toString |
Methods inherited from class drasys.or.matrix.RealContainer |
equals,
getEpsilon,
getGlobalEpsilon,
setEpsilon,
setGlobalEpsilon |
Methods inherited from class java.lang.Object |
clone,
finalize,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
Constructor Detail |
public CompressedRowMatrix(int capacityOfRows, int sizeOfColumns, int fillInSpace)
public CompressedRowMatrix(int capacityOfRows, int sizeOfColumns, int fillInSpace, int capacityOfElements)
public CompressedRowMatrix(double[][] array, int fillInSpace)
public CompressedRowMatrix(double[][] array, int fillInSpace, double epsilon)
public CompressedRowMatrix(MatrixI matrix, int fillInSpace)
public CompressedRowMatrix(VectorI vector, int fillInSpace)
Method Detail |
public int sizeOfElements()
public int capacityOfRows()
public int capacityOfColumns()
public int[] getColumnIndexArray()
public int[] getRowSizeArray()
public int[] getRowBeginArray()
public void deleteColumnIndex()
public void buildColumnIndex()
public int[] getRowIndexArray()
public int[] getColumnEndArray()
public int[] getValueIndexArray()
public boolean isRowMajor()
public boolean isColumnMajor()
public void addRow(VectorI vector)
public void addColumn(VectorI vector)
public void setSize(int sizeOfRows, int sizeOfColumns)
public void setCapacity(int capacityOfRows, int capacityOfColumns)
public void setElementAt(int row, int column, double value)
public boolean isNull(int row, int column)
public double elementAt(int row, int column)
public double[][] getArray()
public java.util.Enumeration rowElements(int row)
public java.util.Enumeration columnElements(int column)
public java.util.Enumeration elements()
public double sum(int rowBegin, int rowEnd, int columnBegin, int columnEnd)
public double sumOfSquares(int rowBegin, int rowEnd, int columnBegin, int columnEnd)
public double sumOfSquaredDifferences(int rowBegin, int rowEnd, int columnBegin, int columnEnd, double scaler)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |