public class FloatVector extends java.lang.Object implements NumberVector
float[] storage, thus needing approximately half as
much memory as DoubleVector.| Modifier and Type | Class and Description |
|---|---|
static class |
FloatVector.Factory
Factory for float vectors.
|
static class |
FloatVector.ShortSerializer
Serialization class for dense float vectors with up to
Short.MAX_VALUE dimensions, by using a short for storing the
dimensionality. |
static class |
FloatVector.SmallSerializer
Serialization class for dense float vectors with up to 127 dimensions, by
using a byte for storing the dimensionality.
|
static class |
FloatVector.VariableSerializer
Serialization class for variable dimensionality by using VarInt encoding.
|
| Modifier and Type | Field and Description |
|---|---|
static ByteBufferSerializer<FloatVector> |
BYTE_SERIALIZER
Serializer for up to 127 dimensions.
|
static FloatVector.Factory |
FACTORY
Static factory instance.
|
static ByteBufferSerializer<FloatVector> |
SHORT_SERIALIZER
Serializer for up to 2^15-1 dimensions.
|
private float[] |
values
Keeps the values of the float vector.
|
static ByteBufferSerializer<FloatVector> |
VARIABLE_SERIALIZER
Serializer using varint encoding.
|
ATTRIBUTE_SEPARATOR, FIELD, FIELD_1D, FIELD_2D, VARIABLE_LENGTHTYPE| Modifier | Constructor and Description |
|---|---|
|
FloatVector(float[] values)
Create a FloatVector consisting of the given float values.
|
private |
FloatVector(float[] values,
boolean nocopy)
Private constructor.
|
| Modifier and Type | Method and Description |
|---|---|
double |
doubleValue(int dimension)
Returns the value in the specified dimension as double.
|
float |
floatValue(int dimension)
Returns the value in the specified dimension as float.
|
int |
getDimensionality()
The dimensionality of the vector space where of this FeatureVector of V is
an element.
|
java.lang.Float |
getValue(int dimension)
Deprecated.
|
long |
longValue(int dimension)
Returns the value in the specified dimension as long.
|
double[] |
toArray()
Returns a double array copy of this vector.
|
java.lang.String |
toString()
Returns a String representation of the FeatureVector of V as a line that is
suitable to be printed in a sequential file.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitbyteValue, getMax, getMin, intValue, shortValuepublic static final FloatVector.Factory FACTORY
public static final ByteBufferSerializer<FloatVector> BYTE_SERIALIZER
public static final ByteBufferSerializer<FloatVector> SHORT_SERIALIZER
public static final ByteBufferSerializer<FloatVector> VARIABLE_SERIALIZER
private final float[] values
private FloatVector(float[] values,
boolean nocopy)
values - Data valuesnocopy - Flag to re-use the values arraypublic FloatVector(float[] values)
values - the values to be set as values of the float vectorpublic int getDimensionality()
FeatureVectorgetDimensionality in interface FeatureVector<java.lang.Number>getDimensionality in interface SpatialComparable@Deprecated public java.lang.Float getValue(int dimension)
FeatureVectorgetValue in interface FeatureVector<java.lang.Number>getValue in interface NumberVectordimension - the desired dimension, where 0 ≤ dimension ≤
this.getDimensionality()-1public double doubleValue(int dimension)
NumberVectorgetValue(dim).doubleValue(), but usually this is much more
efficient due to boxing/unboxing cost.doubleValue in interface NumberVectordimension - the desired dimension, where 0 ≤ dimension <
this.getDimensionality()public float floatValue(int dimension)
NumberVectorgetValue(dim).floatValue(), but usually this is much more efficient
due to boxing/unboxing cost.floatValue in interface NumberVectordimension - 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 NumberVectordimension - the desired dimension, where 0 ≤ dimension <
this.getDimensionality()public double[] toArray()
NumberVectortoArray in interface NumberVectordouble[]public java.lang.String toString()
FeatureVectortoString in interface FeatureVector<java.lang.Number>toString in class java.lang.ObjectCopyright © 2019 ELKI Development Team. License information.