Interface HashFunction

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 Type
    Method
    Description
    static int
    getRandomSeed(int seed)
     
    double
    hash(int u)
    1D hash function: maps a single int key to a double hash value in [0,1].
    double[]
    hash(int[] p)
    N-dimensional hash function: maps a N-vector of int keys to N-vector of double hash values in [0,1].
    double[]
    hash(int u, int v)
    2D hash function: maps a pair of int keys to a pair of double hash values in [0,1].
    double[]
    hash(int u, int v, int w)
    3D hash function: maps a triplet of int keys to a triplet of double hash values in [0,1].
  • Method Details

    • getRandomSeed

      static int getRandomSeed(int seed)
    • hash

      double hash(int u)
      1D hash function: maps a single int key to a double hash value in [0,1].
      Parameters:
      u - the key
      Returns:
      the hash value
    • hash

      double[] hash(int u, int v)
      2D hash function: maps a pair of int keys to a pair of double hash values in [0,1].
      Parameters:
      u - the 1st key
      v - the 2nd key
      Returns:
      the hash values
    • hash

      double[] hash(int u, int v, int w)
      3D hash function: maps a triplet of int keys to a triplet of double hash values in [0,1].
      Parameters:
      u - the 1st key
      v - the 2nd key
      w - the 3rd key
      Returns:
      the hash values
    • hash

      double[] hash(int[] p)
      N-dimensional hash function: maps a N-vector of int keys to N-vector of double hash values in [0,1].
      Parameters:
      p - a N-vector of keys
      Returns:
      a N-vector of hash values