
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, shortValueprivate 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()
FeatureVectorgetDimensionality in interface FeatureVector<DoubleVector,Double>getDimensionality in interface SpatialComparablepublic 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()
NumberVectorgetDimensionality() 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()
NumberVectorgetDimensionality() 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)
NumberVectorplus in interface NumberVector<DoubleVector,Double>fv - a NumberVector of V to be added to this NumberVector of Vpublic DoubleVector minus(DoubleVector fv)
NumberVectorminus in interface NumberVector<DoubleVector,Double>fv - a NumberVector of V to be subtracted to this NumberVector of Vpublic DoubleVector nullVector()
NumberVectornullVector in interface NumberVector<DoubleVector,Double>public DoubleVector negativeVector()
NumberVectornegativeVector in interface NumberVector<DoubleVector,Double>public DoubleVector multiplicate(double k)
NumberVectormultiplicate 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()
FeatureVectortoString in interface FeatureVector<DoubleVector,Double>toString in class Objectpublic DoubleVector newInstance(Vector values)
NumberVectornewInstance in interface NumberVector<DoubleVector,Double>values - the values of the NumberVectorpublic DoubleVector newInstance(Double[] values)
FeatureVectornewInstance in interface FeatureVector<DoubleVector,Double>values - the values of the featureVectorpublic DoubleVector newInstance(double[] values)
NumberVectornewInstance in interface NumberVector<DoubleVector,Double>values - the values of the NumberVectorpublic DoubleVector newInstance(List<Double> values)
FeatureVectornewInstance in interface FeatureVector<DoubleVector,Double>values - the values of the featureVectorpublic DoubleVector fromByteBuffer(ByteBuffer buffer) throws IOException
ByteBufferSerializerfromByteBuffer in interface ByteBufferSerializer<DoubleVector>buffer - Data array to processIOExceptionpublic void toByteBuffer(ByteBuffer buffer, DoubleVector vec) throws IOException
ByteBufferSerializertoByteBuffer in interface ByteBufferSerializer<DoubleVector>buffer - Buffer to serialize tovec - Object to serializeIOExceptionpublic int getByteSize(DoubleVector vec)
ByteBufferSerializergetByteSize in interface ByteBufferSerializer<DoubleVector>vec - Object to serialize