Package cc.mallet.types
Class HashedSparseVector
- java.lang.Object
-
- cc.mallet.types.SparseVector
-
- cc.mallet.types.HashedSparseVector
-
- All Implemented Interfaces:
ConstantMatrix
,Vector
,java.io.Serializable
public class HashedSparseVector extends SparseVector implements java.io.Serializable
- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class cc.mallet.types.SparseVector
hasInfinite, indices, values
-
-
Constructor Summary
Constructors Constructor Description HashedSparseVector()
Create an empty vectorHashedSparseVector(int[] featureIndices)
Create binary vectorHashedSparseVector(int[] featureIndices, double[] values)
Create non-binary vector, possibly dense if "featureIndices" or possibly sparse, if notHashedSparseVector(int[] indices, double[] values, int capacity, int size, boolean copy, boolean checkIndicesSorted, boolean removeDuplicates)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ConstantMatrix
cloneMatrix()
CLONINGConstantMatrix
cloneMatrixZeroed()
void
columnPlusEquals(int index, double value)
double
dotProduct(DenseVector v)
double
dotProduct(SparseVector v)
void
indexVector()
void
plusEqualsSparse(SparseVector v)
For each index i that is present in this vector, set this[i] += v[i].void
plusEqualsSparse(SparseVector v, double factor)
For each index i that is present in this vector, set this[i] += factor * v[i].void
setAll(double v)
Sets every present index in the vector to v.void
setValue(int index, double value)
Sets the value at the given index.void
setValueAtLocation(int location, double value)
Sets the value at the given location.-
Methods inherited from class cc.mallet.types.SparseVector
absNorm, addTo, addTo, arrayCopyFrom, arrayCopyFrom, arrayCopyInto, dotProduct, dotProduct, extendedDotProduct, extendedDotProduct, getDimensions, getIndices, getNumDimensions, getValues, incrementValue, indexAtLocation, infinityNorm, isBinary, isInfinite, isNaN, isNaNOrInfinite, location, makeBinary, makeNonBinary, map, numLocations, oneNorm, print, removeDuplicates, singleIndex, singleSize, singleToIndices, singleValue, sortIndices, timesEquals, timesEqualsSparse, timesEqualsSparse, timesEqualsSparseZero, toString, toString, twoNorm, value, value, valueAtLocation, vectorAdd
-
-
-
-
Constructor Detail
-
HashedSparseVector
public HashedSparseVector(int[] indices, double[] values, int capacity, int size, boolean copy, boolean checkIndicesSorted, boolean removeDuplicates)
-
HashedSparseVector
public HashedSparseVector()
Create an empty vector
-
HashedSparseVector
public HashedSparseVector(int[] featureIndices, double[] values)
Create non-binary vector, possibly dense if "featureIndices" or possibly sparse, if not
-
HashedSparseVector
public HashedSparseVector(int[] featureIndices)
Create binary vector
-
-
Method Detail
-
cloneMatrix
public ConstantMatrix cloneMatrix()
Description copied from class:SparseVector
CLONING- Specified by:
cloneMatrix
in interfaceConstantMatrix
- Overrides:
cloneMatrix
in classSparseVector
-
cloneMatrixZeroed
public ConstantMatrix cloneMatrixZeroed()
- Overrides:
cloneMatrixZeroed
in classSparseVector
-
indexVector
public void indexVector()
-
setValue
public final void setValue(int index, double value)
Description copied from class:SparseVector
Sets the value at the given index.- Overrides:
setValue
in classSparseVector
-
setValueAtLocation
public final void setValueAtLocation(int location, double value)
Description copied from class:SparseVector
Sets the value at the given location.- Overrides:
setValueAtLocation
in classSparseVector
-
columnPlusEquals
public void columnPlusEquals(int index, double value)
-
dotProduct
public final double dotProduct(DenseVector v)
- Overrides:
dotProduct
in classSparseVector
-
dotProduct
public final double dotProduct(SparseVector v)
- Overrides:
dotProduct
in classSparseVector
-
plusEqualsSparse
public final void plusEqualsSparse(SparseVector v, double factor)
Description copied from class:SparseVector
For each index i that is present in this vector, set this[i] += factor * v[i]. If v has indices that are not present in this, these are just ignored.- Overrides:
plusEqualsSparse
in classSparseVector
-
plusEqualsSparse
public final void plusEqualsSparse(SparseVector v)
Description copied from class:SparseVector
For each index i that is present in this vector, set this[i] += v[i]. If v has indices that are not present in this, these are just ignored.- Overrides:
plusEqualsSparse
in classSparseVector
-
setAll
public final void setAll(double v)
Description copied from class:SparseVector
Sets every present index in the vector to v.- Overrides:
setAll
in classSparseVector
-
-