@Reference(authors="M. Datar and N. Immorlica and P. Indyk and V. S. Mirrokni", title="Locality-sensitive hashing scheme based on p-stable distributions", booktitle="Proc. 20th annual symposium on Computational geometry", url="http://dx.doi.org/10.1145/997817.997857") public class MultipleProjectionsLocalitySensitiveHashFunction extends Object implements LocalitySensitiveHashFunction<NumberVector>
M. Datar and N. Immorlica and P. Indyk and 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,
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, 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 © 2015 ELKI Development Team, Lehr- und Forschungseinheit für Datenbanksysteme, Ludwig-Maximilians-Universität München. License information.