public class DoubleVector extends java.lang.Object implements NumberVector
double[]
storage for real numbers.Modifier and Type | Class and Description |
---|---|
static class |
DoubleVector.Factory
Factory for Double vectors.
|
static class |
DoubleVector.ShortSerializer
Serialization class for dense double vectors with up to
Short.MAX_VALUE dimensions, by using a short for storing the
dimensionality. |
static class |
DoubleVector.SmallSerializer
Serialization class for dense double vectors with up to 127 dimensions, by
using a byte for storing the dimensionality.
|
static class |
DoubleVector.VariableSerializer
Serialization class for variable dimensionality by using VarInt encoding.
|
Modifier and Type | Field and Description |
---|---|
static ByteBufferSerializer<DoubleVector> |
BYTE_SERIALIZER
Serializer for up to 127 dimensions.
|
static DoubleVector.Factory |
FACTORY
Static factory instance.
|
static ByteBufferSerializer<DoubleVector> |
SHORT_SERIALIZER
Serializer for up to 2^15-1 dimensions.
|
private double[] |
values
Stores the values of the real vector.
|
static ByteBufferSerializer<DoubleVector> |
VARIABLE_SERIALIZER
Serializer using varint encoding.
|
ATTRIBUTE_SEPARATOR, FIELD, FIELD_1D, FIELD_2D, VARIABLE_LENGTH
TYPE
Modifier | Constructor and Description |
---|---|
|
DoubleVector(double[] values)
Create a DoubleVector consisting of the given double values.
|
private |
DoubleVector(double[] values,
boolean nocopy)
Private constructor.
|
Modifier and Type | Method and Description |
---|---|
static DoubleVector |
copy(double[] vals)
Copy a double array into a new vector.
|
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.
|
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.
|
static DoubleVector |
wrap(double[] vals)
Wrap a double array as vector (without copying).
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
byteValue, floatValue, getMax, getMin, getValue, intValue, shortValue
public static final DoubleVector.Factory FACTORY
public static final ByteBufferSerializer<DoubleVector> BYTE_SERIALIZER
public static final ByteBufferSerializer<DoubleVector> SHORT_SERIALIZER
public static final ByteBufferSerializer<DoubleVector> VARIABLE_SERIALIZER
private final double[] values
private DoubleVector(double[] values, boolean nocopy)
values
- Values to usenocopy
- Flag to not copy the arraypublic DoubleVector(double[] values)
values
- the values to be set as values of the DoubleVectorpublic int getDimensionality()
FeatureVector
getDimensionality
in interface FeatureVector<java.lang.Number>
getDimensionality
in interface SpatialComparable
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 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
public static DoubleVector copy(double[] vals)
vals
- Valuespublic static DoubleVector wrap(double[] vals)
vals
- ValuesCopyright © 2019 ELKI Development Team. License information.