public abstract class SparseRow extends Object implements Serializable
Constructor and Description |
---|
SparseRow() |
Modifier and Type | Method and Description |
---|---|
abstract boolean |
add(int col,
double v)
Add a value to a specified column with awareness of
potential insertions.
|
abstract void |
append(int col,
double v)
Appends a value to the end of the sparse row.
|
abstract void |
compact()
In-place compaction of non-zero-entries; removes zero entries
and shifts non-zero entries to the left if necessary.
|
abstract double |
get(int col)
Gets the value of a specified column.
|
abstract int[] |
indexes()
Get the index array of non-zero entries, co-aligned
with the array of values.
|
abstract boolean |
isEmpty()
Indicates if the sparse row is empty, i.e., if is has
size zero.
|
abstract void |
reset(int estnns,
int maxnns)
Resets the sparse row to empty, after this call size and
isEmpty are guaranteed to return 0 and true, respectively.
|
abstract boolean |
set(int col,
double v)
Sets the value of a specified column with awareness of
potential overwrites or deletes (set to value zero).
|
abstract int |
size()
Get the number of non-zero values of the sparse row.
|
abstract void |
sort()
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.
|
String |
toString() |
abstract double[] |
values()
Get the value array of non-zero entries, co-aligned
with the array of indexes.
|
public abstract int size()
public abstract boolean isEmpty()
public abstract double[] values()
public abstract int[] indexes()
public abstract void reset(int estnns, int maxnns)
estnns
- estimated number of non-zerosmaxnns
- maximum number of non-zeros, e.g., number of columnspublic abstract boolean set(int col, double v)
col
- column index, zero-basedv
- valuepublic abstract boolean add(int col, double v)
col
- column index, zero-basedv
- valuepublic abstract void append(int col, double v)
col
- column index, zero-basedv
- valuepublic abstract double get(int col)
col
- column index, zero-basedpublic abstract void sort()
public abstract void compact()
Copyright © 2018 The Apache Software Foundation. All rights reserved.