public HashedVector(Vector vector, Matrix projection, int index, long mask) { super(vector, 1, index); this.hash = mask & computeHash64(vector, projection); }
public HashedVector(Vector vector, Matrix projection, int index, long mask) { super(vector, 1, index); this.hash = mask & computeHash64(vector, projection); }
public HashedVector(Vector vector, Matrix projection, int index, long mask) { super(vector, 1, index); this.hash = mask & computeHash64(vector, projection); }
public HashedVector(WeightedVector weightedVector, Matrix projection, long mask) { super(weightedVector.getVector(), weightedVector.getWeight(), weightedVector.getIndex()); this.hash = mask & computeHash64(weightedVector, projection); }
public HashedVector(WeightedVector weightedVector, Matrix projection, long mask) { super(weightedVector.getVector(), weightedVector.getWeight(), weightedVector.getIndex()); this.hash = mask & computeHash64(weightedVector, projection); }
public HashedVector(WeightedVector weightedVector, Matrix projection, long mask) { super(weightedVector.getVector(), weightedVector.getWeight(), weightedVector.getIndex()); this.hash = mask & computeHash64(weightedVector, projection); }
@Test public void testDotCorrelation() { final Normal gen = new Normal(); Matrix projection = new DenseMatrix(64, 10); projection.assign(gen); Vector query = new DenseVector(10); query.assign(gen); long qhash = HashedVector.computeHash64(query, projection); int count[] = new int[65]; Vector v = new DenseVector(10); for (int i = 0; i <500000; i++) { v.assign(gen); long hash = HashedVector.computeHash64(v, projection); final int bitDot = Long.bitCount(qhash ^ hash); count[bitDot]++; if (count[bitDot] < 200) { System.out.printf("%d, %.3f\n", bitDot, v.dot(query) / Math.sqrt(v.getLengthSquared() * query.getLengthSquared())); } } for (int i = 0; i < 65; ++i) { System.out.printf("%d, %d\n", i, count[i]); } } }
private PriorityQueue<WeightedThing<Vector>> searchInternal(Vector query) { long queryHash = HashedVector.computeHash64(query, projection);
private PriorityQueue<WeightedThing<Vector>> searchInternal(Vector query) { long queryHash = HashedVector.computeHash64(query, projection);
private PriorityQueue<WeightedThing<Vector>> searchInternal(Vector query) { long queryHash = HashedVector.computeHash64(query, projection);