cc.mallet.types
Class IndexedSparseVector

java.lang.Object
  extended by cc.mallet.types.SparseVector
      extended by 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
IndexedSparseVector()
          Create an empty vector
IndexedSparseVector(int[] featureIndices)
          Create binary vector
IndexedSparseVector(int[] featureIndices, double[] values)
          Create non-binary vector, possibly dense if "featureIndices" or possibly sparse, if not
IndexedSparseVector(int[] indices, double[] values, int capacity, int size, boolean copy, boolean checkIndicesSorted, boolean removeDuplicates)
           
 
Method Summary
 ConstantMatrix cloneMatrix()
          CLONING
 ConstantMatrix cloneMatrixZeroed()
           
 void columnPlusEquals(int index, double value)
           
 double dotProduct(DenseVector v)
           
 double dotProduct(SparseVector v)
           
 void indexVector()
           
 int location(int index)
           
 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, makeBinary, makeNonBinary, map, numLocations, oneNorm, print, removeDuplicates, singleIndex, singleSize, singleToIndices, singleValue, sortIndices, timesEquals, timesEqualsSparse, timesEqualsSparse, timesEqualsSparseZero, toString, toString, twoNorm, value, value, valueAtLocation, vectorAdd
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

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: SparseVector
CLONING

Specified by:
cloneMatrix in interface ConstantMatrix
Overrides:
cloneMatrix in class SparseVector

cloneMatrixZeroed

public ConstantMatrix cloneMatrixZeroed()
Overrides:
cloneMatrixZeroed in class SparseVector

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 class SparseVector

setValueAtLocation

public final void setValueAtLocation(int location,
                                     double value)
Description copied from class: SparseVector
Sets the value at the given location.

Overrides:
setValueAtLocation in class SparseVector

columnPlusEquals

public void columnPlusEquals(int index,
                             double value)

dotProduct

public final double dotProduct(DenseVector v)
Overrides:
dotProduct in class SparseVector

dotProduct

public final double dotProduct(SparseVector v)
Overrides:
dotProduct in class SparseVector

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 class SparseVector

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 class SparseVector

setAll

public final void setAll(double v)
Description copied from class: SparseVector
Sets every present index in the vector to v.

Overrides:
setAll in class SparseVector

location

public int location(int index)
Specified by:
location in interface ConstantMatrix
Overrides:
location in class SparseVector