public class ShortVector extends java.lang.Object implements NumberVector
short[] storage.| Modifier and Type | Class and Description |
|---|---|
static class |
ShortVector.Factory
Factory for Short vectors.
|
static class |
ShortVector.ShortSerializer
Serialization class for dense Short vectors with up to
Short.MAX_VALUE dimensions, by using a short for storing the
dimensionality. |
static class |
ShortVector.VariableSerializer
Serialization class for variable dimensionality by using VarInt encoding.
|
| Modifier and Type | Field and Description |
|---|---|
static ByteBufferSerializer<ShortVector> |
SHORT_SERIALIZER
Serializer for up to 2^15-1 dimensions.
|
static ShortVector.Factory |
STATIC
Static instance (object factory).
|
private short[] |
values
Keeps the values of the real vector.
|
static ByteBufferSerializer<ShortVector> |
VARIABLE_SERIALIZER
Serializer using varint encoding.
|
ATTRIBUTE_SEPARATOR, FIELD, FIELD_1D, FIELD_2D, VARIABLE_LENGTHTYPE| Modifier | Constructor and Description |
|---|---|
|
ShortVector(short[] values)
Create an ShortVector consisting of the given Short values.
|
private |
ShortVector(short[] values,
boolean nocopy)
Private constructor.
|
| Modifier and Type | Method and Description |
|---|---|
double |
doubleValue(int dimension)
Returns the value in the specified dimension as double.
|
int |
getDimensionality()
The dimensionality of the vector space where of this FeatureVector of V is
an element.
|
java.lang.Short |
getValue(int dimension)
Deprecated.
|
short[] |
getValues()
Get a copy of the raw short[] array.
|
long |
longValue(int dimension)
Returns the value in the specified dimension as long.
|
short |
shortValue(int dimension)
Returns the value in the specified dimension as short.
|
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, floatValue, getMax, getMin, intValuepublic static final ShortVector.Factory STATIC
public static final ByteBufferSerializer<ShortVector> SHORT_SERIALIZER
public static final ByteBufferSerializer<ShortVector> VARIABLE_SERIALIZER
private final short[] values
private ShortVector(short[] values,
boolean nocopy)
values - Value datanocopy - Flag to use without copying.public ShortVector(short[] values)
values - the values to be set as values of the ShortVectorpublic int getDimensionality()
FeatureVectorgetDimensionality in interface FeatureVector<java.lang.Number>getDimensionality in interface SpatialComparable@Deprecated public java.lang.Short getValue(int dimension)
getValue in interface FeatureVector<java.lang.Number>getValue in interface NumberVectordimension - the selected attribute. Attributes are counted starting
with 0.java.lang.IllegalArgumentException - if the specified dimension is out of range
of the possible attributes
public 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 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 short shortValue(int dimension)
NumberVectorgetValue(dim).shortValue(), but usually this is much more efficient
due to boxing/unboxing cost.shortValue in interface NumberVectordimension - the desired dimension, where 0 ≤ dimension <
this.getDimensionality()public short[] getValues()
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.