public class SparseVector extends Object implements Vector
| Constructor and Description |
|---|
SparseVector() |
| 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 |
Map<String,Float> |
getActiveFeatures() |
float |
getFeatureValue(int featureIndex)
Returns the feature value of the
featureIndex-th element |
float |
getSquaredNorm()
Returns the squared norm of this vector
|
String |
getTextFromData()
Returns a textual representation of the data stored in this
representation
|
gnu.trove.map.TIntFloatMap |
getVector() |
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 |
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 |
setVector(gnu.trove.map.TIntFloatMap vector) |
String |
toString() |
public void normalize()
Normalizablenormalize in interface Normalizablepublic void setDataFromText(String representationDescription) throws IOException
RepresentationrepresentationDescriptionsetDataFromText in interface RepresentationrepresentationDescription - the textual description of the representation to be
initializedIOExceptionpublic float getFeatureValue(int featureIndex)
featureIndex-th elementfeatureIndex - the index of the feature whose value must be returnedpublic gnu.trove.map.TIntFloatMap getVector()
public void setVector(gnu.trove.map.TIntFloatMap vector)
vector - the vector to setpublic float innerProduct(Vector vector)
VectorvectorinnerProduct in interface Vectorpublic void scale(float coeff)
Normalizablecoeffscale in interface Normalizablecoeff - the scaling factorpublic void add(Vector vector)
Vectorvector to this vectorpublic void add(float coeff,
Vector vector)
Vectorvector multiplied by coeff to this vectorpublic void add(float coeff,
float vectorCoeff,
Vector vector)
Vectorvector multiplied by vectorCoeff to this
vector multiplied bypublic Vector getZeroVector()
VectorgetZeroVector in interface Vectorpublic String getTextFromData()
RepresentationgetTextFromData in interface Representationpublic float getSquaredNorm()
NormalizablegetSquaredNorm in interface NormalizableCopyright © 2014 Semantic Analytics Group @ Uniroma2. All rights reserved.