Interface SparseNumberVector
-
- All Superinterfaces:
FeatureVector<java.lang.Number>,NumberVector,SparseFeatureVector<java.lang.Number>,SpatialComparable
- All Known Implementing Classes:
BitVector,SparseByteVector,SparseDoubleVector,SparseFloatVector,SparseIntegerVector,SparseShortVector
public interface SparseNumberVector extends NumberVector, SparseFeatureVector<java.lang.Number>
Combines the SparseFeatureVector and NumberVector.- Since:
- 0.4.0
- Author:
- Erich Schubert
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interfaceSparseNumberVector.Factory<V extends SparseNumberVector>Factory for sparse number vectors: make from a dim-value map.
-
Field Summary
Fields Modifier and Type Field Description static VectorFieldTypeInformation<SparseNumberVector>FIELDInput data type: Sparse vector field.static VectorTypeInformation<SparseNumberVector>VARIABLE_LENGTHInput data type: Sparse vectors with variable length.-
Fields inherited from interface elki.data.FeatureVector
TYPE
-
Fields inherited from interface elki.data.NumberVector
ATTRIBUTE_SEPARATOR, FIELD_1D, FIELD_2D
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Deprecated Methods Modifier and Type Method Description default bytebyteValue(int dimension)Deprecated.As the vectors are sparse, try to iterate over the sparse dimensions only, seeiterByteValue(int).doubledoubleValue(int dimension)Deprecated.As the vectors are sparse, try to iterate over the sparse dimensions only, seeiterDoubleValue(int).default floatfloatValue(int dimension)Deprecated.As the vectors are sparse, try to iterate over the sparse dimensions only, seeiterFloatValue(int).default intintValue(int dimension)Deprecated.As the vectors are sparse, try to iterate over the sparse dimensions only, seeiterIntValue(int).default intiter()Iterator over non-zero features only, ascendingly.default byteiterByteValue(int iter)Get the value of the iterators' current dimension.doubleiterDoubleValue(int iter)Get the value of the iterators' current dimension.default floatiterFloatValue(int iter)Get the value of the iterators' current dimension.default intiterIntValue(int iter)Get the value of the iterators' current dimension.longiterLongValue(int iter)Get the value of the iterators' current dimension.default shortiterShortValue(int iter)Get the value of the iterators' current dimension.longlongValue(int dimension)Deprecated.As the vectors are sparse, try to iterate over the sparse dimensions only, seeiterLongValue(int).voidsetDimensionality(int maxdim)Update the vector space dimensionality.default shortshortValue(int dimension)Deprecated.As the vectors are sparse, try to iterate over the sparse dimensions only, seeiterShortValue(int).-
Methods inherited from interface elki.data.FeatureVector
getDimensionality, toString
-
Methods inherited from interface elki.data.NumberVector
getMax, getMin, getValue, toArray
-
Methods inherited from interface elki.data.SparseFeatureVector
iterAdvance, iterDim, iterRetract, iterValid
-
Methods inherited from interface elki.data.spatial.SpatialComparable
getDimensionality
-
-
-
-
Field Detail
-
VARIABLE_LENGTH
static final VectorTypeInformation<SparseNumberVector> VARIABLE_LENGTH
Input data type: Sparse vectors with variable length.
-
FIELD
static final VectorFieldTypeInformation<SparseNumberVector> FIELD
Input data type: Sparse vector field.
-
-
Method Detail
-
iter
default int iter()
Iterator over non-zero features only, ascendingly.Note: depending on the underlying implementation, this may or may not be the dimension. Use
SparseFeatureVector.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); final double val = v.iterDoubleValue(iter); // Do something. }- Specified by:
iterin interfaceSparseFeatureVector<java.lang.Number>- Returns:
- Identifier for the first non-zero dimension, not necessarily the dimension!
-
setDimensionality
void setDimensionality(int maxdim)
Update the vector space dimensionality.- Parameters:
maxdim- New dimensionality
-
iterDoubleValue
double iterDoubleValue(int iter)
Get the value of the iterators' current dimension.- Parameters:
iter- Iterator- Returns:
- Value at the current position
-
iterFloatValue
default float iterFloatValue(int iter)
Get the value of the iterators' current dimension.- Parameters:
iter- Iterator- Returns:
- Value at the current position
-
iterIntValue
default int iterIntValue(int iter)
Get the value of the iterators' current dimension.- Parameters:
iter- Iterator- Returns:
- Value at the current position
-
iterShortValue
default short iterShortValue(int iter)
Get the value of the iterators' current dimension.- Parameters:
iter- Iterator- Returns:
- Value at the current position
-
iterLongValue
long iterLongValue(int iter)
Get the value of the iterators' current dimension.- Parameters:
iter- Iterator- Returns:
- Value at the current position
-
iterByteValue
default byte iterByteValue(int iter)
Get the value of the iterators' current dimension.- Parameters:
iter- Iterator- Returns:
- Value at the current position
-
doubleValue
@Deprecated double doubleValue(int dimension)
Deprecated.As the vectors are sparse, try to iterate over the sparse dimensions only, seeiterDoubleValue(int).Description copied from interface:NumberVectorReturns the value in the specified dimension as double.Note: this might seem redundant with respect to
getValue(dim).doubleValue(), but usually this is much more efficient due to boxing/unboxing cost.- Specified by:
doubleValuein interfaceNumberVector- Parameters:
dimension- the desired dimension, where 0 ≤ dimension <this.getDimensionality()- Returns:
- the value in the specified dimension
-
floatValue
@Deprecated default float floatValue(int dimension)
Deprecated.As the vectors are sparse, try to iterate over the sparse dimensions only, seeiterFloatValue(int).Description copied from interface:NumberVectorReturns the value in the specified dimension as float.Note: this might seem redundant with respect to
getValue(dim).floatValue(), but usually this is much more efficient due to boxing/unboxing cost.- Specified by:
floatValuein interfaceNumberVector- Parameters:
dimension- the desired dimension, where 0 ≤ dimension <this.getDimensionality()- Returns:
- the value in the specified dimension
-
intValue
@Deprecated default int intValue(int dimension)
Deprecated.As the vectors are sparse, try to iterate over the sparse dimensions only, seeiterIntValue(int).Description copied from interface:NumberVectorReturns the value in the specified dimension as int.Note: this might seem redundant with respect to
getValue(dim).intValue(), but usually this is much more efficient due to boxing/unboxing cost.- Specified by:
intValuein interfaceNumberVector- Parameters:
dimension- the desired dimension, where 0 ≤ dimension <this.getDimensionality()- Returns:
- the value in the specified dimension
-
longValue
@Deprecated long longValue(int dimension)
Deprecated.As the vectors are sparse, try to iterate over the sparse dimensions only, seeiterLongValue(int).Description copied from interface:NumberVectorReturns the value in the specified dimension as long.Note: this might seem redundant with respect to
getValue(dim).longValue(), but usually this is much more efficient due to boxing/unboxing cost.- Specified by:
longValuein interfaceNumberVector- Parameters:
dimension- the desired dimension, where 0 ≤ dimension <this.getDimensionality()- Returns:
- the value in the specified dimension
-
shortValue
@Deprecated default short shortValue(int dimension)
Deprecated.As the vectors are sparse, try to iterate over the sparse dimensions only, seeiterShortValue(int).Description copied from interface:NumberVectorReturns the value in the specified dimension as short.Note: this might seem redundant with respect to
getValue(dim).shortValue(), but usually this is much more efficient due to boxing/unboxing cost.- Specified by:
shortValuein interfaceNumberVector- Parameters:
dimension- the desired dimension, where 0 ≤ dimension <this.getDimensionality()- Returns:
- the value in the specified dimension
-
byteValue
@Deprecated default byte byteValue(int dimension)
Deprecated.As the vectors are sparse, try to iterate over the sparse dimensions only, seeiterByteValue(int).Description copied from interface:NumberVectorReturns the value in the specified dimension as byte.Note: this might seem redundant with respect to
getValue(dim).byteValue(), but usually this is much more efficient due to boxing/unboxing cost.- Specified by:
byteValuein interfaceNumberVector- Parameters:
dimension- the desired dimension, where 0 ≤ dimension <this.getDimensionality()- Returns:
- the value in the specified dimension
-
-