public class DoubleVector extends AbstractNumberVector<DoubleVector,Double> implements ByteBufferSerializer<DoubleVector>
Modifier and Type | Class and Description |
---|---|
static class |
DoubleVector.Parameterizer
Parameterization class
|
Modifier and Type | Field and Description |
---|---|
static DoubleVector |
STATIC
Static factory instance
|
private double[] |
values
Keeps the values of the real vector
|
ATTRIBUTE_SEPARATOR
Modifier | Constructor and Description |
---|---|
|
DoubleVector(double[] values)
Provides a DoubleVector consisting of the given double values.
|
|
DoubleVector(Double[] values)
Provides a DoubleVector consisting of the given double values.
|
private |
DoubleVector(double[] values,
boolean nocopy)
Private constructor.
|
|
DoubleVector(List<Double> values)
Provides a feature vector consisting of double values according to the
given Double values.
|
|
DoubleVector(Vector columnMatrix)
Expects a matrix of one column.
|
Modifier and Type | Method and Description |
---|---|
double |
doubleValue(int dimension)
Returns the value of the specified attribute.
|
DoubleVector |
fromByteBuffer(ByteBuffer buffer)
Deserialize an object from a byte buffer (e.g. disk)
|
int |
getByteSize(DoubleVector vec)
Get the size of the object in bytes.
|
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.
|
Double |
getValue(int dimension)
Returns the value of the specified attribute.
|
double[] |
getValues()
Get a copy of the raw double[] array.
|
long |
longValue(int dimension)
Returns the value of the specified attribute as long.
|
<A> DoubleVector |
newFeatureVector(A array,
ArrayAdapter<Double,A> adapter)
Returns a new FeatureVector of V for the given values.
|
<A> DoubleVector |
newNumberVector(A array,
NumberArrayAdapter<?,A> adapter)
Instantiate from any number-array like object.
|
DoubleVector |
newNumberVector(double[] values)
Returns a new NumberVector of N for the given values.
|
void |
toByteBuffer(ByteBuffer buffer,
DoubleVector vec)
Serialize the object to a byte array (e.g. disk)
|
String |
toString()
Returns a String representation of the FeatureVector of V as a line that is
suitable to be printed in a sequential file.
|
byteValue, equals, floatValue, getMax, getMin, hashCode, intValue, shortValue
public static final DoubleVector STATIC
private double[] values
private DoubleVector(double[] values, boolean nocopy)
public DoubleVector(List<Double> values)
values
- the values to be set as values of the real vectorpublic DoubleVector(double[] values)
values
- the values to be set as values of the DoubleVectorpublic DoubleVector(Double[] values)
values
- the values to be set as values of the DoubleVectorpublic DoubleVector(Vector columnMatrix)
columnMatrix
- a matrix of one columnpublic int getDimensionality()
FeatureVector
getDimensionality
in interface FeatureVector<DoubleVector,Double>
getDimensionality
in interface SpatialComparable
public Double getValue(int dimension)
getValue
in interface FeatureVector<DoubleVector,Double>
dimension
- the selected attribute. Attributes are counted starting
with 1.IllegalArgumentException
- if the specified dimension is out of range
of the possible attributespublic double doubleValue(int dimension)
doubleValue
in interface NumberVector<DoubleVector,Double>
dimension
- the selected attribute. Attributes are counted starting
with 1.IllegalArgumentException
- if the specified dimension is out of range
of the possible attributespublic long longValue(int dimension)
longValue
in interface NumberVector<DoubleVector,Double>
dimension
- the selected attribute. Attributes are counted starting
with 1.IllegalArgumentException
- if the specified dimension is out of range
of the possible attributespublic double[] getValues()
public Vector getColumnVector()
NumberVector
getDimensionality()
rows the values of this NumberVector of V.getColumnVector
in interface NumberVector<DoubleVector,Double>
getDimensionality()
rows the values of this
NumberVector of Vpublic String toString()
FeatureVector
toString
in interface FeatureVector<DoubleVector,Double>
toString
in class Object
public DoubleVector newNumberVector(double[] values)
NumberVector
newNumberVector
in interface NumberVector<DoubleVector,Double>
newNumberVector
in class AbstractNumberVector<DoubleVector,Double>
values
- the values of the NumberVectorpublic <A> DoubleVector newFeatureVector(A array, ArrayAdapter<Double,A> adapter)
FeatureVector
newFeatureVector
in interface FeatureVector<DoubleVector,Double>
A
- Array typearray
- the values of the featureVectoradapter
- adapter classpublic <A> DoubleVector newNumberVector(A array, NumberArrayAdapter<?,A> adapter)
NumberVector
newNumberVector
in interface NumberVector<DoubleVector,Double>
A
- Array typearray
- Arrayadapter
- Adapterpublic DoubleVector fromByteBuffer(ByteBuffer buffer) throws IOException
ByteBufferSerializer
fromByteBuffer
in interface ByteBufferSerializer<DoubleVector>
buffer
- Data array to processIOException
public void toByteBuffer(ByteBuffer buffer, DoubleVector vec) throws IOException
ByteBufferSerializer
toByteBuffer
in interface ByteBufferSerializer<DoubleVector>
buffer
- Buffer to serialize tovec
- Object to serializeIOException
public int getByteSize(DoubleVector vec)
ByteBufferSerializer
getByteSize
in interface ByteBufferSerializer<DoubleVector>
vec
- Object to serialize