Package org.apache.sysds.runtime.data
Class SparseRowVector
- java.lang.Object
- 
- org.apache.sysds.runtime.data.SparseRow
- 
- org.apache.sysds.runtime.data.SparseRowVector
 
 
- 
- All Implemented Interfaces:
- Serializable
 
 public final class SparseRowVector extends SparseRow - See Also:
- Serialized Form
 
- 
- 
Field SummaryFields Modifier and Type Field Description static intinitialCapacity
 - 
Constructor SummaryConstructors Constructor Description SparseRowVector()SparseRowVector(double[] v)Sparse row vector constructor that take a dense array, and allocate sparsely by ignoring zero valuesSparseRowVector(int capacity)SparseRowVector(int nnz, double[] v, int vlen)SparseRowVector(int estnnz, int maxnnz)SparseRowVector(SparseRow that)
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanadd(int col, double v)Add a value to a specified column with awareness of potential insertions.voidappend(int col, double v)Appends a value to the end of the sparse row.intcapacity()voidcompact()In-place compaction of non-zero-entries; removes zero entries and shifts non-zero entries to the left if necessary.voidcompact(double eps)In-place compaction of values over eps away from zero; and shifts non-zero entries to the left if necessary.voidcopy(SparseRow that)voiddeleteIndexRange(int lowerCol, int upperCol)doubleget(int col)Gets the value of a specified column.intgetIndex(int col)int[]indexes()Get the index array of non-zero entries, co-aligned with the array of values.booleanisEmpty()Indicates if the sparse row is empty, i.e., if is has size zero.voidreset(int estnns, int maxnns)Resets the sparse row to empty, after this call size and isEmpty are guaranteed to return 0 and true, respectively.intsearchIndexesFirstGT(int col)intsearchIndexesFirstGTE(int col)intsearchIndexesFirstLTE(int col)booleanset(int col, double v)Sets the value of a specified column with awareness of potential overwrites or deletes (set to value zero).voidsetAtPos(int pos, int col, double v)voidsetIndexes(int[] i)voidsetIndexRange(int cl, int cu, double[] v, int[] vix, int vpos, int vlen)voidsetIndexRange(int cl, int cu, double[] v, int vix, int vlen)voidsetSize(int newsize)voidsetValues(double[] d)intsize()Get the number of non-zero values of the sparse row.voidsort()In-place sort of column-index value pairs in order to allow binary search after constant-time append was used for reading unordered sparse rows.double[]values()Get the value array of non-zero entries, co-aligned with the array of indexes.
 
- 
- 
- 
Field Detail- 
initialCapacitypublic static final int initialCapacity - See Also:
- Constant Field Values
 
 
- 
 - 
Constructor Detail- 
SparseRowVectorpublic SparseRowVector() 
 - 
SparseRowVectorpublic SparseRowVector(int capacity) 
 - 
SparseRowVectorpublic SparseRowVector(int nnz, double[] v, int vlen)
 - 
SparseRowVectorpublic SparseRowVector(double[] v) Sparse row vector constructor that take a dense array, and allocate sparsely by ignoring zero values- Parameters:
- v- The dense row
 
 - 
SparseRowVectorpublic SparseRowVector(int estnnz, int maxnnz)
 - 
SparseRowVectorpublic SparseRowVector(SparseRow that) 
 
- 
 - 
Method Detail- 
sizepublic int size() Description copied from class:SparseRowGet the number of non-zero values of the sparse row.
 - 
setSizepublic void setSize(int newsize) 
 - 
isEmptypublic boolean isEmpty() Description copied from class:SparseRowIndicates if the sparse row is empty, i.e., if is has size zero.
 - 
valuespublic double[] values() Description copied from class:SparseRowGet the value array of non-zero entries, co-aligned with the array of indexes.
 - 
indexespublic int[] indexes() Description copied from class:SparseRowGet the index array of non-zero entries, co-aligned with the array of values.
 - 
setValuespublic void setValues(double[] d) 
 - 
setIndexespublic void setIndexes(int[] i) 
 - 
capacitypublic int capacity() 
 - 
copypublic void copy(SparseRow that) 
 - 
resetpublic void reset(int estnns, int maxnns)Description copied from class:SparseRowResets the sparse row to empty, after this call size and isEmpty are guaranteed to return 0 and true, respectively.
 - 
setpublic boolean set(int col, double v)Description copied from class:SparseRowSets the value of a specified column with awareness of potential overwrites or deletes (set to value zero).
 - 
setAtPospublic void setAtPos(int pos, int col, double v)
 - 
addpublic boolean add(int col, double v)Description copied from class:SparseRowAdd a value to a specified column with awareness of potential insertions.
 - 
appendpublic void append(int col, double v)Description copied from class:SparseRowAppends a value to the end of the sparse row.
 - 
getpublic double get(int col) Description copied from class:SparseRowGets the value of a specified column. If the column index does not exist in the sparse row, this call returns zero.
 - 
getIndexpublic int getIndex(int col) 
 - 
searchIndexesFirstLTEpublic int searchIndexesFirstLTE(int col) 
 - 
searchIndexesFirstGTEpublic int searchIndexesFirstGTE(int col) 
 - 
searchIndexesFirstGTpublic int searchIndexesFirstGT(int col) 
 - 
deleteIndexRangepublic void deleteIndexRange(int lowerCol, int upperCol)
 - 
setIndexRangepublic void setIndexRange(int cl, int cu, double[] v, int vix, int vlen)
 - 
setIndexRangepublic void setIndexRange(int cl, int cu, double[] v, int[] vix, int vpos, int vlen)
 - 
sortpublic void sort() Description copied from class:SparseRowIn-place sort of column-index value pairs in order to allow binary search after constant-time append was used for reading unordered sparse rows. We first check if already sorted and subsequently sort if necessary in order to get O(n) best case. Note: In-place sort is necessary in order to guarantee the memory estimate for operations that implicitly read that data set.
 - 
compactpublic void compact() Description copied from class:SparseRowIn-place compaction of non-zero-entries; removes zero entries and shifts non-zero entries to the left if necessary.
 
- 
 
-