public class DoubleVector extends AbstractNumberVector<DoubleVector,Double> implements ByteBufferSerializer<DoubleVector>
Modifier and Type | Field and Description |
---|---|
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.
|
Matrix |
getRowVector()
Returns a Matrix representing in one row and
getDimensionality() columns the values of this NumberVector of
V. |
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.
|
DoubleVector |
minus(DoubleVector fv)
Returns a new NumberVector of V that is the sum of this NumberVector of V
and the negativeVector() of given NumberVector of V.
|
DoubleVector |
multiplicate(double k)
Returns a new NumberVector of V that is the result of a scalar
multiplication with the given scalar.
|
DoubleVector |
negativeVector()
Returns the additive inverse to this NumberVector of V.
|
DoubleVector |
newInstance(double[] values)
Returns a new NumberVector of N for the given values.
|
DoubleVector |
newInstance(Double[] values)
Returns a new FeatureVector of V for the given values.
|
DoubleVector |
newInstance(List<Double> values)
Returns a new FeatureVector of V for the given values.
|
DoubleVector |
newInstance(Vector values)
Returns a new NumberVector of N for the given values.
|
DoubleVector |
nullVector()
Provides a null vector of the same Vector Space as this NumberVector of V
(that is, of the same dimensionality).
|
DoubleVector |
plus(DoubleVector fv)
Returns a new NumberVector of V that is the sum of this NumberVector of V
and the given NumberVector of V.
|
Double |
scalarProduct(DoubleVector d)
Provides the scalar product (inner product) of this and the given
DoubleVector.
|
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
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 Matrix getRowVector()
NumberVector
getDimensionality()
columns the values of this NumberVector of
V.getRowVector
in interface NumberVector<DoubleVector,Double>
getDimensionality()
columns the values of this
NumberVector of Vpublic DoubleVector plus(DoubleVector fv)
NumberVector
plus
in interface NumberVector<DoubleVector,Double>
fv
- a NumberVector of V to be added to this NumberVector of Vpublic DoubleVector minus(DoubleVector fv)
NumberVector
minus
in interface NumberVector<DoubleVector,Double>
fv
- a NumberVector of V to be subtracted to this NumberVector of Vpublic DoubleVector nullVector()
NumberVector
nullVector
in interface NumberVector<DoubleVector,Double>
public DoubleVector negativeVector()
NumberVector
negativeVector
in interface NumberVector<DoubleVector,Double>
public DoubleVector multiplicate(double k)
NumberVector
multiplicate
in interface NumberVector<DoubleVector,Double>
k
- a scalar to multiply this NumberVector of V withpublic Double scalarProduct(DoubleVector d)
scalarProduct
in interface NumberVector<DoubleVector,Double>
d
- the DoubleVector to compute the scalar product forpublic String toString()
FeatureVector
toString
in interface FeatureVector<DoubleVector,Double>
toString
in class Object
public DoubleVector newInstance(Vector values)
NumberVector
newInstance
in interface NumberVector<DoubleVector,Double>
values
- the values of the NumberVectorpublic DoubleVector newInstance(Double[] values)
FeatureVector
newInstance
in interface FeatureVector<DoubleVector,Double>
values
- the values of the featureVectorpublic DoubleVector newInstance(double[] values)
NumberVector
newInstance
in interface NumberVector<DoubleVector,Double>
values
- the values of the NumberVectorpublic DoubleVector newInstance(List<Double> values)
FeatureVector
newInstance
in interface FeatureVector<DoubleVector,Double>
values
- the values of the featureVectorpublic 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