
public class SparseFloatVector extends AbstractNumberVector<Float> implements SparseNumberVector<Float>
A SparseFloatVector is to store real values approximately as float values.
A SparseFloatVector only requires storage for those attribute values that are non-zero.| Modifier and Type | Class and Description | 
|---|---|
| static class  | SparseFloatVector.FactoryFactory class. | 
| Modifier and Type | Field and Description | 
|---|---|
| private int | dimensionalityThe dimensionality of this feature vector. | 
| static gnu.trove.map.TIntFloatMap | EMPTYMAPEmpty map. | 
| static SparseFloatVector.Factory | FACTORYStatic instance. | 
| private int[] | indexesIndexes of values. | 
| private float[] | valuesStored values. | 
ATTRIBUTE_SEPARATOR| Constructor and Description | 
|---|
| SparseFloatVector(float[] values)Provides a SparseFloatVector consisting of double values according to the
 specified mapping of indices and values. | 
| SparseFloatVector(int[] indexes,
                 float[] values,
                 int dimensionality)Direct constructor. | 
| SparseFloatVector(gnu.trove.map.TIntFloatMap values,
                 int dimensionality)Provides a SparseFloatVector consisting of double values according to the
 specified mapping of indices and values. | 
| Modifier and Type | Method and Description | 
|---|---|
| double | doubleValue(int dimension)Returns the value in the specified dimension as double. | 
| Vector | getColumnVector()Returns a Vector representing in one column and
  getDimensionality()rows the values of this NumberVector of V. | 
| int | getDimensionality()The dimensionality of the vector space where of this FeatureVector of V is
 an element. | 
| private int | getMaxDim()Get the maximum dimensionality. | 
| BitSet | getNotNullMask()Bit set of non-null features. | 
| Float | getValue(int dimension)Deprecated.  | 
| private double[] | getValues()Returns an array consisting of the values of this feature vector. | 
| long | longValue(int dimension)Returns the value in the specified dimension as long. | 
| void | setDimensionality(int dimensionality)Sets the dimensionality to the new value. | 
| String | toString()
 Provides a String representation of this SparseFloatVector as suitable for
  SparseNumberVectorLabelParser. | 
byteValue, floatValue, getMax, getMin, intValue, shortValueclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitbyteValue, floatValue, intValue, shortValuegetMax, getMinpublic static final SparseFloatVector.Factory FACTORY
private final int[] indexes
private final float[] values
private int dimensionality
public static final gnu.trove.map.TIntFloatMap EMPTYMAP
public SparseFloatVector(int[] indexes,
                 float[] values,
                 int dimensionality)
indexes - Indexes Must be sorted!values - Associated value.dimensionality - "true" dimensionalitypublic SparseFloatVector(gnu.trove.map.TIntFloatMap values,
                 int dimensionality)
                  throws IllegalArgumentException
values - the values to be set as values of the real vectordimensionality - the dimensionality of this feature vectorIllegalArgumentException - if the given dimensionality is too small
         to cover the given values (i.e., the maximum index of any value not
         zero is bigger than the given dimensionality)public SparseFloatVector(float[] values)
                  throws IllegalArgumentException
values - the values to be set as values of the real vectorIllegalArgumentException - if the given dimensionality is too small
         to cover the given values (i.e., the maximum index of any value not
         zero is bigger than the given dimensionality)private int getMaxDim()
public int getDimensionality()
FeatureVectorgetDimensionality in interface FeatureVector<Float>getDimensionality in interface SpatialComparablepublic void setDimensionality(int dimensionality)
                       throws IllegalArgumentException
setDimensionality in interface SparseNumberVector<Float>dimensionality - the new dimensionalityIllegalArgumentException - if the given dimensionality is too small
         to cover the given values (i.e., the maximum index of any value not
         zero is bigger than the given dimensionality)@Deprecated public Float getValue(int dimension)
FeatureVectorgetValue in interface FeatureVector<Float>getValue in interface NumberVector<Float>dimension - the desired dimension, where 1 ≤ dimension ≤
        this.getDimensionality()public double doubleValue(int dimension)
NumberVectorgetValue(dim).doubleValue(), but usually this is much more
 efficient due to boxing/unboxing cost.doubleValue in interface NumberVector<Float>dimension - the desired dimension, where 0 ≤ dimension <
        this.getDimensionality()public long longValue(int dimension)
NumberVectorgetValue(dim).longValue(), but usually this is much more efficient
 due to boxing/unboxing cost.longValue in interface NumberVector<Float>dimension - the desired dimension, where 0 ≤ dimension <
        this.getDimensionality()public Vector getColumnVector()
NumberVectorgetDimensionality() rows the values of this NumberVector of V.getColumnVector in interface NumberVector<Float>getDimensionality() rows the values of this
         NumberVector of Vpublic String toString()
 Provides a String representation of this SparseFloatVector as suitable for
 SparseNumberVectorLabelParser
 .
 
 The returned String is a single line with entries separated by
 AbstractNumberVector.ATTRIBUTE_SEPARATOR. The first entry gives the
 number of values actually not zero. Following entries are pairs of Integer
 and Float where the Integer gives the index of the dimensionality and the
 Float gives the corresponding value.
 
 Example: a vector (0,1.2,1.3,0)T would result in the String
 2 2 1.2 3 1.3
 
toString in interface FeatureVector<Float>toString in class Objectprivate double[] getValues()
public BitSet getNotNullMask()
SparseFeatureVectorgetNotNullMask in interface SparseFeatureVector<Float>