public class DenseVector extends Object implements Vector
Constructor and Description |
---|
DenseVector()
Empty constructor necessary for making
RepresentationFactory
support this implementation. |
DenseVector(org.ejml.data.DenseMatrix64F featureVector)
Initializing constructor.
|
DenseVector(double[] featureVector)
Initializing constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
add(float coeff,
float vectorCoeff,
Vector vector)
Add a
vector multiplied by vectorCoeff to this
vector multiplied by |
void |
add(float coeff,
Vector vector)
Add a
vector multiplied by coeff to this vector |
void |
add(Vector vector)
Add a
vector to this vector |
Vector |
copyVector()
Returns a copy of this vector.
|
void |
diff(Vector vector) |
boolean |
equals(Object featureVector) |
Map<String,Number> |
getActiveFeatures()
Returns a map containing all the non-zero features
|
double |
getFeatureValue(int featureIndex)
Returns the feature value of the
featureIndex -th element |
org.ejml.data.DenseMatrix64F |
getFeatureValues()
Returns the feature values in the EJML format
|
int |
getNumberOfFeatures()
Returns the number of featuresValues
|
float |
getSquaredNorm()
Returns the squared norm of this vector
|
String |
getTextFromData()
Returns a textual representation of the data stored in this
representation
|
Vector |
getZeroVector()
Returns a vector whose values are all 0.
|
float |
innerProduct(Vector vector)
Returns the dot product between this vector and
vector |
void |
normalize()
Scales the representation in order to have a unit norm in the explicit feature
space
|
void |
pointWiseProduct(Vector vector)
Compute the point-wise product of this vector with the one in
vector . |
void |
scale(float coeff)
Multiplies each element of this representation by
coeff |
void |
setDataFromText(String representationDescription)
Initializes a Representation using its textual description provided in
representationDescription |
void |
setFeatureValues(org.ejml.data.DenseMatrix64F featureVector)
Sets the feature values.
|
void |
setFeatureValues(double[] featureValues)
Sets the feature values.
|
String |
toString() |
public DenseVector()
RepresentationFactory
support this implementation.featureVector
- is an array of feature valuespublic DenseVector(double[] featureVector)
featureVector
- is an array of feature valuespublic DenseVector(org.ejml.data.DenseMatrix64F featureVector)
featureVector
- is an array of feature values in the EJML formatpublic void setDataFromText(String representationDescription)
Representation
representationDescription
setDataFromText
in interface Representation
representationDescription
- the textual description of the representation to be
initializedpublic void setFeatureValues(double[] featureValues)
featureValues
- is an array of feature valuespublic void setFeatureValues(org.ejml.data.DenseMatrix64F featureVector)
featureVector
- is an array of feature values in the EJML formatpublic org.ejml.data.DenseMatrix64F getFeatureValues()
public double getFeatureValue(int featureIndex)
featureIndex
-th elementfeatureIndex
- the index of the feature whose value must be returnedpublic int getNumberOfFeatures()
public void normalize()
Normalizable
normalize
in interface Normalizable
public float innerProduct(Vector vector)
Vector
vector
innerProduct
in interface Vector
public void pointWiseProduct(Vector vector)
Vector
vector
.pointWiseProduct
in interface Vector
vector
- the vector used for the point-wise productpublic void scale(float coeff)
Normalizable
coeff
scale
in interface Normalizable
coeff
- the scaling factorpublic void add(Vector vector)
Vector
vector
to this vectorpublic void diff(Vector vector)
public void add(float coeff, Vector vector)
Vector
vector
multiplied by coeff
to this vectorpublic void add(float coeff, float vectorCoeff, Vector vector)
Vector
vector
multiplied by vectorCoeff
to this
vector multiplied bypublic Vector getZeroVector()
Vector
getZeroVector
in interface Vector
public String getTextFromData()
Representation
getTextFromData
in interface Representation
public float getSquaredNorm()
Normalizable
getSquaredNorm
in interface Normalizable
public Map<String,Number> getActiveFeatures()
Vector
getActiveFeatures
in interface Vector
public Vector copyVector()
Vector
copyVector
in interface Vector
Copyright © 2015 Semantic Analytics Group @ Uniroma2. All rights reserved.