public class FloatVector extends AbstractNumberVector<Float>
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
Modifier | Constructor and Description |
---|---|
|
FloatVector(float[] values)
Provides a FloatVector consisting of the given float values.
|
|
FloatVector(Float[] values)
Provides a FloatVector consisting of the given float values.
|
private |
FloatVector(float[] values,
boolean nocopy)
Private constructor.
|
|
FloatVector(List<Float> values)
Provides a FloatVector consisting of float values according to the given
Float values.
|
|
FloatVector(Vector columnMatrix)
Expects a matrix of one column.
|
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.
|
Float |
getValue(int dimension)
Deprecated.
|
long |
longValue(int dimension)
Returns the value in the specified dimension as long.
|
String |
toString()
Returns a String representation of the FeatureVector of V as a line that is
suitable to be printed in a sequential file.
|
byteValue, floatValue, getMax, getMin, intValue, shortValue
public 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(List<Float> values)
values
- the values to be set as values of the float vectorpublic FloatVector(float[] values)
values
- the values to be set as values of the float vectorpublic FloatVector(Float[] values)
values
- the values to be set as values of the float vectorpublic FloatVector(Vector columnMatrix)
columnMatrix
- a matrix of one columnpublic int getDimensionality()
FeatureVector
@Deprecated public Float getValue(int dimension)
FeatureVector
dimension
- the desired dimension, where 1 ≤ dimension ≤
this.getDimensionality()
public double doubleValue(int dimension)
NumberVector
getValue(dim).doubleValue()
, but usually this is much more
efficient due to boxing/unboxing cost.dimension
- the desired dimension, where 0 ≤ dimension <
this.getDimensionality()
public long longValue(int dimension)
NumberVector
getValue(dim).longValue()
, but usually this is much more efficient
due to boxing/unboxing cost.dimension
- the desired dimension, where 0 ≤ dimension <
this.getDimensionality()
public Vector getColumnVector()
NumberVector
getDimensionality()
rows the values of this NumberVector of V.getDimensionality()
rows the values of this
NumberVector of Vpublic String toString()
FeatureVector
toString
in interface FeatureVector<Float>
toString
in class Object