Package elki.data
Interface SparseFeatureVector<D>
-
- All Superinterfaces:
FeatureVector<D>
- All Known Subinterfaces:
SparseNumberVector
- All Known Implementing Classes:
BitVector
,SparseByteVector
,SparseDoubleVector
,SparseFloatVector
,SparseIntegerVector
,SparseShortVector
public interface SparseFeatureVector<D> extends FeatureVector<D>
Extended interface for sparse feature vector types.- Since:
- 0.4.0
- Author:
- Erich Schubert
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface elki.data.FeatureVector
FeatureVector.Factory<V extends FeatureVector<? extends D>,D>
-
-
Field Summary
-
Fields inherited from interface elki.data.FeatureVector
TYPE
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default int
iter()
Iterator over non-zero features only, ascending.default int
iterAdvance(int iter)
Advance the iterator to the next position.int
iterDim(int iter)
Get the dimension an iterator points to.default int
iterRetract(int iter)
Retract the iterator to the next position.boolean
iterValid(int iter)
Test the iterator position for validity.-
Methods inherited from interface elki.data.FeatureVector
getDimensionality, getValue, toString
-
-
-
-
Method Detail
-
iter
default int iter()
Iterator over non-zero features only, ascending.Note: depending on the underlying implementation, this may or may not be the dimension. Use
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. }
- Returns:
- Identifier for the first non-zero dimension, not necessarily the dimension!
-
iterDim
int iterDim(int iter)
Get the dimension an iterator points to.- Parameters:
iter
- Iterator position- Returns:
- Dimension the iterator refers to
-
iterAdvance
default int iterAdvance(int iter)
Advance the iterator to the next position.- Parameters:
iter
- Previous iterator position- Returns:
- Next iterator position
-
iterRetract
default int iterRetract(int iter)
Retract the iterator to the next position.- Parameters:
iter
- Next iterator position- Returns:
- Previous iterator position
-
iterValid
boolean iterValid(int iter)
Test the iterator position for validity.- Parameters:
iter
- Iterator position- Returns:
true
when it refers to a valid position.
-
-