-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHEM5.cpp
More file actions
1206 lines (1095 loc) · 39 KB
/
HEM5.cpp
File metadata and controls
1206 lines (1095 loc) · 39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#include "HEM5.h"
HEM5::HEM5(int type)
{
numSub = 0;
numDimension = atts;
buckStep = (valDom - 1) / buks + 1;
numBucket = (valDom - 1) / buckStep + 1;
string TYPE = "HEM5DD";
if (type == HEM5_DD_PARALLEL)
{
threadPool.initThreadPool(parallelDegree);
TYPE += "-Parallel" + to_string(parallelDegree);
}
else if (type == HEM5_DD_AVXOR_PARALLEL)
{
threadPool.initThreadPool(parallelDegree);
TYPE += "-avxOR" + to_string(BlockSize) + "-Parallel" + to_string(parallelDegree);
}
cout << "ExpID = " << expID << ". " + TYPE + ": bit exponent = " << be << ", bucketStep = " << buckStep
<< ", numBucket = " << numBucket << endl;
//bucketSub.resize(numBucket);
data[0].resize(numDimension, vector<vector<Combo>>(numBucket));
data[1].resize(numDimension, vector<vector<Combo>>(numBucket));
if (be == -1)
numBits = be2;
else
numBits = pow(2, be); // 每锟斤拷维锟斤拷锟斤拷lowValue锟斤拷应锟斤拷bits锟斤拷锟斤拷锟斤拷锟�?
//if (numBits > 1)
fullBits.resize(numDimension); // 维锟斤拷锟斤拷锟斤拷锟斤拷远锟斤拷锟戒,锟斤拷锟斤拷只锟斤拷要resize一锟斤拷
//else bitStep = numBucket >> 1;
doubleReverse[0] = new bool* [numDimension];
doubleReverse[1] = new bool* [numDimension];
endBucket[0] = new int* [numDimension];
endBucket[1] = new int* [numDimension];
bitsID[0] = new int* [numDimension];
bitsID[1] = new int* [numDimension];
_for(i, 0, numDimension)
{
doubleReverse[0][i] = new bool[numBucket];
doubleReverse[1][i] = new bool[numBucket];
endBucket[0][i] = new int[numBucket];
endBucket[1][i] = new int[numBucket];
bitsID[0][i] = new int[numBucket];
bitsID[1][i] = new int[numBucket];
}
fix[0].resize(numDimension, vector<int>(numBucket + 1));
fix[1].resize(numDimension, vector<int>(numBucket + 1));
}
HEM5::~HEM5()
{
_for(i, 0,
numDimension) delete[] doubleReverse[0][i], doubleReverse[1][i], endBucket[0][i], endBucket[1][i], bitsID[0][i], bitsID[1][i];
delete[] endBucket[0], endBucket[1], bitsID[0], bitsID[1], doubleReverse[0], doubleReverse[1];
}
void HEM5::insert(IntervalSub sub)
{
for (int i = 0; i < sub.size; i++)
{
IntervalCnt cnt = sub.constraints[i];
Combo c;
// int bucketID = cnt.lowValue / buckStep; // Bug: 锟斤拷锟斤被锟斤拷锟斤拷
c.val = cnt.lowValue;
c.subID = sub.id;
data[0][cnt.att][cnt.lowValue / buckStep].push_back(c);
c.val = cnt.highValue;
data[1][cnt.att][cnt.highValue / buckStep].push_back(c);
}
numSub++;
}
void HEM5::insert_online(IntervalSub sub)
{
Combo c;
int b, bucketID;
c.subID = sub.id;
//if (numBits > 1) { // 锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷for循锟斤拷锟斤拷每锟轿讹拷锟叫讹拷一锟斤拷
//_for(i, 0, sub.size) {
// fullBits[sub.constraints[i].att][sub.id] = 1;
//}
//}
for (auto&& cnt : sub.constraints)
{
fullBits[cnt.att][sub.id] = 1;
bucketID = cnt.lowValue / buckStep;
c.val = cnt.lowValue;
data[0][cnt.att][bucketID].push_back(c);
if (doubleReverse[0][cnt.att][bucketID])
b = bitsID[0][cnt.att][bucketID];
else
b = bitsID[0][cnt.att][bucketID] + 1;
_for(q, b, numBits - 1) bits[0][cnt.att][q][sub.id] = 1;
bucketID = cnt.highValue / buckStep;
c.val = cnt.highValue;
data[1][cnt.att][bucketID].push_back(c);
if (doubleReverse[1][cnt.att][bucketID])
b = bitsID[1][cnt.att][bucketID];
else
b = bitsID[1][cnt.att][bucketID] + 1;
_for(q, b, numBits - 1) bits[1][cnt.att][q][sub.id] = 1;
}
numSub++;
}
bool HEM5::deleteSubscription(IntervalSub sub)
{
int find = 0;
IntervalCnt cnt;
int b, bucketID, id = sub.id;
//if (numBits > 1) { // 锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷for循锟斤拷锟斤拷每锟轿讹拷锟叫讹拷一锟斤拷
_for(i, 0, sub.size)
{
fullBits[sub.constraints[i].att][id] = 0;
}
//}
_for(i, 0, sub.size)
{
cnt = sub.constraints[i];
bucketID = cnt.lowValue / buckStep;
vector<Combo>::const_iterator it;
for (it = data[0][cnt.att][bucketID].cbegin(); it != data[0][cnt.att][bucketID].cend(); it++)
if (it->subID == id)
{
data[0][cnt.att][bucketID].erase(it); // it =
find++;
break;
}
if (doubleReverse[0][cnt.att][bucketID])
b = bitsID[0][cnt.att][bucketID];
else
b = bitsID[0][cnt.att][bucketID] + 1;
_for(q, b, numBits - 1) bits[0][cnt.att][q][sub.id] = 0;
bucketID = cnt.highValue / buckStep;
for (it = data[1][cnt.att][bucketID].cbegin(); it != data[1][cnt.att][bucketID].cend(); it++)
if (it->subID == id)
{
data[1][cnt.att][bucketID].erase(it); // it =
find++;
break;
}
if (doubleReverse[1][cnt.att][bucketID])
b = bitsID[1][cnt.att][bucketID];
else
b = bitsID[1][cnt.att][bucketID] + 1;
_for(q, b, numBits - 1) bits[1][cnt.att][q][sub.id] = 0;
}
if (find == 2 * sub.size)
numSub--;
return find == 2 * sub.size;
}
// fullBits锟斤拷锟斤拷锟芥储锟侥版本
void HEM5::initBits()
{
// 锟斤拷锟斤拷卸锟轿筹拷始锟斤拷
_for(i, 0,
numDimension) delete[] doubleReverse[0][i], doubleReverse[1][i], endBucket[0][i], endBucket[1][i], bitsID[0][i], bitsID[1][i];
delete[] endBucket[0], endBucket[1], bitsID[0], bitsID[1], doubleReverse[0], doubleReverse[1];
doubleReverse[0] = new bool* [numDimension];
doubleReverse[1] = new bool* [numDimension];
endBucket[0] = new int* [numDimension];
endBucket[1] = new int* [numDimension];
bitsID[0] = new int* [numDimension];
bitsID[1] = new int* [numDimension];
_for(i, 0, numDimension)
{
doubleReverse[0][i] = new bool[numBucket];
doubleReverse[1][i] = new bool[numBucket];
endBucket[0][i] = new int[numBucket];
endBucket[1][i] = new int[numBucket];
bitsID[0][i] = new int[numBucket];
bitsID[1][i] = new int[numBucket];
}
bits[0].clear(), bits[1].clear();
bits[0].resize(numDimension, vector<bitset<subs>>(numBits - 1));
bits[1].resize(numDimension, vector<bitset<subs>>(numBits - 1));
//// 前缀锟酵★拷锟斤拷缀锟斤拷锟斤拷锟斤拷, 锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷
//_for(i, 0, numDimension) {
// _for(j, 1, numBucket) {
// fix[0][i][numBucket - 1 - j] = fix[0][i][numBucket - j] + data[0][i][numBucket - j].size();
// fix[1][i][j] = fix[1][i][j - 1] + data[1][i][j - 1].size();
// }
// // 锟斤拷锟斤拷锟斤拷锟斤拷暮痛锟斤拷锟斤拷锟斤拷一锟斤拷元锟斤拷锟斤拷
// fix[0][i][numBucket] = fix[0][i][0] + data[0][i][0].size();
// fix[1][i][numBucket] = fix[1][i][numBucket - 1] + data[1][i][numBucket - 1].size(); // Bug: 锟斤拷锟斤拷-1!!!
//}
// 前缀锟斤拷锟斤拷锟斤拷(锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷)锟斤拷锟斤拷缀锟斤拷锟斤拷锟斤拷(锟斤拷锟斤拷锟斤拷锟斤拷)
_for(i, 0, numDimension)
{
fix[0][i][numBucket] = 0;
fix[0][i][numBucket - 1] = data[0][i][numBucket - 1].size();
fix[1][i][0] = 0;
_for(j, 1, numBucket)
{
fix[0][i][numBucket - 1 - j] = fix[0][i][numBucket - j] + data[0][i][numBucket - j - 1].size();
fix[1][i][j] = fix[1][i][j - 1] + data[1][i][j - 1].size();
}
// 锟斤拷锟斤拷锟斤拷锟斤拷暮痛锟斤拷锟斤拷锟斤拷一锟斤拷元锟斤拷锟斤拷
//fix[0][i][numBucket] = fix[0][i][0]; // Bug: 锟斤拷锟铰猴拷锟斤拷湛锟绞硷拷锟接筹拷锟斤拷系时fix[0][i][lowBktId]锟斤拷锟斤拷锟斤拷
fix[1][i][numBucket] = fix[1][i][numBucket - 1] + data[1][i][numBucket - 1].size(); // Bug: 锟斤拷锟斤拷-1!!!
}
//if (numBits == 1) { // 只锟斤拷一锟斤拷bits时锟斤拷锟叫o拷锟斤拷锟斤拷fullBits
// _for(i, 0, numDimension) {
// int halfWorkLoad = fix[0][i][0] >> 1; // subWorkLoadStep fix[1][i][numBucket]
// int quarterWorkLoad = halfWorkLoad >> 1;
// // 锟斤拷一锟斤拷锟斤拷/前缀锟酵帮拷锟斤拷一锟诫订锟侥碉拷桶ID锟斤拷bit锟斤拷锟斤拷锟斤拷远锟斤拷锟矫革拷锟角碉拷lowHalfPoint锟斤拷highHalfPoint-1
// int lowHalfPoint = -1, lowQuarterPoint = -1, highHalfPoint = -1, highQuarterPoint = -1;
// _for(j, 0, numBucket) {
// if (lowQuarterPoint == -1 && fix[0][i][numBucket - 1 - j] >= quarterWorkLoad)
// lowQuarterPoint = numBucket - 1 - j;
// else if (lowHalfPoint == -1 && fix[0][i][numBucket - 1 - j] >= halfWorkLoad)
// lowHalfPoint = numBucket - 1 - j;
// if (highQuarterPoint == -1 && fix[1][i][j] >= quarterWorkLoad)
// highQuarterPoint = j;
// else if (highHalfPoint == -1 && fix[1][i][j] >= halfWorkLoad)
// highHalfPoint = j;
// }
// _for(j, 0, numBucket) {
// if (j < lowHalfPoint) { // 锟斤拷锟斤拷锟斤拷锟斤拷bitset
// bitsID[0][i][j] = 0;
// endBucket[0][i][j] = lowHalfPoint; // 锟斤拷锟斤拷锟斤拷小锟斤拷 lowCriticalPoint
// doubleReverse[0][i][j] = false;
// }
// else if (j < lowQuarterPoint) {
// bitsID[0][i][j] = 0;
// endBucket[0][i][j] = lowHalfPoint; // 锟斤拷 j 锟斤拷锟截凤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟�? lowCriticalPoint(锟斤拷锟斤拷锟斤拷)
// doubleReverse[0][i][j] = true;
// _for(k, 0, data[0][i][j].size()) // 桶锟斤拷每锟斤拷锟斤拷锟斤拷
// bits[0][i][0][data[0][i][j][k].subID] = 1;
// }
// else {
// bitsID[0][i][j] = -1;
// endBucket[0][i][j] = numBucket;
// doubleReverse[0][i][j] = false;
// _for(k, 0, data[0][i][j].size()) // 桶锟斤拷每锟斤拷锟斤拷锟斤拷
// bits[0][i][0][data[0][i][j][k].subID] = 1;
// }
// if (j < highQuarterPoint) { // 锟斤拷锟斤拷锟斤拷锟斤拷bitset
// bitsID[1][i][j] = -1;
// endBucket[1][i][j] = 0; // 锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷0
// doubleReverse[1][i][j] = false;
// _for(k, 0, data[1][i][j].size()) // 桶锟斤拷每锟斤拷锟斤拷锟斤拷
// bits[1][i][0][data[1][i][j][k].subID] = 1;
// }
// else if (j < highHalfPoint) {
// bitsID[1][i][j] = 0;
// endBucket[1][i][j] = highHalfPoint; // 锟斤拷 j 锟斤拷锟截凤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷诘锟斤拷锟�? highCriticalPoint
// doubleReverse[1][i][j] = true;
// _for(k, 0, data[1][i][j].size()) // 桶锟斤拷每锟斤拷锟斤拷锟斤拷
// bits[1][i][0][data[1][i][j][k].subID] = 1;
// }
// else {
// bitsID[1][i][j] = 0;
// endBucket[1][i][j] = highHalfPoint; // 锟斤拷 j-1 锟斤拷锟斤拷锟斤拷锟斤拷锟节碉拷锟斤拷 highHalfPoint, 锟斤拷锟斤拷前锟斤拷锟斤拷一锟斤拷
// doubleReverse[1][i][j] = false;
// }
// }
// }
// //cout << "HEM5DD Stop.\n";
// return;
//}
// 锟斤拷前应锟斤拷映锟戒到锟斤拷bitId, 桶id, 锟斤拷一锟斤拷锟劫界负锟截碉拷
int lowBid, highBid, lowBktId, highBktId, lowSubWorkLoad, highSubWorkLoad;
int subWorkLoadStep; // 每锟斤拷维锟斤拷锟较碉拷subWorkLoadStep锟斤拷锟斤拷同, 锟斤拷同一锟斤拷维锟斤拷锟较碉拷low/high subWorkLoadStep锟斤拷一锟斤拷锟斤拷
_for(i, 0, numDimension)
{
// 锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟�?
if (fix[0][i][0] == 0)
{
_for(j, 0, numBucket)
{
bitsID[0][i][j] = -1;
endBucket[0][i][j] = j;
doubleReverse[0][i][j] = false;
bitsID[1][i][j] = -1;
endBucket[1][i][j] = j; // 锟斤拷锟斤拷锟斤拷锟斤拷锟节碉拷锟斤拷endBucket[1][i][j]
doubleReverse[1][i][j] = false;
}
continue;
}
subWorkLoadStep = (fix[0][i][0] + numBits - 1) / numBits; // fix[1][i][numBucket]
// 锟斤拷锟斤拷锟斤拷low/high锟斤拷锟角讹拷态锟斤拷, 锟斤拷锟斤拷锟斤拷锟斤拷锟杰癸拷锟斤拷同一锟斤拷partition/cell,
// 锟斤拷锟斤拷锟斤拷low锟斤拷锟角达拷锟斤拷呖锟绞硷拷锟揭伙拷锟絪ubWorkLoadStep锟斤拷锟斤拷, 锟斤拷锟斤拷一锟斤拷
// 锟斤拷锟竭达拷锟揭憋拷锟斤拷 剩锟洁负锟斤拷锟斤拷 锟斤拷始锟桔硷拷subWorkLoadStep, 锟斤拷锟斤拷锟斤拷锟絜ndBucket!
// 0锟斤拷low桶一锟斤拷锟斤拷锟斤拷锟矫碉拷锟斤拷 (numBits - 2) 为锟铰憋拷锟絙itset
// 锟斤拷锟揭伙拷锟酵耙伙拷锟斤拷貌锟斤拷锟絙itset
// 锟斤拷锟斤拷: numBits=15, fix[0][i][0]=1000000, subWorkLoadStep=66667 (low锟较的猴拷14锟斤拷锟斤拷1, high锟较碉拷前14锟斤拷锟斤拷1)
// fix[0][i][numBucket] / subWorkLoadStep=14, lowSubWorkLoad=66662
lowBid = -1;
lowBktId = numBucket;
lowSubWorkLoad = fix[0][i][0] - (fix[0][i][0] - 1) / subWorkLoadStep * subWorkLoadStep;
highBid = -1;
highBktId = 0;
highSubWorkLoad = subWorkLoadStep;
// lowContain[i]=锟斤拷锟斤拷(锟斤拷一锟斤拷锟斤拷锟斤拷)lowSubWorkLoad+(i-1)*subWorkLoadStep锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷桶锟斤拷(i>0时)
vector<int> lowContain(numBits + 1, numBucket);
// highContain[i]=锟斤拷锟斤拷 i*subWorkLoadStep 锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷桶锟斤拷
vector<int> highContain(numBits + 1, 0);
int li = 1, hi = 1; // lowContain锟斤拷highContain锟斤拷锟铰憋拷
_for(j, 0, numBucket)
{
if (fix[1][i][j] >= highSubWorkLoad)
{ // 前缀锟酵诧拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷0锟斤拷j-1锟斤拷锟斤拷锟斤拷锟酵帮拷锟斤拷锟�?
highContain[hi++] = j; // bkt0 ~ bkt[highContain[hi]]-1 contains subWorkLoadStep*hi workload; highContain[hi]-1 is the right end bkt ID of the $hi group; hi means the old hi.
highSubWorkLoad += subWorkLoadStep;
}
// 锟斤拷锟斤拷: fix[0][i][0]=1M, subWorkLoadStep=100000, numBits=10
// li,lowSubWorkLoad = 1,100000; 2,200000; ... ; 9,900000; 10,1000000; 11,1100000
if (fix[0][i][numBucket - j - 1] >= lowSubWorkLoad)
{
lowContain[li++] = numBucket - j - 1;
lowSubWorkLoad += subWorkLoadStep;
}
}
//lowContain[li] = 0; // 为啥锟斤拷锟斤拷越锟斤拷??? li==numBits+1锟斤拷
if (hi == numBits) // Bug: 锟斤拷蠹父锟酵帮拷?锟斤拷锟绞県i锟斤拷锟斤拷for循锟斤拷锟斤拷锟斤拷锟接碉拷numBits+1
highContain[hi] = numBucket;
li = hi = 1; // 双锟截凤拷锟斤拷锟斤拷锟绞憋拷锟斤拷锟接︼拷锟斤拷锟揭伙拷说锟酵帮拷锟斤拷锟絚ontain锟斤拷锟斤拷锟叫碉拷锟铰憋拷, 锟斤拷实 li=lowBid+2, hi=highBid+2
lowSubWorkLoad = fix[0][i][0] - (fix[0][i][0] - 1) / subWorkLoadStep * subWorkLoadStep;
highSubWorkLoad = subWorkLoadStep;
_for(j, 0, numBucket)
{
// 锟斤拷时锟斤拷锟节碉拷锟斤拷highSubWorkLoad锟斤拷, 锟斤拷锟斤拷锟斤拷bits, 锟斤拷为bits锟斤拷锟角碉拷j-1桶
if (fix[1][i][j] >= highSubWorkLoad)
{ // 锟斤拷一锟斤拷锟斤拷锟节碉拷锟斤拷锟劫斤拷锟斤拷桶(j-1锟斤拷, 前缀锟酵诧拷锟斤拷锟斤拷锟斤拷锟斤拷)锟斤拷为bitset锟斤拷锟角碉拷锟秸碉拷桶
highSubWorkLoad += subWorkLoadStep;
hi++;
highBid++;
highBktId = j; // == highContain[hi-1] ?
}
// Bug: 锟斤拷前锟斤拷锟斤拷, 锟斤拷蠹父锟酵帮拷?锟斤拷锟�?, 锟斤拷时highBid=numBits-1, 越锟斤拷锟斤拷, 直锟斤拷锟斤拷fullBL
if (fix[1][i][j] == fix[1][i][numBucket])
{
bitsID[1][i][j] = numBits - 1;
endBucket[1][i][j] = j; // bucket j does not need to be reversely marked because COMPARE step can ensure the correctness
doubleReverse[1][i][j] = true;
}
else if (fix[1][i][j] - fix[1][i][highBktId] <
fix[1][i][highContain[hi]] - fix[1][i][j + 1])
{ // Bug: 没锟叫硷拷highBktId
bitsID[1][i][j] = highBid;
endBucket[1][i][j] = highBktId; // 锟斤拷锟斤拷锟斤拷锟斤拷锟节碉拷锟斤拷endBucket[1][i][j]
doubleReverse[1][i][j] = false;
}
else
{
bitsID[1][i][j] = hi - 1; // highBid+1
endBucket[1][i][j] = highContain[hi]; // 锟斤拷j锟斤拷锟揭憋拷锟斤拷锟斤拷小锟斤拷endBucket[1][i][j]
doubleReverse[1][i][j] = true;
}
// 锟斤拷缀锟斤拷锟斤拷锟斤拷锟绞憋拷锟斤拷锟斤拷锟斤拷锟�?(锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟�?, 锟斤拷锟斤拷锟斤拷锟斤拷j锟斤拷lowBktId锟斤拷lowContain[li]锟斤拷锟劫硷拷一锟斤拷锟斤拷lowContain[li]锟叫匡拷锟斤拷为0); -1+1省去锟斤拷
// fix[0][i][j][numBucket]锟斤拷要锟斤拷0, 使fix[0][i][j][lowBktId]锟秸匡拷始为0
// Bug: 锟斤拷前锟斤拷锟斤拷, 锟斤拷锟叫★拷募锟斤拷锟酵帮拷?锟斤拷锟�?, 锟斤拷锟斤拷锟斤拷锟斤拷, 直锟斤拷锟矫讹拷锟截凤拷锟斤拷
if (fix[0][i][numBucket - j - 1] == fix[0][i][0])
{
bitsID[0][i][numBucket - j - 1] = numBits - 1;
endBucket[0][i][numBucket - j - 1] = numBucket - j; // traverse to >= endBucket
doubleReverse[0][i][numBucket - j - 1] = true;
}
else if (fix[0][i][numBucket - j] - fix[0][i][lowBktId] <
fix[0][i][lowContain[li]] - fix[0][i][numBucket - j - 1])
{
bitsID[0][i][numBucket - j - 1] = lowBid;
endBucket[0][i][numBucket - j - 1] = lowBktId;
doubleReverse[0][i][numBucket - j - 1] = false;
}
else
{
bitsID[0][i][numBucket - j - 1] = li - 1; // lowBktId+1
endBucket[0][i][numBucket - j - 1] = lowContain[li];
doubleReverse[0][i][numBucket - j - 1] = true;
}
// 锟斤拷时锟斤拷然锟斤拷锟节碉拷锟斤拷lowSubWorkLoad锟斤拷, 锟斤拷锟皆诧拷锟斤拷锟斤拷锟斤拷bits, 锟斤拷为bits要锟斤拷锟角碉拷j锟斤拷桶
if (fix[0][i][numBucket - j - 1] >= lowSubWorkLoad)
{
lowSubWorkLoad += subWorkLoadStep;
li++;
lowBid++;
lowBktId = numBucket - j - 1;
}
}
}
int subID, b; // 锟斤拷始锟斤拷锟斤拷锟斤拷锟斤拷锟铰憋拷
_for(i, 0, numDimension)
{ // 每锟斤拷维锟斤拷
_for(j, 0, numBucket)
{ // 每锟斤拷桶
if (doubleReverse[0][i][j])
b = bitsID[0][i][j]; // 锟斤拷小锟斤拷锟斤拷要锟斤拷锟斤拷锟絙its锟斤拷锟斤拷锟絀D
else
b = bitsID[0][i][j] + 1;
_for(k, 0, data[0][i][j].size())
{
subID = data[0][i][j][k].subID;
fullBits[i][subID] = 1; // numBits-1锟斤拷bits每锟轿憋拷锟斤拷锟斤拷
_for(q, b, numBits - 1) bits[0][i][q][subID] = 1;
}
if (doubleReverse[1][i][j])
b = bitsID[1][i][j];
else
b = bitsID[1][i][j] + 1; // 锟斤拷小锟斤拷锟斤拷要锟斤拷锟斤拷锟絙its锟斤拷锟斤拷锟絀D
_for(k, 0, data[1][i][j].size())
{ // 桶锟斤拷每锟斤拷锟斤拷锟斤拷
subID = data[1][i][j][k].subID;
_for(q, b, numBits - 1) bits[1][i][q][subID] = 1;
}
}
}
//cout << "HEM5DD Stop.\n";
}
// 锟斤拷锟斤拷锟斤拷时锟斤拷锟斤拷锟�?
void HEM5::match(const Pub& pub, int& matchSubs)
{
// 锟街诧拷锟斤拷锟斤拷锟斤拷锟斤拷锟�?
// bitset<subs>* b = new bitset<subs>; // register
// bitset<subs>* bLocal = new bitset<subs>;
// vector<bool> attExist(numDimension, false);
// int value, att, buck;
//
// _for(i, 0, pub.size)
// {
// value = pub.pairs[i].value, att = pub.pairs[i].att, buck = value / buckStep;
// attExist[att] = true;
//
// if (doubleReverse[0][att][buck])
// {
// if (bitsID[0][att][buck] == numBits - 1) // 只锟斤拷1锟斤拷bitset时锟斤拷锟斤拷fullBits锟较o拷去锟斤拷: && numBits > 1
// *bLocal = fullBits[att];
// else
// *bLocal = bits[0][att][bitsID[0][att][buck]];
// _for(j, endBucket[0][att][buck], buck + 1)
// _for(k, 0, data[0][att][j].size())
// (*bLocal)[data[0][att][j][k].subID] = 0;
//
// _for(k, 0, data[0][att][buck].size()) if (data[0][att][buck][k].val <= value)
// (*bLocal)[data[0][att][buck][k].subID] = 0;
//
// *b = *b | *bLocal;
// }
// else
// {
// _for(j, buck + 1, endBucket[0][att][buck])
// _for(k, 0, data[0][att][j].size())
// (*b)[data[0][att][j][k].subID] = 1;
//
// _for(k, 0, data[0][att][buck].size()) if (data[0][att][buck][k].val > value)
// (*b)[data[0][att][buck][k].subID] = 1;
//
// if (bitsID[0][att][buck] != -1)
// *b = *b | bits[0][att][bitsID[0][att][buck]];
// }
//
// if (doubleReverse[1][att][buck])
// {
// if (bitsID[1][att][buck] == numBits - 1) // 只锟斤拷1锟斤拷bitset时锟斤拷锟斤拷fullBits锟较o拷去锟斤拷: && numBits > 1
// *bLocal = fullBits[att];
// else
// *bLocal = bits[1][att][bitsID[1][att][buck]];
//
// _for(j, buck, endBucket[1][att][buck])
// _for(k, 0, data[1][att][j].size())
// (*bLocal)[data[1][att][j][k].subID] = 0;
//
// _for(k, 0, data[1][att][buck].size()) if (data[1][att][buck][k].val >= value)
// (*bLocal)[data[1][att][buck][k].subID] = 0;
//
// *b = *b | *bLocal;
// }
// else
// {
// _for(j, endBucket[1][att][buck], buck)
// _for(k, 0, data[1][att][j].size())
// (*b)[data[1][att][j][k].subID] = 1;
//
// _for(k, 0, data[1][att][buck].size()) if (data[1][att][buck][k].val < value)
// (*b)[data[1][att][buck][k].subID] = 1;
//
// if (bitsID[1][att][buck] != -1)
// *b = *b | bits[1][att][bitsID[1][att][buck]]; // Bug: 锟斤拷att锟斤拷锟斤拷i
// }
// }
// _for(i, 0, numDimension) if (!attExist[i])
// *b = *b | fullBits[i];
// matchSubs = numSub - b->count();
// 锟街诧拷锟斤拷锟斤拷锟斤拷栈锟斤拷
bitset<subs> b; // register
bitset<subs> bLocal;
vector<bool> attExist(numDimension, false);
int value, att, buck;
for (const auto& pp : pub.pairs)
{
value = pp.value, att = pp.att, buck = value / buckStep;
attExist[att] = true;
if (doubleReverse[0][att][buck])
{
if (bitsID[0][att][buck] == numBits - 1) // 只锟斤拷1锟斤拷bitset时锟斤拷锟斤拷fullBits锟较o拷去锟斤拷: && numBits > 1
bLocal = fullBits[att];
else
bLocal = bits[0][att][bitsID[0][att][buck]];
_for(j, endBucket[0][att][buck], buck) _for(k, 0,
data[0][att][j].size()) bLocal[data[0][att][j][k].subID] = 0;
_for(k, 0, data[0][att][buck].size()) if (data[0][att][buck][k].val <= value)
bLocal[data[0][att][buck][k].subID] = 0;
#if BlockSize == 64
b |= bLocal;
#else
Util::bitsetOr(b, bLocal);
#endif
}
else
{
_for(j,
buck + 1, endBucket[0][att][buck]) _for(k, 0, data[0][att][j].size()) b[data[0][att][j][k].subID] = 1;
_for(k, 0, data[0][att][buck].size()) if (data[0][att][buck][k].val > value)
b[data[0][att][buck][k].subID] = 1;
if (bitsID[0][att][buck] != -1)
#if BlockSize == 64
b |= bits[0][att][bitsID[0][att][buck]];
#else
Util::bitsetOr(b, bits[0][att][bitsID[0][att][buck]]);
#endif
}
if (doubleReverse[1][att][buck])
{
if (bitsID[1][att][buck] == numBits - 1) // 只锟斤拷1锟斤拷bitset时锟斤拷锟斤拷fullBits锟较o拷去锟斤拷: && numBits > 1
bLocal = fullBits[att];
else
bLocal = bits[1][att][bitsID[1][att][buck]];
_for(j, buck + 1, endBucket[1][att][buck]) _for(k, 0,
data[1][att][j].size()) bLocal[data[1][att][j][k].subID] = 0;
_for(k, 0, data[1][att][buck].size()) if (data[1][att][buck][k].val >= value)
bLocal[data[1][att][buck][k].subID] = 0;
#if BlockSize == 64
b |= bLocal;
#else
Util::bitsetOr(b, bLocal);
#endif
}
else
{
_for(j, endBucket[1][att][buck], buck) _for(k, 0, data[1][att][j].size()) b[data[1][att][j][k].subID] = 1;
_for(k, 0, data[1][att][buck].size()) if (data[1][att][buck][k].val < value)
b[data[1][att][buck][k].subID] = 1;
if (bitsID[1][att][buck] != -1)
#if BlockSize == 64
b |= bits[1][att][bitsID[1][att][buck]];
#else
Util::bitsetOr(b, bits[1][att][bitsID[1][att][buck]]);
#endif
}
}
/*if (numBits > 1)
{*/
_for(i, 0, numDimension) if (!attExist[i])
#if BlockSize == 64
b |= fullBits[i];
#else
Util::bitsetOr(b, fullBits[i]);
#endif
/*}
else
{
_for(i, 0, numDimension) if (!attExist[i])
_for(j, 0, endBucket[0][i][0])
_for(k, 0, data[0][i][j].size())
b[data[0][i][j][k].subID] = 1;
_for(i, 0, numDimension) if (!attExist[i])
b = b | bits[0][i][0];
}*/
//_for(i, 0, subs) if (!b[i])
//{
// ++matchSubs;
// //cout << "HEM5 matches sub: " << i << endl;
//}
matchSubs = numSub - b.count();
}
// 锟斤拷锟斤拷时锟斤拷锟斤拷锟�?
void HEM5::match_debug(const Pub& pub, int& matchSubs)
{
bitset<subs> b, bLocal;
vector<bool> attExist(numDimension, false);
int value, att, buck;
_for(i, 0, pub.size)
{
Timer compareStart;
value = pub.pairs[i].value, att = pub.pairs[i].att, buck = value / buckStep;
attExist[att] = true;
if (doubleReverse[0][att][buck])
{
Timer markStart;
if (bitsID[0][att][buck] == numBits - 1) // 只锟斤拷1锟斤拷bitset时锟斤拷锟斤拷fullBits锟较o拷去锟斤拷: && numBits > 1
bLocal = fullBits[att];
else
bLocal = bits[0][att][bitsID[0][att][buck]];
_for(j, endBucket[0][att][buck], buck) _for(k, 0,
data[0][att][j].size()) bLocal[data[0][att][j][k].subID] = 0;
markTime += (double)markStart.elapsed_nano();
Timer compareStart;
_for(k, 0, data[0][att][buck].size()) if (data[0][att][buck][k].val <= value)
bLocal[data[0][att][buck][k].subID] = 0;
compareTime += (double)compareStart.elapsed_nano();
Timer orStart;
#if BlockSize == 64
b |= bLocal;
#else
Util::bitsetOr(b, bLocal);
#endif
orTime += (double)orStart.elapsed_nano();
}
else
{
Timer markStart;
_for(j, buck + 1, endBucket[0][att][buck]) _for(k, 0,
data[0][att][j].size()) b[data[0][att][j][k].subID] = 1;
markTime += (double)markStart.elapsed_nano();
Timer compareStart;
_for(k, 0, data[0][att][buck].size()) if (data[0][att][buck][k].val > value)
b[data[0][att][buck][k].subID] = 1;
compareTime += (double)compareStart.elapsed_nano();
Timer orStart;
if (bitsID[0][att][buck] != -1)
#if BlockSize == 64
b |= bits[0][att][bitsID[0][att][buck]];
#else
Util::bitsetOr(b, bits[0][att][bitsID[0][att][buck]]);
#endif
orTime += (double)orStart.elapsed_nano();
}
if (doubleReverse[1][att][buck])
{
Timer markStart;
if (bitsID[1][att][buck] == numBits - 1) // 只锟斤拷1锟斤拷bitset时锟斤拷锟斤拷fullBits锟较o拷去锟斤拷: && numBits > 1
bLocal = fullBits[att];
else
bLocal = bits[1][att][bitsID[1][att][buck]];
_for(j, buck + 1, endBucket[1][att][buck]) _for(k, 0,
data[1][att][j].size()) bLocal[data[1][att][j][k].subID] = 0;
markTime += (double)markStart.elapsed_nano();
Timer compareStart;
_for(k, 0, data[1][att][buck].size()) if (data[1][att][buck][k].val >= value)
bLocal[data[1][att][buck][k].subID] = 0;
compareTime += (double)compareStart.elapsed_nano();
Timer orStart;
#if BlockSize == 64
b |= bLocal;
#else
Util::bitsetOr(b, bLocal);
#endif
orTime += (double)orStart.elapsed_nano();
}
else
{
Timer markStart;
_for(j, endBucket[1][att][buck], buck) _for(k, 0, data[1][att][j].size()) b[data[1][att][j][k].subID] = 1;
markTime += (double)markStart.elapsed_nano();
Timer compareStart;
_for(k, 0, data[1][att][buck].size()) if (data[1][att][buck][k].val < value)
b[data[1][att][buck][k].subID] = 1;
compareTime += (double)compareStart.elapsed_nano();
Timer orStart;
if (bitsID[1][att][buck] != -1)
#if BlockSize == 64
b |= bits[1][att][bitsID[1][att][buck]];
#else
Util::bitsetOr(b, bits[1][att][bitsID[1][att][buck]]);
#endif
orTime += (double)orStart.elapsed_nano();
}
}
// if (numBits > 1) {
Timer orStart;
_for(i, 0, numDimension) if (!attExist[i])
#if BlockSize == 64
b |= fullBits[i];
#else
Util::bitsetOr(b, fullBits[i]);
#endif
orTime += (double)orStart.elapsed_nano();
// } else {
// Timer markStart;
// _for(i, 0, numDimension) if (!attExist[i])
// _for(j, 0, endBucket[0][i][0]) _for(k, 0, data[0][i][j].size()) b[data[0][i][j][k].subID] = 1;
// markTime += (double) markStart.elapsed_nano();
//
// Timer orStart;
// _for(i, 0, numDimension) if (!attExist[i])
// b = b | bits[0][i][0];
// orTime += (double) orStart.elapsed_nano();
// }
Timer bitStart;
_for(i, 0, subs) if (!b[i]) {
++matchSubs;
//cout << "HEM5 matches sub: " << i << endl;
}
// matchSubs = subs - b.count();
bitTime += (double)bitStart.elapsed_nano();
}
void HEM5::match_parallel(const Pub& pub, int& matchSubs)
{
vector<future<bitset<subs>>> threadResult;
int seg = pub.size / parallelDegree;
int remainder = pub.size % parallelDegree;
int tId = 0, end;
for (int begin = 0; begin < pub.size; begin = end, tId++)
{
if (tId < remainder)
end = begin + seg + 1;
else end = begin + seg;
threadResult.emplace_back(threadPool.enqueue([this, &pub, begin, end]
{
// 锟街诧拷锟斤拷锟斤拷锟斤拷栈锟斤拷
bitset<subs> b; // register
bitset<subs> bLocal;
for (int i = begin,value, att, buck; i < end; i++)
{
value = pub.pairs[i].value, att = pub.pairs[i].att, buck = value / buckStep;
if (doubleReverse[0][att][buck])
{
if (bitsID[0][att][buck] == numBits - 1) // 只锟斤拷1锟斤拷bitset时锟斤拷锟斤拷fullBits锟较o拷去锟斤拷: && numBits > 1
bLocal = fullBits[att];
else
bLocal = bits[0][att][bitsID[0][att][buck]];
_for(j, endBucket[0][att][buck], buck) _for(k, 0,
data[0][att][j].size()) bLocal[data[0][att][j][k].subID] = 0;
_for(k, 0, data[0][att][buck].size()) if (data[0][att][buck][k].val <= value)
bLocal[data[0][att][buck][k].subID] = 0;
#if BlockSize == 64
b |= bLocal;
#else
Util::bitsetOr(b, bLocal);
#endif
}
else
{
_for(j, buck + 1, endBucket[0][att][buck]) _for(k, 0,
data[0][att][j].size()) b[data[0][att][j][k].subID] = 1;
_for(k, 0, data[0][att][buck].size()) if (data[0][att][buck][k].val > value)
b[data[0][att][buck][k].subID] = 1;
if (bitsID[0][att][buck] != -1)
#if BlockSize == 64
b |= bits[0][att][bitsID[0][att][buck]];
#else
Util::bitsetOr(b, bits[0][att][bitsID[0][att][buck]]);
#endif
}
if (doubleReverse[1][att][buck])
{
if (bitsID[1][att][buck] == numBits - 1) // 只锟斤拷1锟斤拷bitset时锟斤拷锟斤拷fullBits锟较o拷去锟斤拷: && numBits > 1
bLocal = fullBits[att];
else
bLocal = bits[1][att][bitsID[1][att][buck]];
_for(j, buck + 1, endBucket[1][att][buck]) _for(k, 0,
data[1][att][j].size()) bLocal[data[1][att][j][k].subID] = 0;
_for(k, 0, data[1][att][buck].size()) if (data[1][att][buck][k].val >= value)
bLocal[data[1][att][buck][k].subID] = 0;
#if BlockSize == 64
b |= bLocal;
#else
Util::bitsetOr(b, bLocal);
#endif
}
else
{
_for(j, endBucket[1][att][buck], buck) _for(k, 0,
data[1][att][j].size()) b[data[1][att][j][k].subID] = 1;
_for(k, 0, data[1][att][buck].size()) if (data[1][att][buck][k].val < value)
b[data[1][att][buck][k].subID] = 1;
if (bitsID[1][att][buck] != -1)
#if BlockSize == 64
b |= bits[1][att][bitsID[1][att][buck]];
#else
Util::bitsetOr(b, bits[1][att][bitsID[1][att][buck]]);
#endif
}
}
return b;
}));
}
bitset<subs> gb;
if (pub.size < atts)
{
vector<bool> attExist(numDimension, false);
for (const auto item : pub.pairs)
attExist[item.att] = true;
/*if (numBits > 1)
{*/
_for(i, 0, numDimension) if (!attExist[i])
#if BlockSize == 64
gb |= fullBits[i];
#else
Util::bitsetOr(gb, fullBits[i]);
#endif
/*}
else
{
_for(i, 0, numDimension) if (!attExist[i])
_for(j, 0, endBucket[0][i][0])
_for(k, 0, data[0][i][j].size())
b[data[0][i][j][k].subID] = 1;
_for(i, 0, numDimension) if (!attExist[i])
b = b | bits[0][i][0];
}*/
}
// vector<bitset<subs>> threadResult2;
// for (int i = 0; i < parallelDegree; i++)
// threadResult2.emplace_back(threadResult[i].get());
#ifdef DEBUG // 锟斤拷锟节碉拷锟竭程归并锟斤拷锟斤拷锟矫伙拷锟�? 锟斤拷取锟斤拷锟斤拷锟竭程的诧拷锟街斤拷锟斤拷锟�? 锟脚匡拷始锟斤拷时锟斤拷锟酵会导锟铰诧拷锟斤拷平
Timer mergeStart;
#endif
// int pDi = (parallelDegree + 1) >> 1, pDn = parallelDegree;
// while (pDn > 1) {
// for (int i = 0; i < pDi; i++) {
// if (i + pDi < pDn)
// threadResult[i] = threadPool.enqueue([&, i](int j) {
// return threadResult2[i] | threadResult2[j];
// }, i + pDi);
// }
// for (int i = 0; i < pDi; i++) {
// if (i + pDi < pDn)
// threadResult2[i]=threadResult[i].get();
// }
// pDn = pDi;
// pDi = (pDi + 1) >> 1;
// }
for (int i = 0; i < threadResult.size(); i++)
#if BlockSize == 64
gb |= threadResult[i].get();
#else
Util::bitsetOr(gb, threadResult[i].get());
#endif
// for (int i = 0; i < threadResult2.size(); i++)
// gb |= threadResult2[i];
#ifdef DEBUG
mergeTime+=(double)mergeStart.elapsed_nano();
Timer bitStart;
#endif
// if (pub.size < atts) {
// gb |= (threadResult2[0]);
// matchSubs = numSub - gb.count();
// } else {
// matchSubs = numSub - threadResult2[0].count();
// }
matchSubs = numSub - gb.count();
#ifdef DEBUG
bitTime += (double)bitStart.elapsed_nano();
#endif // DEBUG
}
void HEM5::match_avxOR_parallel(const Pub& pub, int& matchSubs)
{
vector<future<bitset<subs>>> threadResult;
int seg = pub.size / parallelDegree;
int remainder = pub.size % parallelDegree;
int tId = 0, end;
for (int begin = 0; begin < pub.size; begin = end, tId++)
{
if (tId < remainder)
end = begin + seg + 1;
else end = begin + seg;
threadResult.emplace_back(threadPool.enqueue([this, &pub, begin, end]
{
bitset<subs> b; // register
bitset<subs> bLocal;
int value, att, buck;
for (int i = begin; i < end; i++)
{
value = pub.pairs[i].value, att = pub.pairs[i].att, buck = value / buckStep;
if (doubleReverse[0][att][buck])
{
if (bitsID[0][att][buck] == numBits - 1) // 只锟斤拷1锟斤拷bitset时锟斤拷锟斤拷fullBits锟较o拷去锟斤拷: && numBits > 1
bLocal = fullBits[att];
else
bLocal = bits[0][att][bitsID[0][att][buck]];
_for(j, endBucket[0][att][buck], buck) for (auto&& iCob : data[0][att][j])
bLocal[iCob.subID] = 0;
_for(k, 0, data[0][att][buck].size()) if (data[0][att][buck][k].val <= value)
bLocal[data[0][att][buck][k].subID] = 0;
#if BlockSize == 64
b |= bLocal;
#else
Util::bitsetOr(b, bLocal);
#endif
}
else
{
_for(j, buck + 1, endBucket[0][att][buck]) for (auto&& iCob : data[0][att][j])
b[iCob.subID] = 1;
_for(k, 0, data[0][att][buck].size()) if (data[0][att][buck][k].val > value)
b[data[0][att][buck][k].subID] = 1;
// if (bitsID[0][att][buck] != -1)
// Util::bitsetOr(b, bits[0][att][bitsID[0][att][buck]]);//b = b | bits[0][att][bitsID[0][att][buck]];
#if BlockSize == 64
b |= bits[0][att][bitsID[0][att][buck]];
#else
Util::bitsetOr(b, bits[0][att][bitsID[0][att][buck]]);
#endif
}
if (doubleReverse[1][att][buck])
{
if (bitsID[1][att][buck] == numBits - 1) // 只锟斤拷1锟斤拷bitset时锟斤拷锟斤拷fullBits锟较o拷去锟斤拷: && numBits > 1
bLocal = fullBits[att];
else
bLocal = bits[1][att][bitsID[1][att][buck]];
_for(j, buck + 1, endBucket[1][att][buck]) for (auto&& iCob : data[1][att][j])
bLocal[iCob.subID] = 0;
_for(k, 0, data[1][att][buck].size()) if (data[1][att][buck][k].val >= value)
bLocal[data[1][att][buck][k].subID] = 0;