
public class FloatVector extends AbstractNumberVector<FloatVector,Float> implements ByteBufferSerializer<FloatVector>
| Modifier and Type | Field and Description |
|---|---|
private float[] |
values
Keeps the values of the float vector
|
ATTRIBUTE_SEPARATOR| Modifier | Constructor and Description |
|---|---|
|
FloatVector(float[] values)
Provides a FloatVector consisting of the given float values.
|
|
FloatVector(Float[] values)
Provides a FloatVector consisting of the given float values.
|
private |
FloatVector(float[] values,
boolean nocopy)
Private constructor.
|
|
FloatVector(List<Float> values)
Provides a FloatVector consisting of float values according to the given
Float values.
|
|
FloatVector(Vector columnMatrix)
Expects a matrix of one column.
|
| Modifier and Type | Method and Description |
|---|---|
double |
doubleValue(int dimension)
Returns the value in the specified dimension as double.
|
FloatVector |
fromByteBuffer(ByteBuffer buffer)
Deserialize an object from a byte buffer (e.g. disk)
|
int |
getByteSize(FloatVector 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. |
Float |
getValue(int dimension)
Returns the value in the specified dimension.
|
long |
longValue(int dimension)
Returns the value in the specified dimension as long.
|
FloatVector |
minus(FloatVector fv)
Returns a new NumberVector of V that is the sum of this NumberVector of V
and the negativeVector() of given NumberVector of V.
|
FloatVector |
multiplicate(double k)
Returns a new NumberVector of V that is the result of a scalar
multiplication with the given scalar.
|
FloatVector |
negativeVector()
Returns the additive inverse to this NumberVector of V.
|
FloatVector |
newInstance(double[] values)
Returns a new NumberVector of N for the given values.
|
FloatVector |
newInstance(Float[] values)
Returns a new FeatureVector of V for the given values.
|
FloatVector |
newInstance(List<Float> values)
Returns a new FeatureVector of V for the given values.
|
FloatVector |
newInstance(Vector values)
Returns a new NumberVector of N for the given values.
|
FloatVector |
nullVector()
Provides a null vector of the same Vector Space as this NumberVector of V
(that is, of the same dimensionality).
|
FloatVector |
plus(FloatVector fv)
Returns a new NumberVector of V that is the sum of this NumberVector of V
and the given NumberVector of V.
|
Float |
scalarProduct(FloatVector f)
Provides the scalar product (inner product) of this and the given
FloatVector.
|
void |
toByteBuffer(ByteBuffer buffer,
FloatVector 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 FloatVector(float[] values,
boolean nocopy)
public FloatVector(List<Float> values)
values - the values to be set as values of the float vectorpublic FloatVector(float[] values)
values - the values to be set as values of the float vectorpublic FloatVector(Float[] values)
values - the values to be set as values of the float vectorpublic FloatVector(Vector columnMatrix)
columnMatrix - a matrix of one columnpublic int getDimensionality()
FeatureVectorgetDimensionality in interface FeatureVector<FloatVector,Float>getDimensionality in interface SpatialComparablepublic Float getValue(int dimension)
FeatureVectorgetValue in interface FeatureVector<FloatVector,Float>dimension - the desired dimension, where 1 ≤ dimension ≤
this.getDimensionality()public double doubleValue(int dimension)
NumberVectorgetValue(dim).doubleValue(), but usually this is much more
efficient due to boxing/unboxing cost.doubleValue in interface NumberVector<FloatVector,Float>dimension - the desired dimension, where 1 ≤ dimension ≤
this.getDimensionality()public long longValue(int dimension)
NumberVectorgetValue(dim).longValue(), but usually this is much more efficient
due to boxing/unboxing cost.longValue in interface NumberVector<FloatVector,Float>dimension - the desired dimension, where 1 ≤ dimension ≤
this.getDimensionality()public Vector getColumnVector()
NumberVectorgetDimensionality() rows the values of this NumberVector of V.getColumnVector in interface NumberVector<FloatVector,Float>getDimensionality() rows the values of this
NumberVector of Vpublic Matrix getRowVector()
NumberVectorgetDimensionality() columns the values of this NumberVector of
V.getRowVector in interface NumberVector<FloatVector,Float>getDimensionality() columns the values of this
NumberVector of Vpublic FloatVector plus(FloatVector fv)
NumberVectorplus in interface NumberVector<FloatVector,Float>fv - a NumberVector of V to be added to this NumberVector of Vpublic FloatVector minus(FloatVector fv)
NumberVectorminus in interface NumberVector<FloatVector,Float>fv - a NumberVector of V to be subtracted to this NumberVector of Vpublic Float scalarProduct(FloatVector f)
scalarProduct in interface NumberVector<FloatVector,Float>f - the FloatVector to compute the scalar product forpublic FloatVector nullVector()
NumberVectornullVector in interface NumberVector<FloatVector,Float>public FloatVector negativeVector()
NumberVectornegativeVector in interface NumberVector<FloatVector,Float>public FloatVector multiplicate(double k)
NumberVectormultiplicate in interface NumberVector<FloatVector,Float>k - a scalar to multiply this NumberVector of V withpublic String toString()
FeatureVectortoString in interface FeatureVector<FloatVector,Float>toString in class Objectpublic FloatVector newInstance(Vector values)
NumberVectornewInstance in interface NumberVector<FloatVector,Float>values - the values of the NumberVectorpublic FloatVector newInstance(double[] values)
NumberVectornewInstance in interface NumberVector<FloatVector,Float>values - the values of the NumberVectorpublic FloatVector newInstance(Float[] values)
FeatureVectornewInstance in interface FeatureVector<FloatVector,Float>values - the values of the featureVectorpublic FloatVector newInstance(List<Float> values)
FeatureVectornewInstance in interface FeatureVector<FloatVector,Float>values - the values of the featureVectorpublic FloatVector fromByteBuffer(ByteBuffer buffer) throws IOException
ByteBufferSerializerfromByteBuffer in interface ByteBufferSerializer<FloatVector>buffer - Data array to processIOExceptionpublic void toByteBuffer(ByteBuffer buffer, FloatVector vec) throws IOException
ByteBufferSerializertoByteBuffer in interface ByteBufferSerializer<FloatVector>buffer - Buffer to serialize tovec - Object to serializeIOExceptionpublic int getByteSize(FloatVector vec)
ByteBufferSerializergetByteSize in interface ByteBufferSerializer<FloatVector>vec - Object to serialize