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, shortValue
private 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()
FeatureVector
getDimensionality
in interface FeatureVector<FloatVector,Float>
getDimensionality
in interface SpatialComparable
public Float getValue(int dimension)
FeatureVector
getValue
in interface FeatureVector<FloatVector,Float>
dimension
- the desired dimension, where 1 ≤ dimension ≤
this.getDimensionality()
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<FloatVector,Float>
dimension
- the desired dimension, where 1 ≤ 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<FloatVector,Float>
dimension
- the desired dimension, where 1 ≤ dimension ≤
this.getDimensionality()
public Vector getColumnVector()
NumberVector
getDimensionality()
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()
NumberVector
getDimensionality()
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)
NumberVector
plus
in interface NumberVector<FloatVector,Float>
fv
- a NumberVector of V to be added to this NumberVector of Vpublic FloatVector minus(FloatVector fv)
NumberVector
minus
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()
NumberVector
nullVector
in interface NumberVector<FloatVector,Float>
public FloatVector negativeVector()
NumberVector
negativeVector
in interface NumberVector<FloatVector,Float>
public FloatVector multiplicate(double k)
NumberVector
multiplicate
in interface NumberVector<FloatVector,Float>
k
- a scalar to multiply this NumberVector of V withpublic String toString()
FeatureVector
toString
in interface FeatureVector<FloatVector,Float>
toString
in class Object
public FloatVector newInstance(Vector values)
NumberVector
newInstance
in interface NumberVector<FloatVector,Float>
values
- the values of the NumberVectorpublic FloatVector newInstance(double[] values)
NumberVector
newInstance
in interface NumberVector<FloatVector,Float>
values
- the values of the NumberVectorpublic FloatVector newInstance(Float[] values)
FeatureVector
newInstance
in interface FeatureVector<FloatVector,Float>
values
- the values of the featureVectorpublic FloatVector newInstance(List<Float> values)
FeatureVector
newInstance
in interface FeatureVector<FloatVector,Float>
values
- the values of the featureVectorpublic FloatVector fromByteBuffer(ByteBuffer buffer) throws IOException
ByteBufferSerializer
fromByteBuffer
in interface ByteBufferSerializer<FloatVector>
buffer
- Data array to processIOException
public void toByteBuffer(ByteBuffer buffer, FloatVector vec) throws IOException
ByteBufferSerializer
toByteBuffer
in interface ByteBufferSerializer<FloatVector>
buffer
- Buffer to serialize tovec
- Object to serializeIOException
public int getByteSize(FloatVector vec)
ByteBufferSerializer
getByteSize
in interface ByteBufferSerializer<FloatVector>
vec
- Object to serialize