- All Known Implementing Classes:
Hash32,Hash32Shift,Hash32ShiftMult,Hash32Ward,HashPermute
public interface HashFunction
Interface to all hash functions defined in this package. Typical usage example:
HashFun hf = new Hash32Ward(seed); double g = hf.hash(u); // g is in [-1,+1] double g = hf.hash(u, v); double[] g = hf.hash(u, v, w);
Omit seed in the constructor call or use seed = 0 to get a random seed hash function of the specified type.
- Version:
- 2022/11/24
-
Method Summary
Modifier and TypeMethodDescriptionstatic intgetRandomSeed(int seed) doublehash(int u) 1D hash function: maps a singleintkey to adoublehash value in [0,1].double[]hash(int[] p) N-dimensional hash function: maps a N-vector ofintkeys to N-vector ofdoublehash values in [0,1].double[]hash(int u, int v) 2D hash function: maps a pair ofintkeys to a pair ofdoublehash values in [0,1].double[]hash(int u, int v, int w) 3D hash function: maps a triplet ofintkeys to a triplet ofdoublehash values in [0,1].
-
Method Details
-
getRandomSeed
-
hash
1D hash function: maps a singleintkey to adoublehash value in [0,1].- Parameters:
u- the key- Returns:
- the hash value
-
hash
2D hash function: maps a pair ofintkeys to a pair ofdoublehash values in [0,1].- Parameters:
u- the 1st keyv- the 2nd key- Returns:
- the hash values
-
hash
3D hash function: maps a triplet ofintkeys to a triplet ofdoublehash values in [0,1].- Parameters:
u- the 1st keyv- the 2nd keyw- the 3rd key- Returns:
- the hash values
-
hash
N-dimensional hash function: maps a N-vector ofintkeys to N-vector ofdoublehash values in [0,1].- Parameters:
p- a N-vector of keys- Returns:
- a N-vector of hash values
-