public class SparseRow extends Object implements Serializable
Modifier and Type | Field and Description |
---|---|
static int |
initialCapacity |
Constructor and Description |
---|
SparseRow() |
SparseRow(int capacity) |
SparseRow(int estnnz,
int maxnnz) |
SparseRow(SparseRow that) |
Modifier and Type | Method and Description |
---|---|
void |
append(int col,
double v) |
int |
capacity() |
void |
compact()
In-place compaction of non-zero-entries; removes zero entries and
shifts non-zero entries to the left if necessary.
|
void |
copy(SparseRow that) |
void |
deleteIndexRange(int lowerCol,
int upperCol) |
double |
get(int col) |
int[] |
indexes() |
boolean |
isEmpty() |
void |
recap(int newCap) |
void |
reset(int estnns,
int maxnns) |
int |
searchIndexesFirstGT(int col) |
int |
searchIndexesFirstGTE(int col) |
int |
searchIndexesFirstLTE(int col) |
boolean |
set(int col,
double v) |
void |
setIndexes(int[] i) |
void |
setIndexRange(int lowerCol,
int upperCol,
double[] v,
int vix,
int len)
Inserts a dense vector into a column range; calling this methods helps to
avoid repeated shifting of remaining values/indexes for every set value.
|
void |
setSize(int newsize) |
void |
setValues(double[] d) |
int |
size() |
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() |
double[] |
values() |
public static final int initialCapacity
public SparseRow()
public SparseRow(int capacity)
public SparseRow(int estnnz, int maxnnz)
public SparseRow(SparseRow that)
public int size()
public void setSize(int newsize)
public boolean isEmpty()
public double[] values()
public int[] indexes()
public void setValues(double[] d)
public void setIndexes(int[] i)
public int capacity()
public void copy(SparseRow that)
public void reset(int estnns, int maxnns)
public void recap(int newCap)
public void compact()
public boolean set(int col, double v)
public void append(int col, double v)
public double get(int col)
public int searchIndexesFirstLTE(int col)
public int searchIndexesFirstGTE(int col)
public int searchIndexesFirstGT(int col)
public void deleteIndexRange(int lowerCol, int upperCol)
public void setIndexRange(int lowerCol, int upperCol, double[] v, int vix, int len)
lowerCol
- lower column indexupperCol
- upper column indexv
- dense vectorvix
- ?len
- ?public void sort()
Copyright © 2017 The Apache Software Foundation. All rights reserved.