comparison lshlib.cpp @ 299:b10ad7b6427f

fixed recently-introduced strict point ordering bug when LSH index is initially empty
author mas01mc
date Fri, 01 Aug 2008 15:45:10 +0000
parents f922c234462f
children 921ba500a024
comparison
equal deleted inserted replaced
298:3bb4d850557b 299:b10ad7b6427f
444 444
445 // single point insertion; inserted values are hash value and pointID 445 // single point insertion; inserted values are hash value and pointID
446 Uns32T G::insert_point(vector<float>& v, Uns32T pp){ 446 Uns32T G::insert_point(vector<float>& v, Uns32T pp){
447 Uns32T collisionCount = 0; 447 Uns32T collisionCount = 0;
448 H::p = pp; 448 H::p = pp;
449 if(pp<=H::maxp) 449 if(H::maxp && pp<=H::maxp)
450 error("points must be indexed in strict ascending order", "LSH::insert_point(vector<float>&, Uns32T pointID)"); 450 error("points must be indexed in strict ascending order", "LSH::insert_point(vector<float>&, Uns32T pointID)");
451 H::maxp=pp; // Store highest pointID in database 451 H::maxp=pp; // Store highest pointID in database
452 H::compute_hash_functions( v ); 452 H::compute_hash_functions( v );
453 for(Uns32T j = 0 ; j < H::L ; j++ ){ // insertion 453 for(Uns32T j = 0 ; j < H::L ; j++ ){ // insertion
454 H::generate_hash_keys( *( H::g + j ), *( H::r1 + j ), *( H::r2 + j ) ); 454 H::generate_hash_keys( *( H::g + j ), *( H::r1 + j ), *( H::r2 + j ) );