N
- Number typepublic interface SparseNumberVector<N extends Number> extends NumberVector<N>, SparseFeatureVector<N>
Modifier and Type | Interface and Description |
---|---|
static interface |
SparseNumberVector.Factory<V extends SparseNumberVector<N>,N extends Number>
Factory for sparse number vectors: make from a dim-value map.
|
Modifier and Type | Method and Description |
---|---|
byte |
byteValue(int dimension)
Deprecated.
As the vectors are sparse, try to iterate over the sparse
dimensions only, see
iterByteValue(int) . |
double |
doubleValue(int dimension)
Deprecated.
As the vectors are sparse, try to iterate over the sparse
dimensions only, see
iterDoubleValue(int) . |
float |
floatValue(int dimension)
Deprecated.
As the vectors are sparse, try to iterate over the sparse
dimensions only, see
iterFloatValue(int) . |
int |
intValue(int dimension)
Deprecated.
As the vectors are sparse, try to iterate over the sparse
dimensions only, see
iterIntValue(int) . |
int |
iter()
Iterator over non-zero features only, ascendingly.
|
byte |
iterByteValue(int iter)
Get the value of the iterators' current dimension.
|
double |
iterDoubleValue(int iter)
Get the value of the iterators' current dimension.
|
float |
iterFloatValue(int iter)
Get the value of the iterators' current dimension.
|
int |
iterIntValue(int iter)
Get the value of the iterators' current dimension.
|
long |
iterLongValue(int iter)
Get the value of the iterators' current dimension.
|
short |
iterShortValue(int iter)
Get the value of the iterators' current dimension.
|
long |
longValue(int dimension)
Deprecated.
As the vectors are sparse, try to iterate over the sparse
dimensions only, see
iterLongValue(int) . |
void |
setDimensionality(int maxdim)
Update the vector space dimensionality.
|
short |
shortValue(int dimension)
Deprecated.
As the vectors are sparse, try to iterate over the sparse
dimensions only, see
iterShortValue(int) . |
getColumnVector, getValue
getDimensionality, getMax, getMin
iterAdvance, iterDim, iterValid
getDimensionality, toString
int iter()
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.
}
iter
in interface SparseFeatureVector<N extends Number>
void setDimensionality(int maxdim)
maxdim
- New dimensionalitydouble iterDoubleValue(int iter)
iter
- Iteratorfloat iterFloatValue(int iter)
iter
- Iteratorint iterIntValue(int iter)
iter
- Iteratorshort iterShortValue(int iter)
iter
- Iteratorlong iterLongValue(int iter)
iter
- Iteratorbyte iterByteValue(int iter)
iter
- Iterator@Deprecated double doubleValue(int dimension)
iterDoubleValue(int)
.NumberVector
getValue(dim).doubleValue()
, but usually this is much more
efficient due to boxing/unboxing cost.doubleValue
in interface NumberVector<N extends Number>
dimension
- the desired dimension, where 0 ≤ dimension <
this.getDimensionality()
@Deprecated float floatValue(int dimension)
iterFloatValue(int)
.NumberVector
getValue(dim).floatValue()
, but usually this is much more efficient
due to boxing/unboxing cost.floatValue
in interface NumberVector<N extends Number>
dimension
- the desired dimension, where 0 ≤ dimension <
this.getDimensionality()
@Deprecated int intValue(int dimension)
iterIntValue(int)
.NumberVector
getValue(dim).intValue()
, but usually this is much more efficient
due to boxing/unboxing cost.intValue
in interface NumberVector<N extends Number>
dimension
- the desired dimension, where 0 ≤ dimension <
this.getDimensionality()
@Deprecated long longValue(int dimension)
iterLongValue(int)
.NumberVector
getValue(dim).longValue()
, but usually this is much more efficient
due to boxing/unboxing cost.longValue
in interface NumberVector<N extends Number>
dimension
- the desired dimension, where 0 ≤ dimension <
this.getDimensionality()
@Deprecated short shortValue(int dimension)
iterShortValue(int)
.NumberVector
getValue(dim).shortValue()
, but usually this is much more efficient
due to boxing/unboxing cost.shortValue
in interface NumberVector<N extends Number>
dimension
- the desired dimension, where 0 ≤ dimension <
this.getDimensionality()
@Deprecated byte byteValue(int dimension)
iterByteValue(int)
.NumberVector
getValue(dim).byteValue()
, but usually this is much more efficient
due to boxing/unboxing cost.byteValue
in interface NumberVector<N extends Number>
dimension
- the desired dimension, where 0 ≤ dimension <
this.getDimensionality()