From 77983064295ac225b58da552c21cdc4d875beb27 Mon Sep 17 00:00:00 2001 From: Ben Coleman Date: Mon, 20 Jul 2020 21:42:56 -0400 Subject: [PATCH] Change uint to unsigned int --- include/MyBloom.h | 6 +++--- include/Rambo_construction.h | 4 ++-- include/bitArray.h | 6 +++--- src/MyBloom.cpp | 10 +++++----- src/Rambo_construction.cpp | 32 ++++++++++++++++---------------- src/bitArray.cpp | 8 ++++---- src/main.cpp | 4 ++-- src/utils.cpp | 8 ++++---- 8 files changed, 39 insertions(+), 39 deletions(-) diff --git a/include/MyBloom.h b/include/MyBloom.h index ca32aef..e32edc7 100644 --- a/include/MyBloom.h +++ b/include/MyBloom.h @@ -5,14 +5,14 @@ #include #include "bitArray.h" -std::vector myhash(std::string key, int len, int k, int r, int range); +std::vector myhash(std::string key, int len, int k, int r, int range); class BloomFiler{ public: // BloomFiler(int capacity, float FPR, int k); BloomFiler(int sz, float FPR, int k); - void insert(std::vector a); - bool test(std::vector a); + void insert(std::vector a); + bool test(std::vector a); void serializeBF(std::string BF_file); void deserializeBF(std::vector BF_file); diff --git a/include/Rambo_construction.h b/include/Rambo_construction.h index 2411169..3ac48ba 100644 --- a/include/Rambo_construction.h +++ b/include/Rambo_construction.h @@ -8,14 +8,14 @@ #include "bitArray.h" -// vector hashfunc( void* key, int len, int R, int B){ +// vector hashfunc( void* key, int len, int R, int B){ // } class RAMBO{ public: RAMBO(int n, int r1, int b1, int K); - std::vector hashfunc( std::string key, int len); + std::vector hashfunc( std::string key, int len); void insertion (std::string setID, std::vector keys); std::set takeunion(std::set set1, std::set set2); std::set takeIntrsec(std::set* setArray); diff --git a/include/bitArray.h b/include/bitArray.h index 73165f0..a02e08e 100644 --- a/include/bitArray.h +++ b/include/bitArray.h @@ -10,9 +10,9 @@ class bitArray{ // friend class boost::serialization::access; bitArray(int size); - void SetBit(uint k); - void ClearBit( uint k); - bool TestBit( uint k); + void SetBit(unsigned int k); + void ClearBit( unsigned int k); + bool TestBit( unsigned int k); void ANDop(char* B); void serializeBitAr(std::string BF_file); void deserializeBitAr(std::vector BF_file); diff --git a/src/MyBloom.cpp b/src/MyBloom.cpp index d03da14..0b52f52 100644 --- a/src/MyBloom.cpp +++ b/src/MyBloom.cpp @@ -11,10 +11,10 @@ using namespace std; -vector myhash( std::string key, int len, int k, int r, int range){ +vector myhash( std::string key, int len, int k, int r, int range){ // int hashvals[k]; - vector hashvals; - uint op; // takes 4 byte + vector hashvals; + unsigned int op; // takes 4 byte for (int i=0+ k*r; i a){ +void BloomFiler::insert(vector a){ int N = a.size(); for (int n =0 ; nSetBit(a[n]); } } -bool BloomFiler::test(vector a){ +bool BloomFiler::test(vector a){ int N = a.size(); for (int n =0 ; nTestBit(a[n])){ diff --git a/src/Rambo_construction.cpp b/src/Rambo_construction.cpp index 5185646..7205264 100644 --- a/src/Rambo_construction.cpp +++ b/src/Rambo_construction.cpp @@ -20,10 +20,10 @@ using namespace std; -vector RAMBO:: hashfunc( std::string key, int len){ +vector RAMBO:: hashfunc( std::string key, int len){ // int hashvals[k]; - vector hashvals; - uint op; + vector hashvals; + unsigned int op; for (int i=0; i RAMBO:: getdata(string filenameSet){ stringstream is; is<30 ){ - for (uint idx =0; idx hashvals = RAMBO::hashfunc(std::to_string(i), std::to_string(i).size()); // R hashvals, each with max value B + vector hashvals = RAMBO::hashfunc(std::to_string(i), std::to_string(i).size()); // R hashvals, each with max value B for(int r=0; r keys){ - vector hashvals = RAMBO::hashfunc(setID, setID.size()); // R hashvals + vector hashvals = RAMBO::hashfunc(setID, setID.size()); // R hashvals //make this loop parallel #pragma omp parallel for for(std::size_t i=0; i temp = myhash(keys[i].c_str(), keys[i].size() , k,r, range); + vector temp = myhash(keys[i].c_str(), keys[i].size() , k,r, range); Rambo_array[hashvals[r] + B*r]->insert(temp); } } @@ -120,10 +120,10 @@ void RAMBO::insertion2 (std::vector alllines){ std::vectorKeySets = line2array(alllines[i], d);//sets for a key std::vectorKeySet = line2array(KeySets[1], ','); - for (uint j = 0; j hashvals = RAMBO::hashfunc(KeySet[j], KeySet[j].size()); // R hashvals + for (unsigned int j = 0; j hashvals = RAMBO::hashfunc(KeySet[j], KeySet[j].size()); // R hashvals for(int r=0; r temp = myhash(KeySets[0].c_str(), KeySets[0].size() , k, r, range);// i is the key + vector temp = myhash(KeySets[0].c_str(), KeySets[0].size() , k, r, range);// i is the key Rambo_array[hashvals[r] + B*r]->insert(temp); } } @@ -132,7 +132,7 @@ void RAMBO::insertion2 (std::vector alllines){ // // give set and keys in the set // void RAMBO::insertionRare (std::string setID, std::vector keys){ -// vector hashvals = RAMBO::hashfunc(setID, setID.size()); // R hashvals +// vector hashvals = RAMBO::hashfunc(setID, setID.size()); // R hashvals // // //make this loop parallel // int skip =0; @@ -141,7 +141,7 @@ void RAMBO::insertion2 (std::vector alllines){ // bitArray MemVec = RAMBO::query(keys[i].c_str(), keys[i].size()); // if ( MemVec.getcount() <10 ){ // for(int r=0; r temp = myhash(keys[i].c_str(), keys[i].size() , k, r, range); +// vector temp = myhash(keys[i].c_str(), keys[i].size() , k, r, range); // Rambo_array[hashvals[r] + B*r]->insert(temp); // } // } @@ -157,7 +157,7 @@ bitArray RAMBO::query (string query_key, int len){ // bitset bitarray_K; // set res; float count=0.0; - vector check; + vector check; for(int r=0; rtest(check)){ chrono::time_point t5 = chrono::high_resolution_clock::now(); - for (uint j=0; j t6 = chrono::high_resolution_clock::now(); @@ -179,7 +179,7 @@ bitArray RAMBO::query (string query_key, int len){ bitarray_K.ANDop(bitarray_K1.A); } } - vector().swap(check); + vector().swap(check); return bitarray_K; } @@ -196,7 +196,7 @@ void RAMBO::deserializeRAMBO(vector dir){ for(int b=0; b br; - for (uint j=0; jdeserializeBF(br); diff --git a/src/bitArray.cpp b/src/bitArray.cpp index e466039..7af8041 100644 --- a/src/bitArray.cpp +++ b/src/bitArray.cpp @@ -13,15 +13,15 @@ bitArray::bitArray(int size){ } } -void bitArray::SetBit(uint k) { +void bitArray::SetBit(unsigned int k) { A[(k/8)] |= (1 << (k%8)); } -void bitArray::ClearBit(uint k) { +void bitArray::ClearBit(unsigned int k) { A[(k/8)] &= ~(1 << (k%8)); } -bool bitArray::TestBit(uint k) { +bool bitArray::TestBit(unsigned int k) { return (A[(k/8)] & (1 << (k%8))); } @@ -55,7 +55,7 @@ void bitArray::serializeBitAr(string BF_file){ } void bitArray::deserializeBitAr(std::vector BF_file){ - for(uint j =0; j setID = line2array(setIDs[ss], d); @@ -111,7 +111,7 @@ if(test){ //std::vector alllines = readlines("data/query.txt", 0); std::vector testKeys; std::vector gt_size; - for(uint i=0; iKeySets = line2array(alllines[i], ';');//sets for a key testKeys.push_back(KeySets[0]); gt_size.push_back( line2array(KeySets[1], ',').size() ); diff --git a/src/utils.cpp b/src/utils.cpp index aac01dc..08753f8 100644 --- a/src/utils.cpp +++ b/src/utils.cpp @@ -146,14 +146,14 @@ return s; std::map> makeInvIndex(int n, vector foldernames){ std::map> m; - for (uint f=0; f setIDs = readlines(dataPath, 0); cout< setID = line2array(setIDs[ss], d); string mainfile = foldername + setID[1]+ ".out"; @@ -172,7 +172,7 @@ std::map> makeInvIndex(int n, vector folde } else{ - for (uint i =0; i> makeInvIndex(int n, vector folde std::vector getkmers(std::string query_key, int kmersize){ std::vector query_kmers; - for (uint idx =0; idx