public class ByteVector extends java.lang.Object implements NumberVector
byte[]
storage.Modifier and Type | Class and Description |
---|---|
static class |
ByteVector.Factory
Factory for Byte vectors.
|
static class |
ByteVector.ShortSerializer
Serialization class for dense Byte vectors with up to
Short.MAX_VALUE dimensions, by using a short for storing the
dimensionality. |
static class |
ByteVector.SmallSerializer
Serialization class for dense Byte vectors with up to 127 dimensions, by
using a byte for storing the dimensionality.
|
Modifier and Type | Field and Description |
---|---|
static ByteBufferSerializer<ByteVector> |
BYTE_SERIALIZER
Serializer for up to 127 dimensions.
|
static ByteBufferSerializer<ByteVector> |
SHORT_SERIALIZER
Serializer for up to 2^15-1 dimensions.
|
static ByteVector.Factory |
STATIC
Static instance (object factory).
|
private byte[] |
values
Keeps the values of the real vector.
|
ATTRIBUTE_SEPARATOR, FIELD, FIELD_1D, FIELD_2D, VARIABLE_LENGTH
TYPE
Modifier | Constructor and Description |
---|---|
|
ByteVector(byte[] values)
Create an ByteVector consisting of the given Byte values.
|
private |
ByteVector(byte[] values,
boolean nocopy)
Private constructor.
|
Modifier and Type | Method and Description |
---|---|
byte |
byteValue(int dimension)
Returns the value in the specified dimension as byte.
|
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.Byte |
getValue(int dimension)
Deprecated.
|
byte[] |
getValues()
Get a copy of the raw byte[] array.
|
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, wait
floatValue, getMax, getMin, intValue, shortValue
public static final ByteVector.Factory STATIC
public static final ByteBufferSerializer<ByteVector> BYTE_SERIALIZER
public static final ByteBufferSerializer<ByteVector> SHORT_SERIALIZER
private final byte[] values
private ByteVector(byte[] values, boolean nocopy)
values
- Value datanocopy
- Flag to use without copying.public ByteVector(byte[] values)
values
- the values to be set as values of the ByteVectorpublic int getDimensionality()
FeatureVector
getDimensionality
in interface FeatureVector<java.lang.Number>
getDimensionality
in interface SpatialComparable
@Deprecated public java.lang.Byte getValue(int dimension)
FeatureVector
getValue
in interface FeatureVector<java.lang.Number>
getValue
in interface NumberVector
dimension
- the desired dimension, where 0 ≤ dimension ≤
this.getDimensionality()-1
public double doubleValue(int dimension)
NumberVector
getValue(dim).doubleValue()
, but usually this is much more
efficient due to boxing/unboxing cost.doubleValue
in interface NumberVector
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.longValue
in interface NumberVector
dimension
- the desired dimension, where 0 ≤ dimension <
this.getDimensionality()
public byte byteValue(int dimension)
NumberVector
getValue(dim).byteValue()
, but usually this is much more efficient
due to boxing/unboxing cost.byteValue
in interface NumberVector
dimension
- the desired dimension, where 0 ≤ dimension <
this.getDimensionality()
public byte[] getValues()
public double[] toArray()
NumberVector
toArray
in interface NumberVector
double[]
public java.lang.String toString()
FeatureVector
toString
in interface FeatureVector<java.lang.Number>
toString
in class java.lang.Object
Copyright © 2019 ELKI Development Team. License information.