/** * Calculate a hash using all bytes from the input argument, and * a seed of -1. * @param bytes input bytes * @return hash value */ public int hash(byte[] bytes) { return hash(bytes, bytes.length, -1); }
/** * Calculate a hash using all bytes from the input argument, * and a provided seed value. * @param bytes input bytes * @param initval seed value * @return hash value */ public int hash(byte[] bytes, int initval) { return hash(bytes, bytes.length, initval); }
/** * Hashes a specified key into several integers. * @param k The specified key. * @return The array of hashed values. */ public int[] hash(Key k){ byte[] b = k.getBytes(); if (b == null) { throw new NullPointerException("buffer reference is null"); } if (b.length == 0) { throw new IllegalArgumentException("key length must be > 0"); } int[] result = new int[nbHash]; for (int i = 0, initval = 0; i < nbHash; i++) { initval = hashFunction.hash(b, initval); result[i] = Math.abs(initval % maxValue); } return result; } }
for (int i = 0; i < numcat; ++i) { ByteBuffer buf = ByteBuffer.allocate(4); int hashval = murmur.hash(buf.putInt(cats[i]).array(), 4, (int)params.seed); // turn horizontalized categorical integer into another integer, based on seed
/** * Calculate a hash using all bytes from the input argument, and * a seed of -1. * @param bytes input bytes * @return hash value */ public int hash(byte[] bytes) { return hash(bytes, bytes.length, -1); }
/** * Calculate a hash using all bytes from the input argument, * and a provided seed value. * @param bytes input bytes * @param initval seed value * @return hash value */ public int hash(byte[] bytes, int initval) { return hash(bytes, bytes.length, initval); }
/** * Calculate a hash using all bytes from the input argument, * and a provided seed value. * @param bytes input bytes * @param initval seed value * @return hash value */ public int hash(byte[] bytes, int initval) { return hash(bytes, bytes.length, initval); }
/** * Calculate a hash using all bytes from the input argument, and * a seed of -1. * @param bytes input bytes * @return hash value */ public int hash(byte[] bytes) { return hash(bytes, bytes.length, -1); }
/** * Calculate a hash using all bytes from the input argument, * and a provided seed value. * @param bytes input bytes * @param initval seed value * @return hash value */ public int hash(byte[] bytes, int initval) { return hash(bytes, bytes.length, initval); }
/** * Calculate a hash using all bytes from the input argument, and * a seed of -1. * @param bytes input bytes * @return hash value */ public int hash(byte[] bytes) { return hash(bytes, bytes.length, -1); }
/** * Calculate a hash using all bytes from the input argument, * and a provided seed value. * @param bytes input bytes * @param initval seed value * @return hash value */ public int hash(byte[] bytes, int initval) { return hash(bytes, bytes.length, initval); }
/** * Calculate a hash using all bytes from the input argument, and * a seed of -1. * @param bytes input bytes * @return hash value */ public int hash(byte[] bytes) { return hash(bytes, bytes.length, -1); }
/** * Calculate a hash using all bytes from the input argument, and * a seed of -1. * @param bytes input bytes * @return hash value */ public int hash(byte[] bytes) { return hash(bytes, bytes.length, -1); }
/** * Calculate a hash using all bytes from the input argument, * and a provided seed value. * @param bytes input bytes * @param initval seed value * @return hash value */ public int hash(byte[] bytes, int initval) { return hash(bytes, bytes.length, initval); }
/** * Hashes a specified key into several integers. * @param k The specified key. * @return The array of hashed values. */ public int[] hash(Key k){ byte[] b = k.getBytes(); if (b == null) { throw new NullPointerException("buffer reference is null"); } if (b.length == 0) { throw new IllegalArgumentException("key length must be > 0"); } int[] result = new int[nbHash]; for (int i = 0, initval = 0; i < nbHash; i++) { initval = hashFunction.hash(b, initval); result[i] = Math.abs(initval % maxValue); } return result; } }
/** * Hashes a specified key into several integers. * @param k The specified key. * @return The array of hashed values. */ public int[] hash(Key k){ byte[] b = k.getBytes(); if (b == null) { throw new NullPointerException("buffer reference is null"); } if (b.length == 0) { throw new IllegalArgumentException("key length must be > 0"); } int[] result = new int[nbHash]; for (int i = 0, initval = 0; i < nbHash; i++) { initval = hashFunction.hash(b, initval); result[i] = Math.abs(initval % maxValue); } return result; } }
/** * Hashes a specified key into several integers. * @param k The specified key. * @return The array of hashed values. */ public int[] hash(Key k){ byte[] b = k.getBytes(); if (b == null) { throw new NullPointerException("buffer reference is null"); } if (b.length == 0) { throw new IllegalArgumentException("key length must be > 0"); } int[] result = new int[nbHash]; for (int i = 0, initval = 0; i < nbHash; i++) { initval = hashFunction.hash(b, initval); result[i] = Math.abs(initval % maxValue); } return result; } }
/** * Hashes a specified key into several integers. * @param k The specified key. * @return The array of hashed values. */ public int[] hash(Key k){ byte[] b = k.getBytes(); if (b == null) { throw new NullPointerException("buffer reference is null"); } if (b.length == 0) { throw new IllegalArgumentException("key length must be > 0"); } int[] result = new int[nbHash]; for (int i = 0, initval = 0; i < nbHash; i++) { initval = hashFunction.hash(b, initval); result[i] = Math.abs(initval % maxValue); } return result; } }
/** * Hashes a specified key into several integers. * @param k The specified key. * @return The array of hashed values. */ public int[] hash(Key k){ byte[] b = k.getBytes(); if (b == null) { throw new NullPointerException("buffer reference is null"); } if (b.length == 0) { throw new IllegalArgumentException("key length must be > 0"); } int[] result = new int[nbHash]; for (int i = 0, initval = 0; i < nbHash; i++) { initval = hashFunction.hash(b, initval); result[i] = Math.abs(initval % maxValue); } return result; } }