public class FloatVector extends AbstractNumberVector<FloatVector,Float> implements ByteBufferSerializer<FloatVector>
Modifier and Type | Class and Description |
---|---|
static class |
FloatVector.Parameterizer
Parameterization class
|
Modifier and Type | Field and Description |
---|---|
static FloatVector |
STATIC
Static factory instance
|
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.
|
Float |
getValue(int dimension)
Returns the value in the specified dimension.
|
long |
longValue(int dimension)
Returns the value in the specified dimension as long.
|
<A> FloatVector |
newFeatureVector(A array,
ArrayAdapter<Float,A> adapter)
Returns a new FeatureVector of V for the given values.
|
<A> FloatVector |
newNumberVector(A array,
NumberArrayAdapter<?,A> adapter)
Instantiate from any number-array like object.
|
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, newNumberVector, shortValue
public static final FloatVector STATIC
private float[] values
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 String toString()
FeatureVector
toString
in interface FeatureVector<FloatVector,Float>
toString
in class Object
public <A> FloatVector newFeatureVector(A array, ArrayAdapter<Float,A> adapter)
FeatureVector
newFeatureVector
in interface FeatureVector<FloatVector,Float>
A
- Array typearray
- the values of the featureVectoradapter
- adapter classpublic <A> FloatVector newNumberVector(A array, NumberArrayAdapter<?,A> adapter)
NumberVector
newNumberVector
in interface NumberVector<FloatVector,Float>
A
- Array typearray
- Arrayadapter
- Adapterpublic 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