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 ConstantMatrixcloneMatrix()CLONINGConstantMatrixcloneMatrixZeroed()voidcolumnPlusEquals(int index, double value)doubledotProduct(DenseVector v)doubledotProduct(SparseVector v)voidindexVector()voidplusEqualsSparse(SparseVector v)For each index i that is present in this vector, set this[i] += v[i].voidplusEqualsSparse(SparseVector v, double factor)For each index i that is present in this vector, set this[i] += factor * v[i].voidsetAll(double v)Sets every present index in the vector to v.voidsetValue(int index, double value)Sets the value at the given index.voidsetValueAtLocation(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:SparseVectorCLONING- Specified by:
cloneMatrixin interfaceConstantMatrix- Overrides:
cloneMatrixin classSparseVector
-
cloneMatrixZeroed
public ConstantMatrix cloneMatrixZeroed()
- Overrides:
cloneMatrixZeroedin classSparseVector
-
indexVector
public void indexVector()
-
setValue
public final void setValue(int index, double value)Description copied from class:SparseVectorSets the value at the given index.- Overrides:
setValuein classSparseVector
-
setValueAtLocation
public final void setValueAtLocation(int location, double value)Description copied from class:SparseVectorSets the value at the given location.- Overrides:
setValueAtLocationin classSparseVector
-
columnPlusEquals
public void columnPlusEquals(int index, double value)
-
dotProduct
public final double dotProduct(DenseVector v)
- Overrides:
dotProductin classSparseVector
-
dotProduct
public final double dotProduct(SparseVector v)
- Overrides:
dotProductin classSparseVector
-
plusEqualsSparse
public final void plusEqualsSparse(SparseVector v, double factor)
Description copied from class:SparseVectorFor 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:
plusEqualsSparsein classSparseVector
-
plusEqualsSparse
public final void plusEqualsSparse(SparseVector v)
Description copied from class:SparseVectorFor 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:
plusEqualsSparsein classSparseVector
-
setAll
public final void setAll(double v)
Description copied from class:SparseVectorSets every present index in the vector to v.- Overrides:
setAllin classSparseVector
-
-