Class SparseRaggedDoubleMatrix<R,C>
java.lang.Object
ubic.basecode.dataStructure.matrix.AbstractMatrix<R,C,Double>
ubic.basecode.dataStructure.matrix.DoubleMatrix<R,C>
ubic.basecode.dataStructure.matrix.SparseRaggedDoubleMatrix<R,C>
- All Implemented Interfaces:
Serializable,Matrix2D<R,,C, Double> PrimitiveMatrix<R,C, Double>
A sparse matrix class where the rows are ragged and compressed.
- Author:
- pavlidis
- See Also:
-
Field Summary
Fields inherited from class ubic.basecode.dataStructure.matrix.AbstractMatrix
MAX_ROWS_TO_PRINT -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddRow(R name, IntArrayList indexes, DoubleArrayList values) voidaddRow(R name, DoubleMatrix1D matrix1D) double[][]asArray()intcolumns()Returns the size of the widest row.copy()Create a deep copy of thisdoubleget(int i, int j) Double[]getColObj(int col) getColRange(int startCol, int endCol) double[]getColumn(int col) getObject(int row, int col) double[]getRow(int i) getRowArrayList(int row) This gives just the list of values in the row - make sure this is what you want.Double[]getRowObj(int i) getRowRange(int startRow, int endRow) booleanisMissing(int i, int j) (non-Javadoc) Note that in a sparse matrix, zero values are considered "missing"!introws()Get the number of rows the matrix hasvoidintsize()subsetColumns(List<C> c) Create a copy of this matrix with only the selected columns, in the selected order.subsetRows(List<R> rowNames) Create a copy of this matrix with only the selected rows, in the selected order.viewColumn(int column) viewRow(int i) Methods inherited from class ubic.basecode.dataStructure.matrix.DoubleMatrix
getByKeys, getColumnByName, getEntry, getRawMatrix, getRowByName, setByKeys, sortByColumnAbsoluteValues, toStringMethods inherited from class ubic.basecode.dataStructure.matrix.AbstractMatrix
addColumnName, addRowName, asDoubles, assign, checkColRange, checkRowRange, containsColumnName, containsRowName, getColIndexByName, getColName, getColNames, getRowIndexByName, getRowName, getRowNameMapIterator, getRowNames, hasColNames, hasMissingValues, hasRow, hasRowNames, numMissing, setColumnName, setColumnNames, setRowName, setRowNamesMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface ubic.basecode.dataStructure.matrix.Matrix2D
addColumnName, asDoubles, assign, containsColumnName, containsRowName, getColIndexByName, getColName, getColNames, getRowIndexByName, getRowName, getRowNameMapIterator, getRowNames, hasColNames, hasRow, hasRowNames, numMissing, setColumnName, setColumnNames, setRowName, setRowNames
-
Constructor Details
-
SparseRaggedDoubleMatrix
public SparseRaggedDoubleMatrix()
-
-
Method Details
-
addRow
- Parameters:
matrix1D-
-
addRow
- Parameters:
name-indexes-values-
-
asArray
public double[][] asArray()- Specified by:
asArrayin classDoubleMatrix<R,C> - Returns:
- double[][]
-
columns
public int columns()Returns the size of the widest row.- Returns:
- int
- See Also:
-
copy
Description copied from class:DoubleMatrixCreate a deep copy of this- Specified by:
copyin classDoubleMatrix<R,C> - Returns:
- a deep copy of this
-
get
public double get(int i, int j) - Specified by:
getin classDoubleMatrix<R,C> - Parameters:
i-j-row-column-- Returns:
-
getColObj
- Parameters:
col-- Returns:
-
getColRange
- Specified by:
getColRangein classDoubleMatrix<R,C> - Parameters:
startCol- inclusive, numbered from zeroendCol- inclusive, numbered from zero- Returns:
- new matrix with just the requested range of columns from this
-
getColumn
public double[] getColumn(int col) - Specified by:
getColumnin classDoubleMatrix<R,C>
-
getObject
- Parameters:
row-col-- Returns:
-
getRow
public double[] getRow(int i) - Specified by:
getRowin classDoubleMatrix<R,C>
-
getRowArrayList
This gives just the list of values in the row - make sure this is what you want. It does not include the zero values.- Specified by:
getRowArrayListin classDoubleMatrix<R,C> - Parameters:
row-- Returns:
-
getRowObj
- Parameters:
i-- Returns:
-
getRowRange
- Specified by:
getRowRangein classDoubleMatrix<R,C> - Parameters:
startRow- inclusive, numbered from zeroendRow- inclusive- Returns:
-
isMissing
public boolean isMissing(int i, int j) (non-Javadoc) Note that in a sparse matrix, zero values are considered "missing"!- Parameters:
i- rowj- column- Returns:
- true if the value is missing, false otherwise.
- See Also:
-
rows
public int rows()Description copied from interface:Matrix2DGet the number of rows the matrix has- Returns:
- int
-
set
- Parameters:
i-j-d-
-
size
public int size()- Specified by:
sizein classAbstractMatrix<R,C, Double>
-
subsetColumns
Description copied from class:DoubleMatrixCreate a copy of this matrix with only the selected columns, in the selected order.- Specified by:
subsetColumnsin classDoubleMatrix<R,C> - Parameters:
c-- Returns:
-
subsetRows
Description copied from class:DoubleMatrixCreate a copy of this matrix with only the selected rows, in the selected order.- Specified by:
subsetRowsin classDoubleMatrix<R,C> - Parameters:
rowNames-- Returns:
-
transpose
- Specified by:
transposein classDoubleMatrix<R,C>
-
viewColumn
- Specified by:
viewColumnin classDoubleMatrix<R,C>
-
viewRow
- Specified by:
viewRowin classDoubleMatrix<R,C> - Parameters:
i-- Returns:
-