Wednesday, 15 January 2014

c++ - Hash function for vector -


First of all, I am thinking that a vector representing a ND vector is aware of a hash function for it?

Second, is there a similar hash function, where I can specify a resolution such as two "close" vectors haveh same values?

For example: given resolution r = 0.01 q1 = {1.01, 2.3} q2 = {1.01, 2.31} will haveh for the same value.

Thanks for the help!

Perhaps something like this will work for you?

  #include & lt; Stdint.h & gt; # Include & lt; Iostream & gt; # Include & lt; Vector & gt; using namespace std; // Simple version of ELF hash ... but you can use any general purpose hashing algorithm here, instead of static inthechcodeforbite (const char * bytes, int newbietes) {unsigned long H = 0, g; For (int i = 0; i  & gt; 24;} H & amp; = ~ G; } Returns H; } Stable Intheshförring (Double V) {Return GatehashCodeFourabettes ((Const four *) and V, Sape (V)); } Static IntheshfedWeekVector (Const Vector & lt; Double & gt; & amp; v) {int ret = 0; For (int i = 0; i    

No comments:

Post a Comment