D
- Data typepublic interface SparseFeatureVector<D> extends FeatureVector<D>
FeatureVector.Factory<V extends FeatureVector<? extends D>,D>
Modifier and Type | Method and Description |
---|---|
int |
iter()
Iterator over non-zero features only, ascendingly.
|
int |
iterAdvance(int iter)
Advance the iterator to the next position.
|
int |
iterDim(int iter)
Get the dimension an iterator points to.
|
boolean |
iterValid(int iter)
Test the iterator position for validity.
|
getDimensionality, getValue, toString
int iter()
iterDim(int)
to get the actual dimension. In fact,
usually this will be the ith non-zero value, assuming an array
representation.
Think of this number as an iterator. For efficiency, it has a primitive
type!
Intended usage:
for (int iter = v.iter(); v.iterValid(iter); iter = v.iterAdvance(iter)) {
final int dim = v.iterDim(iter);
// Do something.
}
int iterDim(int iter)
iter
- Iterator positionint iterAdvance(int iter)
iter
- Previous iterator positionboolean iterValid(int iter)
iter
- Iterator positiontrue
when it refers to a valid position.