12
12
#include < zlib.h>
13
13
#include " ThreadPool.h"
14
14
#include < math.h>
15
- #include < set >
15
+ #include " robin_hood.h "
16
16
17
17
#ifdef USE_BOOST
18
18
#include < boost/math/distributions/binomial.hpp>
@@ -29,8 +29,6 @@ using std::cout;
29
29
using std::endl;
30
30
using std::list;
31
31
using std::string;
32
- using std::unordered_map;
33
- using std::unordered_set;
34
32
using std::vector;
35
33
36
34
namespace mash {
@@ -93,8 +91,8 @@ int CommandScreen::run() const
93
91
parameters.minHashesPerWindow = sketch.getMinHashesPerWindow ();
94
92
95
93
HashTable hashTable;
96
- unordered_map<uint64_t , std::atomic<uint32_t >> hashCounts;
97
- unordered_map<uint64_t , list<uint32_t > > saturationByIndex;
94
+ robin_hood:: unordered_map<uint64_t , std::atomic<uint32_t >> hashCounts;
95
+ robin_hood:: unordered_map<uint64_t , list<uint32_t > > saturationByIndex;
98
96
99
97
cerr << " Loading " << arguments[0 ] << " ..." << endl;
100
98
@@ -117,7 +115,7 @@ int CommandScreen::run() const
117
115
118
116
cerr << " " << hashTable.size () << " distinct hashes." << endl;
119
117
120
- unordered_set<MinHashHeap *> minHashHeaps;
118
+ robin_hood:: unordered_set<MinHashHeap *> minHashHeaps;
121
119
122
120
bool trans = (alphabet == alphabetProtein);
123
121
@@ -289,7 +287,7 @@ int CommandScreen::run() const
289
287
290
288
MinHashHeap minHashHeap (sketch.getUse64 (), sketch.getMinHashesPerWindow ());
291
289
292
- for ( unordered_set<MinHashHeap *>::const_iterator i = minHashHeaps.begin (); i != minHashHeaps.end (); i++ )
290
+ for ( auto i = minHashHeaps.begin (); i != minHashHeaps.end (); i++ )
293
291
{
294
292
HashList hashList (parameters.use64 );
295
293
@@ -337,13 +335,13 @@ int CommandScreen::run() const
337
335
338
336
memset (shared, 0 , sizeof (uint64_t ) * sketch.getReferenceCount ());
339
337
340
- for ( unordered_map< uint64_t , std::atomic< uint32_t > >::const_iterator i = hashCounts.begin (); i != hashCounts.end (); i++ )
338
+ for ( auto i = hashCounts.begin (); i != hashCounts.end (); i++ )
341
339
{
342
340
if ( i->second >= minCov )
343
341
{
344
- const unordered_set< uint64_t > & indeces = hashTable.at (i->first );
342
+ const auto & indeces = hashTable.at (i->first );
345
343
346
- for ( unordered_set< uint64_t >::const_iterator k = indeces.begin (); k != indeces.end (); k++ )
344
+ for ( auto k = indeces.begin (); k != indeces.end (); k++ )
347
345
{
348
346
shared[*k]++;
349
347
depths[*k].push_back (i->second );
@@ -381,12 +379,12 @@ int CommandScreen::run() const
381
379
continue ;
382
380
}
383
381
384
- const unordered_set< uint64_t > & indeces = i->second ;
382
+ const auto & indeces = i->second ;
385
383
double maxScore = 0 ;
386
384
uint64_t maxLength = 0 ;
387
385
uint64_t maxIndex;
388
386
389
- for ( unordered_set< uint64_t >::const_iterator k = indeces.begin (); k != indeces.end (); k++ )
387
+ for ( auto k = indeces.begin (); k != indeces.end (); k++ )
390
388
{
391
389
if ( scores[*k] > maxScore )
392
390
{
@@ -456,6 +454,7 @@ int CommandScreen::run() const
456
454
}
457
455
}
458
456
457
+ delete [] depths;
459
458
delete [] shared;
460
459
461
460
return 0 ;
@@ -809,7 +808,7 @@ char aaFromCodon(const char * codon)
809
808
return aa;// (aa == '*') ? 0 : aa;
810
809
}
811
810
812
- void useThreadOutput (CommandScreen::HashOutput * output, unordered_set<MinHashHeap *> & minHashHeaps)
811
+ void useThreadOutput (CommandScreen::HashOutput * output, robin_hood:: unordered_set<MinHashHeap *> & minHashHeaps)
813
812
{
814
813
minHashHeaps.emplace (output->minHashHeap );
815
814
delete output;
0 commit comments