GENIE
inv_list.h
Go to the documentation of this file.
1 
5 #ifndef GPUGenie_inv_list_h
6 #define GPUGenie_inv_list_h
7 
8 #include <vector>
9 #include <string>
10 #include <unordered_map>
11 
12 namespace genie
13 {
14 namespace table
15 {
16 
23 class inv_list
24 {
25 public:
26  /* \var vector<int> distinct_value_sequence
27  * \brief Used in sequence search. compact the range.
28  */
29  std::unordered_map<int, int> _distinct;
30 
31 
32 private:
36  int _size;
37 
41  std::pair<int, int> _bound;
42 
49  std::vector<std::vector<int> > _inv;
50 
54  unsigned int shift_bits_subsequence;
55 
56 
57 public:
62  _size(0)
63  {
64  }
65 
71  inv_list(std::vector<int>& vin);
72 
78  inv_list(std::vector<int>* vin);
79 
84  unsigned int
95  void
96  invert_bijectMap(std::vector<std::vector<int> > & vin);
97 
109  void
110  invert_bijectMap(int *data, unsigned int item_num, unsigned int *index, unsigned int row_num);
111 
117  void
118  invert_subsequence(std::vector<std::vector<int>> & vin);
119 
120 
129  void
130  invert_subsequence(int *data, unsigned int item_num, unsigned int * index, unsigned int row_num);
131 
138  void
139  invert_sequence(std::vector<std::vector<int>> & vin, int shift_bits);
140  //invert_sequence(vector<vector<int> > & vin, int & shift_bits, vector<int> & respective_id);
141 
142 
150  inv_list(std::vector<std::string>& vin);
151 
159  inv_list(std::vector<std::string>* vin);
160 
166  int
167  min();
168 
174  int
175  max();
176 
182  int
183  size();
184 
190  void
191  invert(std::vector<int>& vin);
192 
198  void
199  invert(std::vector<int>* vin);
200 
208  void
209  invert(std::vector<std::string>& vin);
210 
218  void
219  invert(std::vector<std::string>* vin);
220 
233  void
234  invert(std::vector<std::string>& vin, int (*stoi)(std::string&));
235 
248  void
249  invert(std::vector<std::string>* vin, int (*stoi)(std::string&));
250 
258  bool
259  contains(int value);
260 
273  std::vector<int>*
274  index(int value);
275 
281  int
282  value_range();
283 
284 };
285 
286 } // namespace table
287 } // namespace genie
288 
289 #endif
void invert_bijectMap(std::vector< std::vector< int > > &vin)
int size()
Return the number of instances.
Definition: inv_list.cc:47
This is the top-level namespace of the project.
void invert_subsequence(std::vector< std::vector< int >> &vin)
inv_list()
Create an empty inv_list.
Definition: inv_list.h:61
std::unordered_map< int, int > _distinct
Definition: inv_list.h:29
unsigned int _shift_bits_subsequence()
Definition: inv_list.cc:290
int max()
Return the max value of the inverted vector.
Definition: inv_list.cc:42
int value_range()
Return the number of different values in the attribute.
Definition: inv_list.cc:389
int min()
Return the min value of the inverted vector.
Definition: inv_list.cc:37
std::vector< int > * index(int value)
The indexes of the value.
Definition: inv_list.cc:381
This class manages one inverted list.
Definition: inv_list.h:23
void invert(std::vector< int > &vin)
bool contains(int value)
Check whether the vaule is in the inv_list.
Definition: inv_list.cc:373
void invert_sequence(std::vector< std::vector< int >> &vin, int shift_bits)
This is used for sequence match.
Definition: inv_list.cc:87