BitMagic-C++
bvsetalgebra.cpp
Go to the documentation of this file.
1 /*
2 Copyright(c) 2002-2017 Anatoliy Kuznetsov(anatoliy_kuznetsov at yahoo.com)
3 
4 Licensed under the Apache License, Version 2.0 (the "License");
5 you may not use this file except in compliance with the License.
6 You may obtain a copy of the License at
7 
8  http://www.apache.org/licenses/LICENSE-2.0
9 
10 Unless required by applicable law or agreed to in writing, software
11 distributed under the License is distributed on an "AS IS" BASIS,
12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 See the License for the specific language governing permissions and
14 limitations under the License.
15 
16 For more information please visit: http://bitmagic.io
17 */
18 
19 /** \example bvsetalgebra.cpp
20  Example demonstrates variety of algebra of sets operations.
21  http://bitmagic.io/set-algebra.html
22 
23  <a href="http://bitmagic.io/set-algebra.html">Algebra Of Sets</a>
24 
25  \sa bvector
26 
27  \sa bvector<>::bit_or
28  \sa bvector<>::bit_and
29  \sa bvector<>::bit_xor
30  \sa bvector<>::bit_sub
31 
32  \sa bm::aggregator
33  \sa bm::operation_deserializer
34 
35  \sa bm::combine_and
36  \sa bm::combine_and_sorted
37  \sa bm::combine_sub
38  \sa bm::combine_or
39  \sa bm::combine_xor
40 
41  \sa sample7.cpp
42 
43 */
44 
45 /*! \file bvsetalgebra.cpp
46  \brief Example: algebra of sets operations
47 */
48 
49 
50 #include <iostream>
51 #include <vector>
52 
53 #include "bm.h"
54 #include "bmalgo.h"
55 #include "bmserial.h"
56 #include "bmaggregator.h"
57 
58 
59 using namespace std;
60 
61 // utility function to print a set
62 static
64 {
65  bm::id_t cnt = 0;
67  for (; en.valid() && cnt < 10; ++en, ++cnt)
68  cout << *en << ", ";
69  if (cnt == 10)
70  cout << " ...";
71  cout << "(size = "<< bv.size() << ")" << endl;
72 }
73 
74 // utility function to create serialized bit-vector BLOB
75 static
76 void make_BLOB(vector<unsigned char>& target_buf, bm::bvector<>& bv)
77 {
80  bvs.set_compression_level(4);
81 
82  bv.optimize(tb, bm::bvector<>::opt_compress); // memory compression
83 
84  bm::serializer<bm::bvector<> >::buffer sbuf;
85  bvs.serialize(bv, sbuf, 0);
86  target_buf.resize(sbuf.size());
87  ::memcpy(target_buf.data(), sbuf.buf(), sbuf.size());
88 }
89 
90 
91 // -------------------------------------------------------------
92 // Demo for Set Union (OR) operations
93 //
94 static
95 void DemoOR()
96 {
97  // bit-vector set union operation: bv_A |= bv_B
98  {
99  bm::bvector<> bv_A { 1, 2, 3 };
100  bm::bvector<> bv_B { 1, 2, 4 };
101  bv_A.bit_or(bv_B);
102 
103  print_bvector(bv_A); // 1, 2, 3, 4
104  }
105  // same, but sizes are set, observe size gets extended up
106  {
107  bm::bvector<> bv_A { 1, 2, 3 };
108  bm::bvector<> bv_B { 1, 2, 4 };
109  bv_A.resize(5);
110  bv_B.resize(10);
111 
112  bv_A.bit_or(bv_B);
113 
114  print_bvector(bv_A); // 1, 2, 3, 4 (size = 10)
115  }
116  // 3-operand OR: bv_T = bv_A | bv_B
117  {
118  bm::bvector<> bv_T;
119  bm::bvector<> bv_A { 1, 2, 3 };
120  bm::bvector<> bv_B { 1, 2, 4 };
121 
122  bv_T.bit_or(bv_A, bv_B, bm::bvector<>::opt_compress);
123 
124  print_bvector(bv_T); // 1, 2, 3, 4 (size = 10)
125  }
126 
127 
128  // merge operation is a logical equivalent of OR
129  // except it can destroy the source vector to borrow memory blocks from it
130  // (this is faster, especially in multi-threaded cases)
131  {
132  bm::bvector<> bv_A { 1, 2, 3 };
133  bm::bvector<> bv_B { 1, 2, 4 };
134  bv_A.merge(bv_B);
135 
136  print_bvector(bv_A); // 1, 2, 3, 4 (size = 10)
137  }
138 
139  // bit-vector set union operation (opcode interpeter mode)
140  // maybe useful for building query interpetors
141  {
142  bm::bvector<> bv_A { 1, 2, 3 };
143  bm::bvector<> bv_B { 1, 2, 4 };
144  bv_A.combine_operation(bv_B, bm::BM_OR);
145 
146  print_bvector(bv_A); // 1, 2, 3, 4
147  }
148 
149  // Set union between bit-vector and STL container
150  {
151  bm::bvector<> bv_A { 1, 2, 3 };
152  vector<unsigned> vect_B { 1, 2, 4 };
153 
154  bm::combine_or(bv_A, vect_B.begin(), vect_B.end());
155  print_bvector(bv_A); // 1, 2, 3, 4
156  }
157 
158  // Set union between bit-vector and C-array.
159  // This tends to be faster then "combine_or()" especially on sorted vectors
160  // and in SIMD enabled configurations
161  {
162  bm::bvector<> bv_A { 1, 2, 3 };
163  vector<unsigned> vect_B { 1, 2, 4 };
164 
165  const unsigned* arr = &vect_B[0];
166  bv_A.set(arr, unsigned(vect_B.size()), bm::BM_SORTED); // sorted - fastest
167  print_bvector(bv_A); // 1, 2, 3, 4
168  }
169 
170  // Set union between bit-vector and a serialized bit-vector BLOB
171  // (created on the fly)
172  {
173  bm::bvector<> bv_A { 1, 2, 3 };
174  vector<unsigned char> blob;
175  {
176  bm::bvector<> bv_B { 1, 2, 4 };
177  make_BLOB(blob, bv_B);
178  }
181  blob.data(),
182  tb,
183  bm::set_OR);
184  print_bvector(bv_A); // 1, 2, 3, 4
185  }
186 
187  // Union of many sets with bm::aggegator<>
188  // target := A OR B OR C
189  //
190  // This method is best when we have multiple vectors at hands, aggregator
191  // is capable of doing it faster, than pair by pair OR
192  {
193  bm::bvector<> bv_T; // target vector
194 
195  bm::bvector<> bv_A { 1, 2 };
196  bm::bvector<> bv_B { 2, 3 };
197  bm::bvector<> bv_C { 3, 4 };
198 
200  agg.set_optimization(); // perform on-the-fly optimization of result
201 
202  // attach vectors to group 0 for OR operation
203  agg.add(&bv_A);
204  agg.add(&bv_B);
205  agg.add(&bv_C);
206 
207  agg.combine_or(bv_T);
208 
209  agg.reset(); // reset the aggregator parameters
210 
211  print_bvector(bv_T); // 1, 2, 3, 4
212  }
213 
214 }
215 
216 
217 // -------------------------------------------------------------
218 // Demo for Set Intersect (AND) operations
219 //
220 static
221 void DemoAND()
222 {
223  // bit-vector set intersect operation: bv_A &= bv_B
224  {
225  bm::bvector<> bv_A { 1, 2, 3 };
226  bm::bvector<> bv_B { 1, 2, 4 };
227  bv_A.bit_and(bv_B);
228 
229  print_bvector(bv_A); // 1, 2
230  }
231  // same, but sizes are set, observe size gets extended up
232  {
233  bm::bvector<> bv_A { 1, 2, 3 };
234  bm::bvector<> bv_B { 1, 2, 4 };
235  bv_A.resize(5);
236  bv_B.resize(10);
237 
238  bv_A.bit_and(bv_B);
239 
240  print_bvector(bv_A); // 1, 2 (size = 10)
241  }
242  // 3-operand AND: bv_T = bv_A & bv_B
243  {
244  bm::bvector<> bv_T;
245  bm::bvector<> bv_A { 1, 2, 3 };
246  bm::bvector<> bv_B { 1, 2, 4 };
247  bv_T.bit_and(bv_A, bv_B, bm::bvector<>::opt_compress);
248 
249  print_bvector(bv_T); // 1, 2
250  }
251 
252  // bit-vector set union operation (opcode interpeter mode)
253  // maybe useful for building query interpetors
254  {
255  bm::bvector<> bv_A { 1, 2, 3 };
256  bm::bvector<> bv_B { 1, 2, 4 };
257  bv_A.combine_operation(bv_B, bm::BM_AND);
258 
259  print_bvector(bv_A); // 1, 2
260  }
261 
262  // Set Intersect between bit-vector and STL container
263  {
264  bm::bvector<> bv_A { 1, 2, 3 };
265  vector<unsigned> vect_B { 1, 2, 4 };
266 
267  bm::combine_and(bv_A, vect_B.begin(), vect_B.end());
268  print_bvector(bv_A); // 1, 2
269  }
270 
271  // Set Intersect between bit-vector and C-array.
272  // This may be faster then "combine_and()" especially on sorted vectors
273  {
274  bm::bvector<> bv_A { 1, 2, 3 };
275  vector<unsigned> vect_B { 1, 2, 4 };
276 
277  const unsigned* arr = &vect_B[0];
278  bv_A.keep(arr, unsigned(vect_B.size()), bm::BM_SORTED); // sorted - fastest
279  print_bvector(bv_A); // 1, 2
280  }
281 
282  // Set Intersect between bit-vector and a serialized bit-vector BLOB
283  //
284  {
285  bm::bvector<> bv_A { 1, 2, 3 };
286  vector<unsigned char> blob;
287  {
288  bm::bvector<> bv_B { 1, 2, 4 };
289  make_BLOB(blob, bv_B);
290  }
293  blob.data(),
294  tb,
295  bm::set_AND);
296  print_bvector(bv_A); // 1, 2
297  }
298 
299  // Intersection of many sets with bm::aggegator<> (find common subset)
300  // target := A AND B AND C
301  //
302  // This method is best when we have multiple vectors at hands, aggregator
303  // is capable of doing it faster, than pair by pair AND
304  {
305  bm::bvector<> bv_T; // target vector
306 
307  bm::bvector<> bv_A { 1, 2 };
308  bm::bvector<> bv_B { 1, 2, 3 };
309  bm::bvector<> bv_C { 1, 2, 3, 4 };
310 
312  agg.set_optimization(); // perform on-the-fly optimization of result
313 
314  // attach vectors to group 0 for OR operation
315  agg.add(&bv_A);
316  agg.add(&bv_B);
317  agg.add(&bv_C);
318 
319  agg.combine_and(bv_T);
320 
321  agg.reset(); // reset the aggregator parameters
322 
323  print_bvector(bv_T); // 1, 2
324  }
325 }
326 
327 // -------------------------------------------------------------
328 // Demo for XOR operations
329 //
330 static
331 void DemoXOR()
332 {
333  // bit-vector xor operation: bv_A ^= bv_B
334  {
335  bm::bvector<> bv_A { 1, 2, 3 };
336  bm::bvector<> bv_B { 1, 2, 4 };
337  bv_A.bit_xor(bv_B);
338 
339  print_bvector(bv_A); // 3, 4
340  }
341  // same, but sizes are set, observe size gets extended up
342  {
343  bm::bvector<> bv_A { 1, 2, 3 };
344  bm::bvector<> bv_B { 1, 2, 4 };
345  bv_A.resize(5);
346  bv_B.resize(10);
347 
348  bv_A.bit_xor(bv_B);
349 
350  print_bvector(bv_A); // 3, 4 (size = 10)
351  }
352  // 3-operand XOR: bv_T = bv_A ^ bv_B
353  {
354  bm::bvector<> bv_T;
355  bm::bvector<> bv_A { 1, 2, 3 };
356  bm::bvector<> bv_B { 1, 2, 4 };
357  bv_T.bit_xor(bv_A, bv_B, bm::bvector<>::opt_compress);
358 
359  print_bvector(bv_T); // 3, 4
360  }
361 
362  // bit-vector xor operation (opcode interpeter mode)
363  // maybe useful for building query interpetors
364  {
365  bm::bvector<> bv_A { 1, 2, 3 };
366  bm::bvector<> bv_B { 1, 2, 4 };
367  bv_A.combine_operation(bv_B, bm::BM_XOR);
368 
369  print_bvector(bv_A); // 3, 4
370  }
371 
372  // xor between bit-vector and STL container
373  {
374  bm::bvector<> bv_A { 1, 2, 3 };
375  vector<unsigned> vect_B { 1, 2, 4 };
376 
377  bm::combine_xor(bv_A, vect_B.begin(), vect_B.end());
378  print_bvector(bv_A); // 3, 4
379  }
380 
381  // xor between bit-vector and a serialized bit-vector BLOB
382  //
383  {
384  bm::bvector<> bv_A { 1, 2, 3 };
385  vector<unsigned char> blob;
386  {
387  bm::bvector<> bv_B { 1, 2, 4 };
388  make_BLOB(blob, bv_B);
389  }
392  blob.data(),
393  tb,
394  bm::set_XOR);
395  print_bvector(bv_A); // 3, 4
396  }
397 }
398 
399 
400 // -------------------------------------------------------------
401 // Demo for Set Substract (AND NOT) operations
402 //
403 static
404 void DemoSUB()
405 {
406  // bit-vector set union operation: bv_A -= bv_B
407  {
408  bm::bvector<> bv_A { 1, 2, 3 };
409  bm::bvector<> bv_B { 1, 2, 4 };
410  bv_A.bit_sub(bv_B);
411 
412  print_bvector(bv_A); // 3
413  }
414  // same, but sizes are set, observe size gets extended up
415  {
416  bm::bvector<> bv_A { 1, 2, 3 };
417  bm::bvector<> bv_B { 1, 2, 4 };
418  bv_A.resize(5);
419  bv_B.resize(10);
420 
421  bv_A.bit_sub(bv_B);
422 
423  print_bvector(bv_A); // 3 (size = 10)
424  }
425 
426  // 3-operand SUB: bv_T = bv_A - bv_B
427  {
428  bm::bvector<> bv_T;
429  bm::bvector<> bv_A { 1, 2, 3 };
430  bm::bvector<> bv_B { 1, 2, 4 };
431  bv_T.bit_sub(bv_A, bv_B, bm::bvector<>::opt_compress);
432 
433  print_bvector(bv_T); // 3
434  }
435 
436  // bit-vector minus operation (opcode interpeter mode)
437  // maybe useful for building query interpetors
438  {
439  bm::bvector<> bv_A { 1, 2, 3 };
440  bm::bvector<> bv_B { 1, 2, 4 };
441  bv_A.combine_operation(bv_B, bm::BM_SUB);
442 
443  print_bvector(bv_A); // 3
444  }
445 
446  // and not between bit-vector and STL container
447  {
448  bm::bvector<> bv_A { 1, 2, 3 };
449  vector<unsigned> vect_B { 1, 2, 4 };
450 
451  bm::combine_sub(bv_A, vect_B.begin(), vect_B.end());
452  print_bvector(bv_A); // 3
453  }
454 
455  // Set Intersect between bit-vector and C-array.
456  // This may be faster then "combine_and()" especially on sorted vectors
457  {
458  bm::bvector<> bv_A { 1, 2, 3 };
459  vector<unsigned> vect_B { 1, 2, 4 };
460 
461  const unsigned* arr = &vect_B[0];
462  bv_A.clear(arr, unsigned(vect_B.size()), bm::BM_SORTED); // sorted - fastest
463  print_bvector(bv_A); // 3
464  }
465 
466  // Set union between bit-vector and a serialized bit-vector BLOB
467  //
468  {
469  bm::bvector<> bv_A { 1, 2, 3 };
470  vector<unsigned char> blob;
471  {
472  bm::bvector<> bv_B { 1, 2, 4 };
473  make_BLOB(blob, bv_B);
474  }
477  blob.data(),
478  tb,
479  bm::set_SUB);
480  print_bvector(bv_A); // 3
481  }
482 
483  // Subtraction of many sets with bm::aggegator<>
484  // target := (target SUB A) OR (target SUB B) OR (target SUB C)
485  //
486  {
487  bm::bvector<> bv_T; // target vector
488 
489  bm::bvector<> bv_A { 1, 2, 3, 4 };
490  bm::bvector<> bv_B { 1, 2 };
491  bm::bvector<> bv_C { 1, 2, 4 };
492 
494  agg.set_optimization(); // perform on-the-fly optimization of result
495 
496  // here we are really using AND SUB operation
497  // where group 0 is all ANDed and group 1 SUBtracted from the result
498  // group 1 is only 1 vector, so AND part will be no-op
499  //
500  agg.add(&bv_A, 0); // add to group 0 (subtraction source)
501 
502  agg.add(&bv_B, 1); // add to group 1 (subtraction arguments)
503  agg.add(&bv_C, 1);
504 
505  agg.combine_and_sub(bv_T);
506 
507  agg.reset(); // reset the aggregator parameters
508 
509  print_bvector(bv_T); // 3
510  }
511 }
512 
513 // -------------------------------------------------------------
514 // Demo for Set Invert (NOT)
515 //
516 static
517 void DemoINV()
518 {
519  // bit-vector invert operation
520  // by default it inverts the whole 32-bit space
521  {
522  bm::bvector<> bv_A { 4, 5, 6 };
523  bv_A.invert();
524 
525  print_bvector(bv_A); // 0, 1, 2, 3, 7 ...
526  }
527 
528  // bit-vector invert operation
529  // it is size bound, inverts within set limits
530  {
531  bm::bvector<> bv_A { 4, 5, 6 };
532  bv_A.resize(7);
533  bv_A.invert();
534 
535  print_bvector(bv_A); // 0, 1, 2, 3, size = 7
536  }
537 }
538 
539 
540 // -------------------------------------------------------------
541 // Demo for AND-SUB
542 // AND-SUB implements a search pattern "all this but not that"
543 //
544 static
546 {
547 
548  // Operation on two groups of vectors using aggregator
549  // 1. Group 0 - find common subset (Set Intersect / AND)
550  // 2. Group 1 - find union (OR) of the group and SUBtract it from #1
551  //
552  // target := (A AND D AND ...) AND NOT (B OR C OR ...)
553  //
554  {
555  bm::bvector<> bv_T; // target vector
556 
557  bm::bvector<> bv_A { 1, 2, 3, 4 };
558  bm::bvector<> bv_B { 1, 2 };
559  bm::bvector<> bv_C { 1, 2, 4 };
560  bm::bvector<> bv_D { 0, 2, 3, 4, 5 };
561 
562 
564  agg.set_optimization(); // perform on-the-fly optimization of result
565 
566  // here we are really using AND SUB operation
567  // where group 0 is all ANDed and group 1 SUBtracted from the result
568  //
569  agg.add(&bv_A, 0); // add to group 0 for AND
570  agg.add(&bv_D, 0); //
571 
572  agg.add(&bv_B, 1); // add to group 1 SUB tract from group 0 result
573  agg.add(&bv_C, 1);
574 
575  agg.combine_and_sub(bv_T);
576 
577  agg.reset(); // reset the aggregator parameters
578 
579  print_bvector(bv_T); // 3
580  }
581 }
582 
583 
584 
585 int main(void)
586 {
587  try
588  {
589  cout << endl << "Set Union (OR) demo" << endl << endl;
590  DemoOR();
591 
592  cout << endl << "Set Intersect (AND) demo" << endl << endl;
593  DemoAND();
594 
595  cout << endl << "XOR demo" << endl << endl;
596  DemoXOR();
597 
598  cout << endl << "Set Minus (SUB/AND-NOT) demo" << endl << endl;
599  DemoSUB();
600 
601  cout << endl << "Set Invert (NOT) demo" << endl << endl;
602  DemoINV();
603 
604  cout << endl << "Set AND-SUB demo" << endl << endl;
605  DemoAND_SUB();
606  }
607  catch(std::exception& ex)
608  {
609  std::cerr << ex.what() << std::endl;
610  }
611 
612  return 0;
613 }
Compressed bit-vector bvector<> container, set algebraic methods, traversal iterators.
unsigned add(const bvector_type *bv, unsigned agr_group=0)
Attach source bit-vector to a argument group (0 or 1).
Definition: bmaggregator.h:558
void clear(const bm::id_t *ids, unsigned ids_size, bm::sort_order so=bm::BM_UNKNOWN)
clear list of bits in this bitset
Definition: bm.h:3332
void combine_or(bvector_type &bv_target)
Aggregate added group of vectors using logical OR Operation does NOT perform an explicit reset of arg...
Definition: bmaggregator.h:590
size_type size() const
return current size of the vector (bits)
Definition: bm.h:1657
void combine_and(bvector_type &bv_target)
Aggregate added group of vectors using logical AND Operation does NOT perform an explicit reset of ar...
Definition: bmaggregator.h:598
unsigned serialize(const BV &bv, unsigned char *buf, size_t buf_size)
Bitvector serilization into memory block.
Definition: bmserial.h:912
void optimize(bm::word_t *temp_block=0, optmode opt_mode=opt_compress, statistics *stat=0)
Optimize memory bitvector&#39;s memory allocation.
Definition: bm.h:2964
int main(void)
bool combine_and_sub(bvector_type &bv_target)
Aggregate added group of vectors using fused logical AND-SUB Operation does NOT perform an explicit r...
Definition: bmaggregator.h:606
bm::bvector< Alloc > & bit_xor(const bm::bvector< Alloc > &bv1, const bm::bvector< Alloc > &bv2, typename bm::bvector< Alloc >::optmode opt_mode)
3-operand XOR : this := bv1 XOR bv2
Definition: bm.h:4464
static void DemoSUB()
Bit-vector serialization class.
Definition: bmserial.h:145
void combine_or(BV &bv, It first, It last)
OR Combine bitvector and the iterable sequence.
Definition: bmalgo_impl.h:1134
void combine_sub(BV &bv, It first, It last)
SUB Combine bitvector and the iterable sequence.
Definition: bmalgo_impl.h:1303
#define BM_DECLARE_TEMP_BLOCK(x)
Definition: bm.h:47
Algorithms for bvector<> (main include)
void reset()
Reset aggregate groups, forget all attached vectors.
Definition: bmaggregator.h:525
Algorithms for fast aggregation of N bvectors.
enumerator first() const
Returns enumerator pointing on the first non-zero bit.
Definition: bm.h:2098
input set is sorted (ascending order)
Definition: bmconst.h:168
void set_optimization(typename bvector_type::optmode opt=bvector_type::opt_compress)
set on-the-fly bit-block compression By default aggregator does not try to optimize result...
Definition: bmaggregator.h:97
void combine_xor(BV &bv, It first, It last)
XOR Combine bitvector and the iterable sequence.
Definition: bmalgo_impl.h:1216
bvector< Alloc > & set(bm::id_t n, bool val=true)
Sets bit n if val is true, clears bit n if val is false.
Definition: bm.h:3367
unsigned deserialize(BV &bv, const unsigned char *buf, bm::word_t *temp_block=0)
Bitvector deserialization from memory.
Definition: bmserial.h:1249
bm::bvector< Alloc > & bit_sub(const bm::bvector< Alloc > &bv1, const bm::bvector< Alloc > &bv2, typename bm::bvector< Alloc >::optmode opt_mode)
3-operand SUB : this := bv1 MINUS bv2 SUBtraction is also known as AND NOT
Definition: bm.h:4637
static void make_BLOB(vector< unsigned char > &target_buf, bm::bvector<> &bv)
bool valid() const
Checks if iterator is still valid.
Definition: bm.h:300
void keep(const bm::id_t *ids, unsigned ids_size, bm::sort_order so=bm::BM_UNKNOWN)
Keep list of bits in this bitset, others are cleared.
Definition: bm.h:3305
Algorithms for fast aggregation of a group of bit-vectors.
Definition: bmaggregator.h:51
static void print_bvector(const bm::bvector<> &bv)
void combine_and(BV &bv, It first, It last)
AND Combine bitvector and the iterable sequence.
Definition: bmalgo_impl.h:1420
Serialization / compression of bvector<>. Set operations on compressed BLOBs.
void merge(bm::bvector< Alloc > &bvect)
Merge/move content from another vector.
Definition: bm.h:4312
static void DemoOR()
Constant iterator designed to enumerate "ON" bits.
Definition: bm.h:601
static void DemoXOR()
static void DemoINV()
void resize(size_type new_size)
Change size of the bvector.
Definition: bm.h:2498
bvector< Alloc > & invert()
Invert/NEG all bits It should be noted, invert is affected by size() if size is set - it only inverts...
Definition: bm.h:2915
bm::bvector< Alloc > & bit_and(const bm::bvector< Alloc > &bv1, const bm::bvector< Alloc > &bv2, typename bm::bvector< Alloc >::optmode opt_mode)
3-operand AND : this := bv1 AND bv2
Definition: bm.h:4552
unsigned int id_t
Definition: bmconst.h:35
void combine_operation(const bm::bvector< Alloc > &bvect, bm::operation opcode)
perform a set-algebra operation by operation code
Definition: bm.h:4995
bm::bvector< Alloc > & bit_or(const bm::bvector< Alloc > &bv1, const bm::bvector< Alloc > &bv2, typename bm::bvector< Alloc >::optmode opt_mode)
3-operand OR : this := bv1 OR bv2
Definition: bm.h:4386
static void DemoAND()
void set_compression_level(unsigned clevel)
Set compression level.
Definition: bmserial.h:631
Deserializer, performs logical operations between bit-vector and serialized bit-vector.
Definition: bmserial.h:534
static void DemoAND_SUB()