be.hogent.tarsos.lsh.util
Class HashUtils

java.lang.Object
  extended by be.hogent.tarsos.lsh.util.HashUtils

public class HashUtils
extends java.lang.Object


Method Summary
static java.math.BigInteger bigPair(java.math.BigInteger a, java.math.BigInteger b)
           
static java.math.BigInteger[] bigUnPair(java.math.BigInteger c)
           
static long pair(long... input)
           
static long[] unPair(long paired, int components)
           These functions are incredibly useful for anyone wanting to set up enumeration schemes, and in general give a single number for every coordinate in an infinite space.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

unPair

public static long[] unPair(long paired,
                            int components)

These functions are incredibly useful for anyone wanting to set up enumeration schemes, and in general give a single number for every coordinate in an infinite space. They follow as: pair[x_, y_] := (x^2 + x + 2x y + 3y + y^2)/2 this number can be transformed back into the original two numbers by: unpair[z_] := With[{i = Floor[-1/2 + (Sqrt[1 + 8 z])/2]}, {1/2 i (3 + i) - z, -1/2 i (1 + i) + z}] This can be used to enumerate all state configurations of multiple infinitely growing paramaters. You can think of it as a way of growing towers so that every configuration of tower height is visited and has a unique number for it. this function is only designed for two parameters but one can imagine a kind folding that pairs many parameters together by successively combining your set of numbers. Such a function can be constructed. One implementation of this is as follows: Combine[sequence__] := Fold[pair[#2, #1] &, First@{sequence}, Rest@{sequence}] To uncombine a number into a set of other numbers, the number of parameters must be specified. Here is the code for that: Uncombine[number_, numParams_] := Reverse[Nest[Flatten[{Most@Flatten@{#}, unpair[Last[Flatten@{#}]]}] &, Last@{number}, numParams - 1]]

Parameters:
paired -
components -
Returns:
return the elements.

bigPair

public static java.math.BigInteger bigPair(java.math.BigInteger a,
                                           java.math.BigInteger b)

bigUnPair

public static java.math.BigInteger[] bigUnPair(java.math.BigInteger c)

pair

public static long pair(long... input)