public class IntegerVector extends AbstractNumberVector<IntegerVector,Integer> implements ByteBufferSerializer<IntegerVector>
Modifier and Type | Field and Description |
---|---|
private int[] |
values
Keeps the values of the real vector
|
ATTRIBUTE_SEPARATOR
Modifier | Constructor and Description |
---|---|
|
IntegerVector(double[] values)
Provides an IntegerVector consisting of the given double values.
|
|
IntegerVector(int[] values)
Provides an IntegerVector consisting of the given integer values.
|
private |
IntegerVector(int[] values,
boolean nocopy)
Private constructor.
|
|
IntegerVector(Integer[] values)
Provides an IntegerVector consisting of the given integer values.
|
|
IntegerVector(List<Integer> values)
Provides a feature vector consisting of int values according to the
given Integer values.
|
|
IntegerVector(Vector values)
Provides an IntegerVector consisting of the given double vectors values.
|
Modifier and Type | Method and Description |
---|---|
double |
doubleValue(int dimension)
Returns the value of the specified attribute.
|
IntegerVector |
fromByteBuffer(ByteBuffer buffer)
Deserialize an object from a byte buffer (e.g. disk)
|
int |
getByteSize(IntegerVector 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. |
Integer |
getValue(int dimension)
Returns the value of the specified attribute.
|
int[] |
getValues()
Get a copy of the raw int[] array.
|
long |
longValue(int dimension)
Returns the value of the specified attribute as long.
|
IntegerVector |
minus(IntegerVector fv)
Returns a new NumberVector of V that is the sum of this NumberVector of V
and the negativeVector() of given NumberVector of V.
|
IntegerVector |
multiplicate(double k)
Returns a new NumberVector of V that is the result of a scalar
multiplication with the given scalar.
|
IntegerVector |
negativeVector()
Returns the additive inverse to this NumberVector of V.
|
IntegerVector |
newInstance(double[] values)
Returns a new NumberVector of N for the given values.
|
IntegerVector |
newInstance(Integer[] values)
Returns a new FeatureVector of V for the given values.
|
IntegerVector |
newInstance(List<Integer> values)
Returns a new FeatureVector of V for the given values.
|
IntegerVector |
newInstance(Vector values)
Returns a new NumberVector of N for the given values.
|
IntegerVector |
nullVector()
Provides a null vector of the same Vector Space as this NumberVector of V
(that is, of the same dimensionality).
|
IntegerVector |
plus(IntegerVector fv)
Returns a new NumberVector of V that is the sum of this NumberVector of V
and the given NumberVector of V.
|
Integer |
scalarProduct(IntegerVector d)
Provides the scalar product (inner product) of this and the given
IntegerVector.
|
void |
toByteBuffer(ByteBuffer buffer,
IntegerVector 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 IntegerVector(int[] values, boolean nocopy)
public IntegerVector(List<Integer> values)
values
- the values to be set as values of the integer vectorpublic IntegerVector(int[] values)
values
- the values to be set as values of the IntegerVectorpublic IntegerVector(Integer[] values)
values
- the values to be set as values of the IntegerVectorpublic IntegerVector(double[] values)
values
- the values to be set as values of the IntegerVectorpublic IntegerVector(Vector values)
values
- the values to be set as values of the IntegerVectorpublic int getDimensionality()
FeatureVector
getDimensionality
in interface FeatureVector<IntegerVector,Integer>
getDimensionality
in interface SpatialComparable
public Integer getValue(int dimension)
getValue
in interface FeatureVector<IntegerVector,Integer>
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<IntegerVector,Integer>
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<IntegerVector,Integer>
dimension
- the selected attribute. Attributes are counted starting
with 1.IllegalArgumentException
- if the specified dimension is out of range
of the possible attributespublic int[] getValues()
public Vector getColumnVector()
NumberVector
getDimensionality()
rows the values of this NumberVector of V.getColumnVector
in interface NumberVector<IntegerVector,Integer>
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<IntegerVector,Integer>
getDimensionality()
columns the values of this
NumberVector of Vpublic IntegerVector plus(IntegerVector fv)
NumberVector
plus
in interface NumberVector<IntegerVector,Integer>
fv
- a NumberVector of V to be added to this NumberVector of Vpublic IntegerVector minus(IntegerVector fv)
NumberVector
minus
in interface NumberVector<IntegerVector,Integer>
fv
- a NumberVector of V to be subtracted to this NumberVector of Vpublic IntegerVector nullVector()
NumberVector
nullVector
in interface NumberVector<IntegerVector,Integer>
public IntegerVector negativeVector()
NumberVector
negativeVector
in interface NumberVector<IntegerVector,Integer>
public IntegerVector multiplicate(double k)
NumberVector
multiplicate
in interface NumberVector<IntegerVector,Integer>
k
- a scalar to multiply this NumberVector of V withpublic Integer scalarProduct(IntegerVector d)
scalarProduct
in interface NumberVector<IntegerVector,Integer>
d
- the IntegerVector to compute the scalar product forpublic String toString()
FeatureVector
toString
in interface FeatureVector<IntegerVector,Integer>
toString
in class Object
public IntegerVector newInstance(Vector values)
NumberVector
newInstance
in interface NumberVector<IntegerVector,Integer>
values
- the values of the NumberVectorpublic IntegerVector newInstance(Integer[] values)
FeatureVector
newInstance
in interface FeatureVector<IntegerVector,Integer>
values
- the values of the featureVectorpublic IntegerVector newInstance(double[] values)
NumberVector
newInstance
in interface NumberVector<IntegerVector,Integer>
values
- the values of the NumberVectorpublic IntegerVector newInstance(List<Integer> values)
FeatureVector
newInstance
in interface FeatureVector<IntegerVector,Integer>
values
- the values of the featureVectorpublic IntegerVector fromByteBuffer(ByteBuffer buffer) throws IOException
ByteBufferSerializer
fromByteBuffer
in interface ByteBufferSerializer<IntegerVector>
buffer
- Data array to processIOException
public void toByteBuffer(ByteBuffer buffer, IntegerVector vec) throws IOException
ByteBufferSerializer
toByteBuffer
in interface ByteBufferSerializer<IntegerVector>
buffer
- Buffer to serialize tovec
- Object to serializeIOException
public int getByteSize(IntegerVector vec)
ByteBufferSerializer
getByteSize
in interface ByteBufferSerializer<IntegerVector>
vec
- Object to serialize