gov.llnl.ontology.util
Class MahoutSparseVector

java.lang.Object
  extended by org.apache.mahout.math.AbstractVector
      extended by gov.llnl.ontology.util.MahoutSparseVector
All Implemented Interfaces:
Cloneable, Iterable<org.apache.mahout.math.Vector.Element>, org.apache.mahout.math.Vector

public class MahoutSparseVector
extends org.apache.mahout.math.AbstractVector

A wrapper around an S-Space SparseDoubleVector into the Mahout style vector.

Author:
Keith Stevens

Nested Class Summary
 
Nested classes/interfaces inherited from class org.apache.mahout.math.AbstractVector
org.apache.mahout.math.AbstractVector.LocalElement
 
Nested classes/interfaces inherited from interface org.apache.mahout.math.Vector
org.apache.mahout.math.Vector.Element
 
Field Summary
 
Fields inherited from class org.apache.mahout.math.AbstractVector
lengthSquared
 
Constructor Summary
MahoutSparseVector(edu.ucla.sspace.vector.SparseDoubleVector vector)
          Creates a new MahoutSparseVector from a SparseDoubleVector.
MahoutSparseVector(edu.ucla.sspace.vector.SparseDoubleVector vector, int length)
          Creates a MahoutSparseVector from a given SparseDoubleVector with the given length.
 
Method Summary
 int getNumNondefaultElements()
          
 double getQuick(int index)
          
 boolean isDense()
          
 boolean isSequentialAccess()
          
 Iterator<org.apache.mahout.math.Vector.Element> iterateNonZero()
          
 Iterator<org.apache.mahout.math.Vector.Element> iterator()
          
 org.apache.mahout.math.Vector like()
          
 org.apache.mahout.math.Matrix matrixLike(int rows, int columns)
          
 void setQuick(int index, double value)
          
 
Methods inherited from class org.apache.mahout.math.AbstractVector
addTo, aggregate, aggregate, asFormatString, assign, assign, assign, assign, assign, assign, clone, cross, divide, dot, dotSelf, equals, get, getDistanceSquared, getElement, getLengthSquared, hashCode, logNormalize, logNormalize, logNormalize, maxValue, maxValueIndex, minus, minValue, minValueIndex, norm, normalize, normalize, plus, plus, set, size, times, times, toString, viewPart, zSum
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MahoutSparseVector

public MahoutSparseVector(edu.ucla.sspace.vector.SparseDoubleVector vector)
Creates a new MahoutSparseVector from a SparseDoubleVector. The length will be either vector's length, if it is not Integer.MAX_VALUE. Otherwise it will be the last index in the non zero indices array.


MahoutSparseVector

public MahoutSparseVector(edu.ucla.sspace.vector.SparseDoubleVector vector,
                          int length)
Creates a MahoutSparseVector from a given SparseDoubleVector with the given length. length must be less than the maximum length of vector.

Method Detail

matrixLike

public org.apache.mahout.math.Matrix matrixLike(int rows,
                                                int columns)

Specified by:
matrixLike in class org.apache.mahout.math.AbstractVector

getNumNondefaultElements

public int getNumNondefaultElements()


setQuick

public void setQuick(int index,
                     double value)


getQuick

public double getQuick(int index)


like

public org.apache.mahout.math.Vector like()


iterateNonZero

public Iterator<org.apache.mahout.math.Vector.Element> iterateNonZero()


iterator

public Iterator<org.apache.mahout.math.Vector.Element> iterator()


isSequentialAccess

public boolean isSequentialAccess()


isDense

public boolean isDense()



Copyright © 2010-2011. All Rights Reserved.