Package org.ejml.data
Interface MatrixSparse
- All Superinterfaces:
Matrix,ReshapeMatrix,Serializable
- All Known Subinterfaces:
DMatrixSparse,FMatrixSparse
- All Known Implementing Classes:
DMatrixSparseCSC,DMatrixSparseTriplet,FMatrixSparseCSC,FMatrixSparseTriplet
High level interface for all sparse matrices
-
Method Summary
Modifier and TypeMethodDescriptionintReturns the number of non-zero elements.booleanisAssigned(int row, int col) Is the specified element explicitly assigned a valuevoidPrints to standard out the non-zero elements only.voidremove(int row, int col) If the specified element is non-zero it is removed from the structurevoidreshape(int numRows, int numCols) Changes the number of rows and columns in the matrix.voidreshape(int numRows, int numCols, int arrayLength) Reshapes the matrix so that it can store a matrix with the specified dimensions and the number of non-zero elements.voidReduces the size of internal data structures to their minimal size.voidzero()Sets all elements to zero by removing the sparse graphMethods inherited from interface org.ejml.data.Matrix
copy, create, createLike, getNumCols, getNumRows, getType, print, print, setTo
-
Method Details
-
printNonZero
void printNonZero()Prints to standard out the non-zero elements only. -
reshape
void reshape(int numRows, int numCols, int arrayLength) Reshapes the matrix so that it can store a matrix with the specified dimensions and the number of non-zero elements. The reshaped matrix will be empty.- Parameters:
numRows- number of rowsnumCols- number of columnsarrayLength- Array length for storing non-zero elements.
-
reshape
void reshape(int numRows, int numCols) Changes the number of rows and columns in the matrix. The graph structure is flushed and the matrix will be empty/all zeros. Similar toreshape(int, int, int), but the storage for non-zero elements is not changed- Specified by:
reshapein interfaceReshapeMatrix- Parameters:
numRows- number of rowsnumCols- number of columns
-
shrinkArrays
void shrinkArrays()Reduces the size of internal data structures to their minimal size. No information is lost but the arrays will change -
remove
void remove(int row, int col) If the specified element is non-zero it is removed from the structure- Parameters:
row- the rowcol- the column
-
isAssigned
boolean isAssigned(int row, int col) Is the specified element explicitly assigned a value- Parameters:
row- the rowcol- the column- Returns:
- true if it has been assigned a value or false if not
-
zero
void zero()Sets all elements to zero by removing the sparse graph -
getNonZeroLength
int getNonZeroLength()Returns the number of non-zero elements.
-