## org.apache.mahout.math.neighborhood
Class HashedVector

    java.lang.Object
      org.apache.mahout.math.DelegatingVector
          org.apache.mahout.math.WeightedVector
              org.apache.mahout.math.neighborhood.HashedVector

All Implemented Interfaces:
  Cloneable, Vector

    public class HashedVector

extends WeightedVector

Decorates a weighted vector with a locality sensitive hash. The LSH function implemented is the random hyperplane based hash function. See "Similarity Estimation Techniques from Rounding Algorithms" by Moses S. Charikar, section 3. http://www.cs.princeton.edu/courses/archive/spring04/cos598B/bib/CharikarEstim.pdf

Nested Class Summary

Nested classes/interfaces inherited from interface org.apache.mahout.math.Vector
`Vector.Element`

Field Summary
`protected static int` `INVALID_INDEX`

Fields inherited from class org.apache.mahout.math.DelegatingVector
`delegate`

Constructor Summary
`HashedVector(Vector vector, long hash, int index)`
`HashedVector(Vector vector, Matrix projection, int index, long mask)`
`HashedVector(WeightedVector weightedVector, Matrix projection, long mask)`

Method Summary
`static long` `computeHash64(Vector vector, Matrix projection)`
`boolean` `equals(Object o)`
`long` `getHash()`
`int` `hammingDistance(long otherHash)`
`static HashedVector` `hash(WeightedVector v, Matrix projection)`
`static HashedVector` `hash(WeightedVector v, Matrix projection, long mask)`
`int` `hashCode()`
`String` `toString()`

Methods inherited from class org.apache.mahout.math.WeightedVector
`clone, getIndex, getWeight, like, project, project, setIndex, setWeight`

Methods inherited from class org.apache.mahout.math.DelegatingVector

`aggregate, aggregate, all, asFormatString, assign, assign, assign, assign, assign, assign, cross, divide, dot, get, getDistanceSquared, getElement, getIteratorAdvanceCost, getLengthSquared, getLookupCost, getNumNondefaultElements, getNumNonZeroElements, getQuick, getVector, incrementQuick, invalidateCachedLength, isAddConstantTime, isDense, isSequentialAccess, logNormalize, logNormalize, maxValue, maxValueIndex, mergeUpdates, minus, minValue, minValueIndex, nonZeroes, norm, normalize, normalize, plus, plus, set, setQuick, size, times, times, viewPart, zSum`

Methods inherited from class java.lang.Object
`finalize, getClass, notify, notifyAll, wait, wait, wait`

Field Detail

### INVALID_INDEX

    protected static final int INVALID_INDEX

See Also:
  Constant Field Values

Constructor Detail

### HashedVector

    public HashedVector(Vector vector,
                        long hash,
                        int index)

### HashedVector

    public HashedVector(Vector vector,
                        Matrix projection,
                        int index,
                        long mask)

### HashedVector

    public HashedVector(WeightedVector weightedVector,
                        Matrix projection,
                        long mask)

Method Detail

### computeHash64

    public static long computeHash64(Vector vector,
                                     Matrix projection)

### hash

    public static HashedVector hash(WeightedVector v,
                                    Matrix projection)

### hash

    public static HashedVector hash(WeightedVector v,
                                    Matrix projection,
                                    long mask)

### hammingDistance

    public int hammingDistance(long otherHash)

### getHash

    public long getHash()

### toString

    public String toString()

  Overrides:
    `toString` in class `WeightedVector`

### equals

    public boolean equals(Object o)

  Overrides:
    `equals` in class `DelegatingVector`

### hashCode

    public int hashCode()

  Overrides:
    `hashCode` in class `DelegatingVector`

Copyright © 2008–2014 The Apache Software Foundation. All rights reserved.