- 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 int
getRandomSeed
(int seed) double
hash
(int u) 1D hash function: maps a singleint
key to adouble
hash value in [0,1].double[]
hash
(int[] p) N-dimensional hash function: maps a N-vector ofint
keys to N-vector ofdouble
hash values in [0,1].double[]
hash
(int u, int v) 2D hash function: maps a pair ofint
keys to a pair ofdouble
hash values in [0,1].double[]
hash
(int u, int v, int w) 3D hash function: maps a triplet ofint
keys to a triplet ofdouble
hash values in [0,1].
-
Method Details
-
getRandomSeed
-
hash
1D hash function: maps a singleint
key to adouble
hash value in [0,1].- Parameters:
u
- the key- Returns:
- the hash value
-
hash
2D hash function: maps a pair ofint
keys to a pair ofdouble
hash values in [0,1].- Parameters:
u
- the 1st keyv
- the 2nd key- Returns:
- the hash values
-
hash
3D hash function: maps a triplet ofint
keys to a triplet ofdouble
hash 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 ofint
keys to N-vector ofdouble
hash values in [0,1].- Parameters:
p
- a N-vector of keys- Returns:
- a N-vector of hash values
-