Package cc.mallet.types
Class IndexedSparseVector
- java.lang.Object
-
- cc.mallet.types.SparseVector
-
- cc.mallet.types.IndexedSparseVector
-
- All Implemented Interfaces:
ConstantMatrix,Vector,java.io.Serializable
public class IndexedSparseVector 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 IndexedSparseVector()Create an empty vectorIndexedSparseVector(int[] featureIndices)Create binary vectorIndexedSparseVector(int[] featureIndices, double[] values)Create non-binary vector, possibly dense if "featureIndices" or possibly sparse, if notIndexedSparseVector(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()intlocation(int index)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, 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
-
IndexedSparseVector
public IndexedSparseVector(int[] indices, double[] values, int capacity, int size, boolean copy, boolean checkIndicesSorted, boolean removeDuplicates)
-
IndexedSparseVector
public IndexedSparseVector()
Create an empty vector
-
IndexedSparseVector
public IndexedSparseVector(int[] featureIndices, double[] values)Create non-binary vector, possibly dense if "featureIndices" or possibly sparse, if not
-
IndexedSparseVector
public IndexedSparseVector(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
-
location
public int location(int index)
- Specified by:
locationin interfaceConstantMatrix- Overrides:
locationin classSparseVector
-
-