public class ByteVector extends AbstractNumberVector<Byte>
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
Modifier | Constructor and Description |
---|---|
|
ByteVector(byte[] values)
Provides 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.
|
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.
|
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.
|
String |
toString()
Returns a String representation of the FeatureVector of V as a line that is
suitable to be printed in a sequential file.
|
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
@Deprecated public Byte getValue(int dimension)
FeatureVector
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.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 byte byteValue(int dimension)
NumberVector
getValue(dim).byteValue()
, but usually this is much more efficient
due to boxing/unboxing cost.byteValue
in interface NumberVector<Byte>
byteValue
in class AbstractNumberVector<Byte>
dimension
- the desired dimension, where 0 ≤ dimension <
this.getDimensionality()
public byte[] getValues()
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<Byte>
toString
in class Object