public class IntegerVector extends java.lang.Object implements NumberVector
int[]
storage.Modifier and Type | Class and Description |
---|---|
static class |
IntegerVector.Factory
Factory for integer vectors.
|
static class |
IntegerVector.ShortSerializer
Serialization class for dense integer vectors with up to
Short.MAX_VALUE dimensions, by using a short for storing the
dimensionality. |
static class |
IntegerVector.SmallSerializer
Serialization class for dense integer vectors with up to 127 dimensions, by
using a byte for storing the dimensionality.
|
static class |
IntegerVector.VariableSerializer
Serialization class for variable dimensionality by using VarInt encoding.
|
Modifier and Type | Field and Description |
---|---|
static ByteBufferSerializer<IntegerVector> |
BYTE_SERIALIZER
Serializer for up to 127 dimensions.
|
static ByteBufferSerializer<IntegerVector> |
SHORT_SERIALIZER
Serializer for up to 2^15-1 dimensions.
|
static IntegerVector.Factory |
STATIC
Static instance (object factory).
|
private int[] |
values
Keeps the values of the real vector.
|
static ByteBufferSerializer<IntegerVector> |
VARIABLE_SERIALIZER
Serializer using varint encoding.
|
ATTRIBUTE_SEPARATOR, FIELD, FIELD_1D, FIELD_2D, VARIABLE_LENGTH
TYPE
Modifier | Constructor and Description |
---|---|
|
IntegerVector(int[] values)
Create an IntegerVector consisting of the given integer values.
|
private |
IntegerVector(int[] 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.Integer |
getValue(int dimension)
Deprecated.
|
int |
intValue(int dimension)
Returns the value in the specified dimension as int.
|
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
byteValue, floatValue, getMax, getMin, shortValue
public static final IntegerVector.Factory STATIC
public static final ByteBufferSerializer<IntegerVector> BYTE_SERIALIZER
public static final ByteBufferSerializer<IntegerVector> SHORT_SERIALIZER
public static final ByteBufferSerializer<IntegerVector> VARIABLE_SERIALIZER
private final int[] values
private IntegerVector(int[] values, boolean nocopy)
values
- Value datanocopy
- Flag to use without copying.public IntegerVector(int[] values)
values
- the values to be set as values of the IntegerVectorpublic int getDimensionality()
FeatureVector
getDimensionality
in interface FeatureVector<java.lang.Number>
getDimensionality
in interface SpatialComparable
@Deprecated public java.lang.Integer getValue(int dimension)
getValue
in interface FeatureVector<java.lang.Number>
getValue
in interface NumberVector
dimension
- 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)
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 int intValue(int dimension)
NumberVector
getValue(dim).intValue()
, but usually this is much more efficient
due to boxing/unboxing cost.intValue
in interface NumberVector
dimension
- the desired dimension, where 0 ≤ dimension <
this.getDimensionality()
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.