effspm 0.2.8__cp39-cp39-win_amd64.whl → 0.3.3__cp39-cp39-win_amd64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. effspm/_effspm.cp39-win_amd64.pyd +0 -0
  2. effspm/_effspm.cpp +961 -210
  3. effspm/btminer/src/build_mdd.cpp +42 -17
  4. effspm/btminer/src/build_mdd.hpp +13 -19
  5. effspm/btminer/src/freq_miner.cpp +134 -49
  6. effspm/btminer/src/freq_miner.hpp +16 -0
  7. effspm/btminer/src/load_inst.cpp +211 -126
  8. effspm/btminer/src/load_inst.hpp +22 -4
  9. effspm/btminer/src/main.cpp +83 -0
  10. effspm/btminer/src/utility.cpp +26 -41
  11. effspm/btminer/src/utility.hpp +6 -30
  12. effspm/freq_miner.hpp +2 -1
  13. effspm/htminer/src/build_mdd.cpp +46 -124
  14. effspm/htminer/src/build_mdd.hpp +56 -49
  15. effspm/htminer/src/freq_miner.cpp +341 -307
  16. effspm/htminer/src/freq_miner.hpp +39 -40
  17. effspm/htminer/src/load_inst.cpp +287 -336
  18. effspm/htminer/src/load_inst.hpp +23 -6
  19. effspm/htminer/src/main.cpp +97 -0
  20. effspm/htminer/src/utility.cpp +38 -57
  21. effspm/htminer/src/utility.hpp +9 -64
  22. effspm/largebm/src/build_mdd.cpp +69 -110
  23. effspm/largebm/src/build_mdd.hpp +22 -37
  24. effspm/largebm/src/freq_miner.cpp +241 -291
  25. effspm/largebm/src/freq_miner.hpp +25 -36
  26. effspm/largebm/src/load_inst.cpp +20 -26
  27. effspm/largebm/src/load_inst.hpp +24 -34
  28. effspm/largebm/src/main.cpp +95 -0
  29. effspm/largebm/src/utility.cpp +11 -21
  30. effspm/largebm/src/utility.hpp +7 -10
  31. effspm/largehm/src/build_mdd.cpp +75 -110
  32. effspm/largehm/src/build_mdd.hpp +53 -73
  33. effspm/largehm/src/freq_miner.cpp +134 -191
  34. effspm/largehm/src/freq_miner.hpp +37 -60
  35. effspm/largehm/src/load_inst.cpp +137 -174
  36. effspm/largehm/src/load_inst.hpp +13 -50
  37. effspm/largehm/src/main.cpp +95 -0
  38. effspm/largehm/src/utility.cpp +46 -28
  39. effspm/largehm/src/utility.hpp +18 -16
  40. effspm/largepp/src/freq_miner.cpp +184 -156
  41. effspm/largepp/src/freq_miner.hpp +11 -36
  42. effspm/largepp/src/load_inst.cpp +32 -12
  43. effspm/largepp/src/load_inst.hpp +15 -9
  44. effspm/largepp/src/main.cpp +108 -0
  45. effspm/largepp/src/pattern.hpp +31 -0
  46. effspm/load_inst.cpp +8 -8
  47. effspm/load_inst.hpp +1 -1
  48. effspm/main.cpp +103 -0
  49. {effspm-0.2.8.dist-info → effspm-0.3.3.dist-info}/METADATA +1 -1
  50. effspm-0.3.3.dist-info/RECORD +60 -0
  51. effspm-0.2.8.dist-info/RECORD +0 -53
  52. {effspm-0.2.8.dist-info → effspm-0.3.3.dist-info}/WHEEL +0 -0
  53. {effspm-0.2.8.dist-info → effspm-0.3.3.dist-info}/licenses/LICENSE +0 -0
  54. {effspm-0.2.8.dist-info → effspm-0.3.3.dist-info}/top_level.txt +0 -0
@@ -1,173 +1,138 @@
1
- // ─── effspm/largehm/src/build_mdd.cpp ─────────────────────────────────────────
2
-
3
- #include "build_mdd.hpp"
4
-
5
- // ─── Definitions of the extern globals declared in build_mdd.hpp ─────────────
6
- std::vector<largehm::Arc> largehm::Tree;
7
- std::vector<largehm::VArc> largehm::VTree;
8
- std::vector<largehm::CArc> largehm::CTree;
9
-
10
1
  #include <vector>
11
2
  #include <iostream>
12
- #include <cmath> // for std::abs
13
3
  #include <unordered_map>
14
- #include <cstdint> // for std::uint64_t
15
4
  #include "load_inst.hpp"
5
+ #include "build_mdd.hpp"
16
6
  #include "freq_miner.hpp"
17
7
  #include "utility.hpp"
18
8
 
19
9
  namespace largehm {
20
10
 
21
- //
22
- // ─── Build the MDD by sequentially calling Add_arc() then possibly Add_vec() ──
23
- //
24
- void Build_MDD(std::vector<int>& items, std::vector<int>& items_lim) {
25
- // SANITY CHECK: show sizes before building
26
-
27
- std::unordered_map<int, std::uint64_t> ancest_map;
28
- std::uint64_t last_arc = 0;
29
- int itmset = 0;
11
+ using namespace std;
12
+
13
+ int Add_arc(int item,
14
+ unsigned long long int last_arc,
15
+ int& itmset,
16
+ unordered_map<int, unsigned long long int>& ancest_map);
30
17
 
31
- // Insert each prefix item as an arc
32
- for (auto it = items.begin(); it != items.end(); ++it) {
18
+ void Add_vec(vector<int>& items_lim,
19
+ unordered_map<int, unsigned long long int>& ancest_map,
20
+ unsigned long long int last_arc,
21
+ int itmset);
22
+
23
+ vector<Arc> Tree;
24
+ vector<VArc> VTree;
25
+ vector<CArc> CTree;
26
+
27
+ void Build_MDD(vector<int>& items, vector<int>& items_lim) {
28
+
29
+ unordered_map<int, unsigned long long int> ancest_map;
30
+
31
+ unsigned long long int last_arc = 0;
32
+ int itmset = 0;
33
+ for (vector<int>::iterator it = items.begin(); it != items.end(); ++it)
33
34
  last_arc = Add_arc(*it, last_arc, itmset, ancest_map);
34
- }
35
35
 
36
- // If there is a suffix beyond mlim, attach it via Add_vec()
37
- if (!items_lim.empty()) {
36
+ if (!items_lim.empty())
38
37
  Add_vec(items_lim, ancest_map, last_arc, itmset);
39
- }
40
38
  }
41
39
 
42
-
43
- //
44
- // ─── Add_arc: insert a single “item” into the MDD under parent last_arc. ──────
45
- //
46
40
  int Add_arc(int item,
47
- std::uint64_t last_arc,
41
+ unsigned long long int last_arc,
48
42
  int& itmset,
49
- std::unordered_map<int, std::uint64_t>& ancest_map)
50
- {
51
- // Ensure DFS is at least size |item|
52
- size_t needed = static_cast<size_t>(std::abs(item));
53
- if (DFS.size() < needed) {
54
- size_t old = DFS.size();
55
- DFS.resize(needed);
56
- for (size_t i = old; i < needed; ++i) {
57
- DFS[i] = Pattern(-static_cast<int>(i) - 1);
58
- }
59
- }
43
+ unordered_map<int, unsigned long long int>& ancest_map) {
60
44
 
61
- unsigned int anct = 0;
62
- auto p = ancest_map.find(std::abs(item));
63
- if (p != ancest_map.end()) {
45
+ unsigned int anct;
46
+ unordered_map<int, unsigned long long int>::iterator p = ancest_map.find(abs(item));
47
+ if (p == ancest_map.end())
48
+ anct = 0;
49
+ else
64
50
  anct = p->second;
65
- }
66
51
 
67
- if (item < 0) {
52
+ if (item < 0)
68
53
  ++itmset;
69
- }
70
54
 
71
- std::uint64_t last_sibl = Tree[last_arc].chld;
55
+ unsigned long long int last_sibl = Tree[last_arc].chld;
56
+
72
57
  if (last_sibl == 0) {
73
- // No child yet: create a new Arc
74
58
  Tree.emplace_back(item, itmset, anct);
75
59
  last_sibl = Tree.size() - 1;
76
60
  Tree[last_arc].chld = last_sibl;
77
- if (anct == 0) {
78
- DFS[std::abs(item) - 1].str_pnt.push_back(last_sibl);
79
- }
61
+ if (anct == 0)
62
+ DFS[abs(item) - 1].str_pnt.push_back(last_sibl);
63
+
80
64
  }
81
65
  else {
82
- // Traverse siblings until we find a match or append
83
66
  while (Tree[last_sibl].item != item) {
84
67
  if (Tree[last_sibl].sibl == 0) {
85
68
  Tree.emplace_back(item, itmset, anct);
86
69
  Tree[last_sibl].sibl = Tree.size() - 1;
87
70
  last_sibl = Tree.size() - 1;
88
- if (anct == 0) {
89
- DFS[std::abs(item) - 1].str_pnt.push_back(last_sibl);
90
- }
71
+ if (anct == 0)
72
+ DFS[abs(item) - 1].str_pnt.push_back(last_sibl);
91
73
  break;
92
74
  }
93
75
  last_sibl = Tree[last_sibl].sibl;
94
76
  }
95
77
  }
96
78
 
97
- if (anct == 0) {
98
- ++DFS[std::abs(item) - 1].freq;
99
- }
79
+ if (anct == 0)
80
+ ++DFS[abs(item) - 1].freq;
81
+
100
82
  ++Tree[last_sibl].freq;
101
- ancest_map[std::abs(item)] = last_sibl;
102
- return static_cast<int>(last_sibl);
103
- }
104
83
 
84
+ ancest_map[abs(item)] = last_sibl;
105
85
 
106
- //
107
- // ─── Add_vec: attach the “items_lim” vector as children/vertical arcs ─────────
108
- //
109
- void Add_vec(std::vector<int>& items_lim,
110
- std::unordered_map<int, std::uint64_t>& ancest_map,
111
- std::uint64_t last_arc,
112
- int itmset)
113
- {
114
- // Ensure VDFS and DFS are at least size L
115
- if (VDFS.size() < static_cast<size_t>(L)) {
116
- size_t old = VDFS.size();
117
- VDFS.resize(static_cast<size_t>(L));
118
- for (size_t i = old; i < VDFS.size(); ++i) {
119
- VDFS[i] = VPattern(static_cast<int>(i));
120
- }
121
- }
122
- if (DFS.size() < static_cast<size_t>(L)) {
123
- size_t old = DFS.size();
124
- DFS.resize(static_cast<size_t>(L));
125
- for (size_t i = old; i < DFS.size(); ++i) {
126
- DFS[i] = Pattern(-static_cast<int>(i) - 1);
127
- }
128
- }
86
+ return last_sibl;
87
+ }
88
+
89
+ void Add_vec(vector<int>& items_lim,
90
+ unordered_map<int, unsigned long long int>& ancest_map,
91
+ unsigned long long int last_arc,
92
+ int itmset) {
129
93
 
130
94
  items_lim.shrink_to_fit();
131
- std::vector<bool> counted(L, false);
132
-
133
- // If this node has positive itmset (>0) or no CTree child yet, create first child entry
134
- if (Tree[last_arc].itmset > 0 || Tree[last_arc].chld == 0) {
135
- std::vector<std::uint64_t> ancest(L + 1, 0ULL);
136
- for (auto& kv : ancest_map) {
137
- ancest[kv.first - 1] = kv.second;
138
- counted[kv.first - 1] = true;
95
+ vector<bool> counted(L, 0);
96
+
97
+ if (Tree[last_arc].itmset > 0) {
98
+ vector<unsigned long long int> ancest(L + 1, 0); // last element is CArc child
99
+ for (unordered_map<int, unsigned long long int>::iterator p = ancest_map.begin();
100
+ p != ancest_map.end(); ++p) {
101
+ ancest[p->first - 1] = p->second;
102
+ counted[p->first - 1] = 1;
139
103
  }
140
- for (int i = 0; i < static_cast<int>(items_lim.size()); ++i) {
141
- int cur_itm = std::abs(items_lim[i]);
104
+ for (int i = 0; i < (int)items_lim.size(); ++i) {
105
+ int cur_itm = abs(items_lim[i]);
142
106
  if (!counted[cur_itm - 1]) {
143
- if (i + 1 < static_cast<int>(items_lim.size())) {
144
- VDFS[cur_itm - 1].str_pnt.push_back(-i - 1);
107
+ if (i + 1 < (int)items_lim.size()) {
108
+ VDFS[cur_itm - 1].str_pnt.push_back(-i - 1); // negative = CTree
145
109
  VDFS[cur_itm - 1].seq_ID.push_back(CTree.size());
146
110
  }
147
111
  ++DFS[cur_itm - 1].freq;
148
- counted[cur_itm - 1] = true;
112
+ counted[cur_itm - 1] = 1;
149
113
  }
150
114
  }
151
115
  CTree.emplace_back(ancest, items_lim);
152
- Tree[last_arc].chld = CTree.size() - 1;
153
- Tree[last_arc].itmset = -itmset;
116
+ Tree[last_arc].chld = CTree.size() - 1;
117
+ Tree[last_arc].itmset = -itmset; // negative itmset = connection to CTree
154
118
  }
155
119
  else {
156
- // Normal “existing CTree child” path
157
- auto& ancest = CTree[ Tree[last_arc].chld ].ancest;
158
- for (int i = 0; i < static_cast<int>(items_lim.size()); ++i) {
159
- int cur_itm = std::abs(items_lim[i]);
160
- if (!counted[cur_itm - 1] && ancest[cur_itm - 1] == 0ULL) {
161
- if (i + 1 < static_cast<int>(items_lim.size())) {
120
+ vector<unsigned long long int>& ancest = CTree[Tree[last_arc].chld].ancest;
121
+ for (int i = 0; i < (int)items_lim.size(); ++i) {
122
+ int cur_itm = abs(items_lim[i]);
123
+ if (!counted[cur_itm - 1] && ancest[cur_itm - 1] == 0) {
124
+ if (i + 1 < (int)items_lim.size()) {
162
125
  VDFS[cur_itm - 1].str_pnt.push_back(i + 1);
163
126
  VDFS[cur_itm - 1].seq_ID.push_back(VTree.size());
164
127
  }
165
128
  ++DFS[cur_itm - 1].freq;
166
- counted[cur_itm - 1] = true;
129
+ counted[cur_itm - 1] = 1;
167
130
  }
168
131
  }
169
- VTree.emplace_back(items_lim, CTree[ Tree[last_arc].chld ].ancest.back());
170
- CTree[ Tree[last_arc].chld ].ancest.back() = VTree.size();
132
+ VTree.emplace_back(items_lim,
133
+ CTree[Tree[last_arc].chld].ancest.back());
134
+ // VTree siblings and CTree children are +1 of their actual position
135
+ CTree[Tree[last_arc].chld].ancest.back() = VTree.size();
171
136
  }
172
137
  }
173
138
 
@@ -1,93 +1,73 @@
1
- #ifndef LARGEHM_BUILD_MDD_HPP
2
- #define LARGEHM_BUILD_MDD_HPP
1
+ #pragma once
3
2
 
4
3
  #include <vector>
5
- #include <unordered_map>
6
- #include <cstddef> // for size_t
7
- #include <cstdint> // for uint64_t
8
-
9
- #include "load_inst.hpp" // defines L, DFS, VDFS, Tree, etc.
10
- #include "freq_miner.hpp" // for Pattern, VPattern
11
- #include "utility.hpp" // if you need check_parent or collected
4
+ #include <cmath>
5
+ #include "load_inst.hpp"
12
6
 
13
7
  namespace largehm {
14
8
 
15
- //
16
- // ─── Types & Globals ─────────────────────────────────────────────────────────
17
- //
18
-
19
- struct Arc;
20
- struct VArc;
21
- struct CArc;
22
-
23
- extern std::vector<Arc> Tree;
24
- extern std::vector<VArc> VTree;
25
- extern std::vector<CArc> CTree;
26
-
27
- //
28
- // ─── Public API ───────────────────────────────────────────────────────────────
29
- //
30
-
31
- void Build_MDD(std::vector<int>& items,
32
- std::vector<int>& items_lim);
33
-
34
- //
35
- // ─── Internal Helpers ─────────────────────────────────────────────────────────
36
- //
37
-
38
- int Add_arc(int item,
39
- std::uint64_t last_arc,
40
- int& itmset,
41
- std::unordered_map<int, std::uint64_t>& ancest_map);
42
-
43
- void Add_vec(std::vector<int>& items_lim,
44
- std::unordered_map<int, std::uint64_t>& ancest_map,
45
- std::uint64_t last_arc,
46
- int itmset);
47
-
48
- //
49
- // ─── Struct Definitions ───────────────────────────────────────────────────────
50
- //
51
-
52
- struct Arc {
53
- int item;
54
- int itmset;
55
- std::uint64_t anct;
56
- std::uint64_t chld;
57
- std::uint64_t sibl;
58
- unsigned long long freq;
9
+ using namespace std;
10
+
11
+ void Build_MDD(vector<int>& items, vector<int>& items_lim);
12
+
13
+ class Arc {
14
+ public:
15
+ unsigned long long int chld;
16
+ unsigned long long int sibl;
17
+ unsigned long long int freq;
18
+ unsigned long long int anct;
19
+ int itmset;
20
+ int item;
21
+
22
+ Arc(unsigned int _itm, int _itmset, unsigned long long int _anc) {
23
+ chld = 0;
24
+ sibl = 0;
25
+ freq = 0;
26
+ itmset = _itmset;
27
+ anct = _anc;
28
+ item = _itm;
29
+ }
59
30
 
60
- Arc(int _item, int _itmset, std::uint64_t _anct)
61
- : item(_item), itmset(_itmset), anct(_anct),
62
- chld(0), sibl(0), freq(0u) {}
31
+ Arc() {
32
+ chld = 0;
33
+ sibl = 0;
34
+ freq = 0;
35
+ anct = 0;
36
+ itmset = 0;
37
+ item = 0;
38
+ }
63
39
  };
64
40
 
65
- struct VArc {
66
- std::vector<int> seq;
67
- std::uint64_t sibl;
68
- unsigned long long freq;
41
+ class VArc {
42
+ public:
43
+ unsigned long long int sibl;
44
+ vector<int> seq;
69
45
 
70
- explicit VArc(std::vector<int>& items, std::uint64_t _sibl)
71
- : seq(), sibl(_sibl), freq(0u)
72
- {
46
+ VArc(vector<int>& items, unsigned long long int _sib) {
47
+ sibl = _sib;
73
48
  seq.swap(items);
74
49
  }
50
+
51
+ VArc() {
52
+ sibl = 0;
53
+ }
75
54
  };
76
55
 
77
- struct CArc {
78
- std::vector<std::uint64_t> ancest;
79
- std::vector<int> seq;
80
- unsigned long long freq;
56
+ class CArc {
57
+ public:
58
+ vector<int> seq;
59
+ vector<unsigned long long int> ancest;
81
60
 
82
- explicit CArc(std::vector<std::uint64_t>& _anc,
83
- std::vector<int>& items)
84
- : ancest(), seq(), freq(0u)
85
- {
61
+ CArc(vector<unsigned long long int>& _anc, vector<int>& items) {
86
62
  ancest.swap(_anc);
87
63
  seq.swap(items);
88
64
  }
65
+
66
+ CArc() = default;
89
67
  };
90
68
 
91
- } // namespace largehm
69
+ extern vector<Arc> Tree;
70
+ extern vector<VArc> VTree;
71
+ extern vector<CArc> CTree;
92
72
 
93
- #endif // LARGEHM_BUILD_MDD_HPP
73
+ } // namespace largehm