@Reference(authors="M. Datar, N. Immorlica, P. Indyk, V. S. Mirrokni", title="Locality-sensitive hashing scheme based on p-stable distributions", booktitle="Proc. 20th Annual Symposium on Computational Geometry", url="https://doi.org/10.1145/997817.997857", bibkey="DBLP:conf/compgeom/DatarIIM04") public class MultipleProjectionsLocalitySensitiveHashFunction extends java.lang.Object implements LocalitySensitiveHashFunction<NumberVector>
Reference:
M. Datar, N. Immorlica, P. Indyk, V. S. Mirrokni
Locality-sensitive hashing scheme based on p-stable distributions
Proc. 20th Annual Symposium on Computational Geometry
Modifier and Type | Field and Description |
---|---|
(package private) double |
iwidth
Scaling factor: inverse of width.
|
private static long |
MASK32
Bit mask for signed int to unsigned long conversion.
|
(package private) RandomProjectionFamily.Projection |
projection
Projection matrix.
|
(package private) int[] |
randoms1
Random numbers for mixing the hash codes of the individual functions
|
(package private) double[] |
shift
Shift offset.
|
Constructor and Description |
---|
MultipleProjectionsLocalitySensitiveHashFunction(RandomProjectionFamily.Projection projection,
double width,
java.util.Random rnd)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
static int |
fastModPrime(long data)
Fast modulo operation for the largest unsigned integer prime.
|
int |
getNumberOfProjections()
Get the number of projections performed.
|
int |
hashObject(NumberVector vec)
Compute the hash value of an object.
|
int |
hashObject(NumberVector vec,
double[] buf)
Compute the hash value of an object (faster version).
|
RandomProjectionFamily.Projection projection
double[] shift
double iwidth
int[] randoms1
private static final long MASK32
public MultipleProjectionsLocalitySensitiveHashFunction(RandomProjectionFamily.Projection projection, double width, java.util.Random rnd)
projection
- Projection vectorswidth
- Width of binsrnd
- Random number generatorpublic int hashObject(NumberVector vec)
LocalitySensitiveHashFunction
hashObject
in interface LocalitySensitiveHashFunction<NumberVector>
vec
- Object to hashpublic int hashObject(NumberVector vec, double[] buf)
LocalitySensitiveHashFunction
hashObject
in interface LocalitySensitiveHashFunction<NumberVector>
vec
- Object to hashbuf
- Buffer, sized according to the number of projections.public static int fastModPrime(long data)
data
- Long inputdata % (2^32 - 5)
.public int getNumberOfProjections()
LocalitySensitiveHashFunction
getNumberOfProjections
in interface LocalitySensitiveHashFunction<NumberVector>
Copyright © 2019 ELKI Development Team. License information.