Mercurial > hg > audiodb
comparison lshlib.cpp @ 755:37c2b9cce23a multiprobeLSH
Adding mkc_lsh_update branch, trunk candidate with improved LSH: merged trunk 1095 and branch multiprobe_lsh
author | mas01mc |
---|---|
date | Thu, 25 Nov 2010 13:42:40 +0000 |
parents | 1e6cc843563a |
children |
comparison
equal
deleted
inserted
replaced
742:3e1137d12ecc | 755:37c2b9cce23a |
---|---|
1 #include "lshlib.h" | 1 #include "lshlib.h" |
2 | |
3 | 2 |
4 void err(char*s){cout << s << endl;exit(2);} | 3 void err(char*s){cout << s << endl;exit(2);} |
5 | 4 |
6 Uns32T get_page_logn(){ | 5 Uns32T get_page_logn(){ |
7 int pagesz = (int)sysconf(_SC_PAGESIZE); | 6 int pagesz = (int)sysconf(_SC_PAGESIZE); |
1253 release_lock(dbfid); | 1252 release_lock(dbfid); |
1254 close(dbfid); | 1253 close(dbfid); |
1255 } | 1254 } |
1256 | 1255 |
1257 int G::unserialize_lsh_header(char* filename){ | 1256 int G::unserialize_lsh_header(char* filename){ |
1258 | |
1259 int dbfid; | 1257 int dbfid; |
1260 char* db; | 1258 char* db; |
1261 // Test to see if file exists | 1259 // Test to see if file exists |
1262 if((dbfid = open (filename, O_RDONLY)) < 0) | 1260 if((dbfid = open (filename, O_RDONLY)) < 0) |
1263 error("Can't open the file", filename, "open"); | 1261 error("Can't open the file", filename, "open"); |
1968 fflush(stdout); | 1966 fflush(stdout); |
1969 serial_bucket_dump(pe); | 1967 serial_bucket_dump(pe); |
1970 pe+=lshHeader->numCols; | 1968 pe+=lshHeader->numCols; |
1971 }while(pe<(SerialElementT*)db+lshHeader->numRows*lshHeader->numCols); | 1969 }while(pe<(SerialElementT*)db+lshHeader->numRows*lshHeader->numCols); |
1972 } | 1970 } |
1973 | |
1974 } | 1971 } |
1975 | 1972 |
1976 void G::serial_bucket_dump(SerialElementT* pe){ | 1973 void G::serial_bucket_dump(SerialElementT* pe){ |
1977 SerialElementT* pend = pe+lshHeader->numCols; | 1974 SerialElementT* pend = pe+lshHeader->numCols; |
1978 while( !(pe->hashValue==IFLAG || pe==pend ) ){ | 1975 while( !(pe->hashValue==IFLAG || pe==pend ) ){ |