Package org.apache.sysds.runtime.data
Class SparseRowScalar
- java.lang.Object
-
- org.apache.sysds.runtime.data.SparseRow
-
- org.apache.sysds.runtime.data.SparseRowScalar
-
- All Implemented Interfaces:
Serializable
public final class SparseRowScalar extends SparseRow
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description SparseRowScalar()SparseRowScalar(int ix, double val)
-
Method Summary
All 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.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.doubleget(int col)Gets the value of a specified column.intgetIndex()doublegetValue()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.booleanset(int col, double v)Sets the value of a specified column with awareness of potential overwrites or deletes (set to value zero).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.
-
-
-
Method Detail
-
size
public int size()
Description copied from class:SparseRowGet the number of non-zero values of the sparse row.
-
isEmpty
public boolean isEmpty()
Description copied from class:SparseRowIndicates if the sparse row is empty, i.e., if is has size zero.
-
values
public double[] values()
Description copied from class:SparseRowGet the value array of non-zero entries, co-aligned with the array of indexes.
-
indexes
public int[] indexes()
Description copied from class:SparseRowGet the index array of non-zero entries, co-aligned with the array of values.
-
reset
public 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.
-
set
public 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).
-
add
public boolean add(int col, double v)Description copied from class:SparseRowAdd a value to a specified column with awareness of potential insertions.
-
append
public void append(int col, double v)Description copied from class:SparseRowAppends a value to the end of the sparse row.
-
get
public 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.
-
sort
public 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.
-
compact
public 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.
-
compact
public void compact(double eps)
Description copied from class:SparseRowIn-place compaction of values over eps away from zero; and shifts non-zero entries to the left if necessary.
-
getIndex
public int getIndex()
-
getValue
public double getValue()
-
-