-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathalgo_intersection.h
77 lines (51 loc) · 2.7 KB
/
algo_intersection.h
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
#ifndef _ALGO_INTERSECTION_H_
#define _ALGO_INTERSECTION_H_
#include <stdint.h>
#include "bloom_filter.hpp"
uint32_t bisearch_intersection(const uint32_t* a, uint32_t a_len, const uint32_t* b, uint32_t b_len, uint32_t* c);
uint32_t block_merge_intersection(const uint32_t* a, uint32_t a_len, const uint32_t* b, uint32_t b_len, uint32_t* c);
bloom_filter* create_bloom_filter(const uint32_t* a, uint32_t a_len);
uint32_t bloomfilter_intersection(bloom_filter* filter, const uint32_t* a, uint32_t a_len, const uint32_t* b, uint32_t b_len, uint32_t* c);
size_t v1_avx2_intersection(const uint32_t *freq, size_t lenFreq, const uint32_t *rare, size_t lenRare, uint32_t *matchOut);
size_t v3_avx2_intersection(const uint32_t *freq, size_t lenFreq, const uint32_t *rare, size_t lenRare, uint32_t *matchOut);
size_t match_scalar(const uint32_t *A, const size_t lenA, const uint32_t *B, const size_t lenB, uint32_t *out);
size_t scalar(const uint32_t *A, const size_t lenA, const uint32_t *B, const size_t lenB, uint32_t *out);
size_t highlyscalable_SIMD_intersection(const uint32_t *A, const size_t s_a,
const uint32_t *B, const size_t s_b,
uint32_t *out);
void prepare_shuffling_dict32();
size_t highlyscalable_avx2_intersection(const uint32_t *A, const size_t s_a,
const uint32_t *B, const size_t s_b,
uint32_t *out);
void prepare_shuffling_dict64();
size_t highlyscalable_avx512_intersection(const uint32_t *A, const size_t s_a,
const uint32_t *B, const size_t s_b,
uint32_t *out);
size_t lemire_highlyscalable_SIMD_intersection(const uint32_t *A, const size_t s_a,
const uint32_t *B, const size_t s_b,
uint32_t *out);
////////////////////////////////////////////////////////////////////////////////////
class PrefixNode {
public:
PrefixNode* next;
uint32_t offset;
uint16_t cnt;
uint16_t prefix;
PrefixNode(PrefixNode* next, uint32_t offset, uint16_t cnt, uint16_t prefix) {
this->next = next;
this->offset = offset;
this->cnt = cnt;
this->prefix = prefix;
}
};
class PrefixList {
public:
PrefixNode* head;
uint32_t* data;
uint32_t data_len;
};
PrefixList* buildPrefixList(uint32_t* a, uint32_t a_len);
uint32_t intersectPrefixList(PrefixList* a, PrefixList* b, uint32_t* c);
void prepare_shuffling_dict16();
///////////////////////////////////////////////////////////////////////////////////
#endif