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 
54 #include "bm.h"
55 #include "bmalgo.h"
56 #include "bmserial.h"
57 #include "bmaggregator.h"
58 
59 
60 using namespace std;
61 
62 // utility function to print a set
63 static
65 {
68  for (; en.valid() && cnt < 10; ++en, ++cnt)
69  cout << *en << ", ";
70  if (cnt == 10)
71  cout << " ...";
72  cout << "(size = "<< bv.size() << ")" << endl;
73 }
74 
75 // utility function to create serialized bit-vector BLOB
76 static
77 void make_BLOB(vector<unsigned char>& target_buf, bm::bvector<>& bv)
78 {
81  bvs.set_compression_level(4);
82 
83  bv.optimize(tb, bm::bvector<>::opt_compress); // memory compression
84 
85  bm::serializer<bm::bvector<> >::buffer sbuf;
86  bvs.serialize(bv, sbuf, 0);
87  target_buf.resize(sbuf.size());
88  ::memcpy(target_buf.data(), sbuf.buf(), sbuf.size());
89 }
90 
91 
92 // -------------------------------------------------------------
93 // Demo for Set Union (OR) operations
94 //
95 static
96 void DemoOR()
97 {
98  typedef bm::bvector<>::size_type size_type;
99 
100  // bit-vector set union operation: bv_A |= bv_B
101  {
102  bm::bvector<> bv_A { 1, 2, 3 };
103  bm::bvector<> bv_B { 1, 2, 4 };
104  bv_A.bit_or(bv_B);
105 
106  print_bvector(bv_A); // 1, 2, 3, 4
107  }
108  // same, but sizes are set, observe size gets extended up
109  {
110  bm::bvector<> bv_A { 1, 2, 3 };
111  bm::bvector<> bv_B { 1, 2, 4 };
112  bv_A.resize(5);
113  bv_B.resize(10);
114 
115  bv_A.bit_or(bv_B);
116 
117  print_bvector(bv_A); // 1, 2, 3, 4 (size = 10)
118  }
119  // 3-operand OR: bv_T = bv_A | bv_B
120  {
121  bm::bvector<> bv_T;
122  bm::bvector<> bv_A { 1, 2, 3 };
123  bm::bvector<> bv_B { 1, 2, 4 };
124 
125  bv_T.bit_or(bv_A, bv_B, bm::bvector<>::opt_compress);
126 
127  print_bvector(bv_T); // 1, 2, 3, 4 (size = 10)
128  }
129 
130 
131  // merge operation is a logical equivalent of OR
132  // except it can destroy the source vector to borrow memory blocks from it
133  // (this is faster, especially in multi-threaded cases)
134  {
135  bm::bvector<> bv_A { 1, 2, 3 };
136  bm::bvector<> bv_B { 1, 2, 4 };
137  bv_A.merge(bv_B);
138 
139  print_bvector(bv_A); // 1, 2, 3, 4 (size = 10)
140  }
141 
142  // bit-vector set union operation (opcode interpeter mode)
143  // maybe useful for building query interpetors
144  {
145  bm::bvector<> bv_A { 1, 2, 3 };
146  bm::bvector<> bv_B { 1, 2, 4 };
147  bv_A.combine_operation(bv_B, bm::BM_OR);
148 
149  print_bvector(bv_A); // 1, 2, 3, 4
150  }
151 
152  // Set union between bit-vector and STL container
153  {
154  bm::bvector<> bv_A { 1, 2, 3 };
155  vector<size_type> vect_B { 1, 2, 4 };
156 
157  bm::combine_or(bv_A, vect_B.begin(), vect_B.end());
158  print_bvector(bv_A); // 1, 2, 3, 4
159  }
160 
161  // Set union between bit-vector and C-array.
162  // This tends to be faster then "combine_or()" especially on sorted vectors
163  // and in SIMD enabled configurations
164  {
165  bm::bvector<> bv_A { 1, 2, 3 };
166  vector<size_type> vect_B { 1, 2, 4 };
167 
168  const size_type* arr = &vect_B[0];
169  bv_A.set(arr, unsigned(vect_B.size()), bm::BM_SORTED); // sorted - fastest
170  print_bvector(bv_A); // 1, 2, 3, 4
171  }
172 
173  // Set union between bit-vector and a serialized bit-vector BLOB
174  // (created on the fly)
175  {
176  bm::bvector<> bv_A { 1, 2, 3 };
177  vector<unsigned char> blob;
178  {
179  bm::bvector<> bv_B { 1, 2, 4 };
180  make_BLOB(blob, bv_B);
181  }
184  blob.data(),
185  tb,
186  bm::set_OR);
187  print_bvector(bv_A); // 1, 2, 3, 4
188  }
189 
190  // Union of many sets with bm::aggegator<>
191  // target := A OR B OR C
192  //
193  // This method is best when we have multiple vectors at hands, aggregator
194  // is capable of doing it faster, than pair by pair OR
195  {
196  bm::bvector<> bv_T; // target vector
197 
198  bm::bvector<> bv_A { 1, 2 };
199  bm::bvector<> bv_B { 2, 3 };
200  bm::bvector<> bv_C { 3, 4 };
201 
203  agg.set_optimization(); // perform on-the-fly optimization of result
204 
205  // attach vectors to group 0 for OR operation
206  agg.add(&bv_A);
207  agg.add(&bv_B);
208  agg.add(&bv_C);
209 
210  agg.combine_or(bv_T);
211 
212  agg.reset(); // reset the aggregator parameters
213 
214  print_bvector(bv_T); // 1, 2, 3, 4
215  }
216 
217 }
218 
219 
220 // -------------------------------------------------------------
221 // Demo for Set Intersect (AND) operations
222 //
223 static
224 void DemoAND()
225 {
226  typedef bm::bvector<>::size_type size_type;
227 
228  // bit-vector set intersect operation: bv_A &= bv_B
229  {
230  bm::bvector<> bv_A { 1, 2, 3 };
231  bm::bvector<> bv_B { 1, 2, 4 };
232  bv_A.bit_and(bv_B);
233 
234  print_bvector(bv_A); // 1, 2
235  }
236  // same, but sizes are set, observe size gets extended up
237  {
238  bm::bvector<> bv_A { 1, 2, 3 };
239  bm::bvector<> bv_B { 1, 2, 4 };
240  bv_A.resize(5);
241  bv_B.resize(10);
242 
243  bv_A.bit_and(bv_B);
244 
245  print_bvector(bv_A); // 1, 2 (size = 10)
246  }
247  // 3-operand AND: bv_T = bv_A & bv_B
248  {
249  bm::bvector<> bv_T;
250  bm::bvector<> bv_A { 1, 2, 3 };
251  bm::bvector<> bv_B { 1, 2, 4 };
252  bv_T.bit_and(bv_A, bv_B, bm::bvector<>::opt_compress);
253 
254  print_bvector(bv_T); // 1, 2
255  }
256 
257  // bit-vector set union operation (opcode interpeter mode)
258  // maybe useful for building query interpetors
259  {
260  bm::bvector<> bv_A { 1, 2, 3 };
261  bm::bvector<> bv_B { 1, 2, 4 };
262  bv_A.combine_operation(bv_B, bm::BM_AND);
263 
264  print_bvector(bv_A); // 1, 2
265  }
266 
267  // Set Intersect between bit-vector and STL container
268  {
269  bm::bvector<> bv_A { 1, 2, 3 };
270  vector<unsigned> vect_B { 1, 2, 4 };
271 
272  bm::combine_and(bv_A, vect_B.begin(), vect_B.end());
273  print_bvector(bv_A); // 1, 2
274  }
275 
276  // Set Intersect between bit-vector and C-array.
277  // This may be faster then "combine_and()" especially on sorted vectors
278  {
279  bm::bvector<> bv_A { 1, 2, 3 };
280  vector<size_type> vect_B { 1, 2, 4 };
281 
282  const size_type* arr = &vect_B[0];
283  bv_A.keep(arr, size_type(vect_B.size()), bm::BM_SORTED); // sorted - fastest
284  print_bvector(bv_A); // 1, 2
285  }
286 
287  // Set Intersect between bit-vector and a serialized bit-vector BLOB
288  //
289  {
290  bm::bvector<> bv_A { 1, 2, 3 };
291  vector<unsigned char> blob;
292  {
293  bm::bvector<> bv_B { 1, 2, 4 };
294  make_BLOB(blob, bv_B);
295  }
298  blob.data(),
299  tb,
300  bm::set_AND);
301  print_bvector(bv_A); // 1, 2
302  }
303 
304  // Intersection of many sets with bm::aggegator<> (find common subset)
305  // target := A AND B AND C
306  //
307  // This method is best when we have multiple vectors at hands, aggregator
308  // is capable of doing it faster, than pair by pair AND
309  {
310  bm::bvector<> bv_T; // target vector
311 
312  bm::bvector<> bv_A { 1, 2 };
313  bm::bvector<> bv_B { 1, 2, 3 };
314  bm::bvector<> bv_C { 1, 2, 3, 4 };
315 
317  agg.set_optimization(); // perform on-the-fly optimization of result
318 
319  // attach vectors to group 0 for OR operation
320  agg.add(&bv_A);
321  agg.add(&bv_B);
322  agg.add(&bv_C);
323 
324  agg.combine_and(bv_T);
325 
326  agg.reset(); // reset the aggregator parameters
327 
328  print_bvector(bv_T); // 1, 2
329  }
330 }
331 
332 // -------------------------------------------------------------
333 // Demo for XOR operations
334 //
335 static
336 void DemoXOR()
337 {
338  // bit-vector xor operation: bv_A ^= bv_B
339  {
340  bm::bvector<> bv_A { 1, 2, 3 };
341  bm::bvector<> bv_B { 1, 2, 4 };
342  bv_A.bit_xor(bv_B);
343 
344  print_bvector(bv_A); // 3, 4
345  }
346  // same, but sizes are set, observe size gets extended up
347  {
348  bm::bvector<> bv_A { 1, 2, 3 };
349  bm::bvector<> bv_B { 1, 2, 4 };
350  bv_A.resize(5);
351  bv_B.resize(10);
352 
353  bv_A.bit_xor(bv_B);
354 
355  print_bvector(bv_A); // 3, 4 (size = 10)
356  }
357  // 3-operand XOR: bv_T = bv_A ^ bv_B
358  {
359  bm::bvector<> bv_T;
360  bm::bvector<> bv_A { 1, 2, 3 };
361  bm::bvector<> bv_B { 1, 2, 4 };
362  bv_T.bit_xor(bv_A, bv_B, bm::bvector<>::opt_compress);
363 
364  print_bvector(bv_T); // 3, 4
365  }
366 
367  // bit-vector xor operation (opcode interpeter mode)
368  // maybe useful for building query interpetors
369  {
370  bm::bvector<> bv_A { 1, 2, 3 };
371  bm::bvector<> bv_B { 1, 2, 4 };
372  bv_A.combine_operation(bv_B, bm::BM_XOR);
373 
374  print_bvector(bv_A); // 3, 4
375  }
376 
377  // xor between bit-vector and STL container
378  {
379  bm::bvector<> bv_A { 1, 2, 3 };
380  vector<unsigned> vect_B { 1, 2, 4 };
381 
382  bm::combine_xor(bv_A, vect_B.begin(), vect_B.end());
383  print_bvector(bv_A); // 3, 4
384  }
385 
386  // xor between bit-vector and a serialized bit-vector BLOB
387  //
388  {
389  bm::bvector<> bv_A { 1, 2, 3 };
390  vector<unsigned char> blob;
391  {
392  bm::bvector<> bv_B { 1, 2, 4 };
393  make_BLOB(blob, bv_B);
394  }
397  blob.data(),
398  tb,
399  bm::set_XOR);
400  print_bvector(bv_A); // 3, 4
401  }
402 }
403 
404 
405 // -------------------------------------------------------------
406 // Demo for Set Substract (AND NOT) operations
407 //
408 static
409 void DemoSUB()
410 {
411  typedef bm::bvector<>::size_type size_type;
412 
413  // bit-vector set union operation: bv_A -= bv_B
414  {
415  bm::bvector<> bv_A { 1, 2, 3 };
416  bm::bvector<> bv_B { 1, 2, 4 };
417  bv_A.bit_sub(bv_B);
418 
419  print_bvector(bv_A); // 3
420  }
421  // same, but sizes are set, observe size gets extended up
422  {
423  bm::bvector<> bv_A { 1, 2, 3 };
424  bm::bvector<> bv_B { 1, 2, 4 };
425  bv_A.resize(5);
426  bv_B.resize(10);
427 
428  bv_A.bit_sub(bv_B);
429 
430  print_bvector(bv_A); // 3 (size = 10)
431  }
432 
433  // 3-operand SUB: bv_T = bv_A - bv_B
434  {
435  bm::bvector<> bv_T;
436  bm::bvector<> bv_A { 1, 2, 3 };
437  bm::bvector<> bv_B { 1, 2, 4 };
438  bv_T.bit_sub(bv_A, bv_B, bm::bvector<>::opt_compress);
439 
440  print_bvector(bv_T); // 3
441  }
442 
443  // bit-vector minus operation (opcode interpeter mode)
444  // maybe useful for building query interpetors
445  {
446  bm::bvector<> bv_A { 1, 2, 3 };
447  bm::bvector<> bv_B { 1, 2, 4 };
448  bv_A.combine_operation(bv_B, bm::BM_SUB);
449 
450  print_bvector(bv_A); // 3
451  }
452 
453  // and not between bit-vector and STL container
454  {
455  bm::bvector<> bv_A { 1, 2, 3 };
456  vector<size_type> vect_B { 1, 2, 4 };
457 
458  bm::combine_sub(bv_A, vect_B.begin(), vect_B.end());
459  print_bvector(bv_A); // 3
460  }
461 
462  // Set Intersect between bit-vector and C-array.
463  // This may be faster then "combine_and()" especially on sorted vectors
464  {
465  bm::bvector<> bv_A { 1, 2, 3 };
466  vector<size_type> vect_B { 1, 2, 4 };
467 
468  const size_type* arr = &vect_B[0];
469  bv_A.clear(arr, unsigned(vect_B.size()), bm::BM_SORTED); // sorted - fastest
470  print_bvector(bv_A); // 3
471  }
472 
473  // Set union between bit-vector and a serialized bit-vector BLOB
474  //
475  {
476  bm::bvector<> bv_A { 1, 2, 3 };
477  vector<unsigned char> blob;
478  {
479  bm::bvector<> bv_B { 1, 2, 4 };
480  make_BLOB(blob, bv_B);
481  }
484  blob.data(),
485  tb,
486  bm::set_SUB);
487  print_bvector(bv_A); // 3
488  }
489 
490  // Subtraction of many sets with bm::aggegator<>
491  // target := (target SUB A) OR (target SUB B) OR (target SUB C)
492  //
493  {
494  bm::bvector<> bv_T; // target vector
495 
496  bm::bvector<> bv_A { 1, 2, 3, 4 };
497  bm::bvector<> bv_B { 1, 2 };
498  bm::bvector<> bv_C { 1, 2, 4 };
499 
501  agg.set_optimization(); // perform on-the-fly optimization of result
502 
503  // here we are really using AND SUB operation
504  // where group 0 is all ANDed and group 1 SUBtracted from the result
505  // group 1 is only 1 vector, so AND part will be no-op
506  //
507  agg.add(&bv_A, 0); // add to group 0 (subtraction source)
508 
509  agg.add(&bv_B, 1); // add to group 1 (subtraction arguments)
510  agg.add(&bv_C, 1);
511 
512  agg.combine_and_sub(bv_T);
513 
514  agg.reset(); // reset the aggregator parameters
515 
516  print_bvector(bv_T); // 3
517  }
518 }
519 
520 // -------------------------------------------------------------
521 // Demo for Set Invert (NOT)
522 //
523 static
524 void DemoINV()
525 {
526  // bit-vector invert operation
527  // by default it inverts the whole 32-bit space
528  {
529  bm::bvector<> bv_A { 4, 5, 6 };
530  bv_A.invert();
531 
532  print_bvector(bv_A); // 0, 1, 2, 3, 7 ...
533  }
534 
535  // bit-vector invert operation
536  // it is size bound, inverts within set limits
537  {
538  bm::bvector<> bv_A { 4, 5, 6 };
539  bv_A.resize(7);
540  bv_A.invert();
541 
542  print_bvector(bv_A); // 0, 1, 2, 3, size = 7
543  }
544 }
545 
546 
547 // -------------------------------------------------------------
548 // Demo for AND-SUB
549 // AND-SUB implements a search pattern "all this but not that"
550 //
551 static
553 {
554 
555  // Operation on two groups of vectors using aggregator
556  // 1. Group 0 - find common subset (Set Intersect / AND)
557  // 2. Group 1 - find union (OR) of the group and SUBtract it from #1
558  //
559  // target := (A AND D AND ...) AND NOT (B OR C OR ...)
560  //
561  {
562  bm::bvector<> bv_T; // target vector
563 
564  bm::bvector<> bv_A { 1, 2, 3, 4 };
565  bm::bvector<> bv_B { 1, 2 };
566  bm::bvector<> bv_C { 1, 2, 4 };
567  bm::bvector<> bv_D { 0, 2, 3, 4, 5 };
568 
569 
571  agg.set_optimization(); // perform on-the-fly optimization of result
572 
573  // here we are really using AND SUB operation
574  // where group 0 is all ANDed and group 1 SUBtracted from the result
575  //
576  agg.add(&bv_A, 0); // add to group 0 for AND
577  agg.add(&bv_D, 0); //
578 
579  agg.add(&bv_B, 1); // add to group 1 SUB tract from group 0 result
580  agg.add(&bv_C, 1);
581 
582  agg.combine_and_sub(bv_T);
583 
584  agg.reset(); // reset the aggregator parameters
585 
586  print_bvector(bv_T); // 3
587  }
588 }
589 
590 
591 
592 int main(void)
593 {
594  try
595  {
596  cout << endl << "Set Union (OR) demo" << endl << endl;
597  DemoOR();
598 
599  cout << endl << "Set Intersect (AND) demo" << endl << endl;
600  DemoAND();
601 
602  cout << endl << "XOR demo" << endl << endl;
603  DemoXOR();
604 
605  cout << endl << "Set Minus (SUB/AND-NOT) demo" << endl << endl;
606  DemoSUB();
607 
608  cout << endl << "Set Invert (NOT) demo" << endl << endl;
609  DemoINV();
610 
611  cout << endl << "Set AND-SUB demo" << endl << endl;
612  DemoAND_SUB();
613  }
614  catch(std::exception& ex)
615  {
616  std::cerr << ex.what() << std::endl;
617  }
618 
619  return 0;
620 }
Compressed bit-vector bvector<> container, set algebraic methods, traversal iterators.
size_t deserialize(BV &bv, const unsigned char *buf, bm::word_t *temp_block=0)
Bitvector deserialization from memory.
Definition: bmserial.h:1900
unsigned add(const bvector_type *bv, unsigned agr_group=0)
Attach source bit-vector to a argument group (0 or 1).
Definition: bmaggregator.h:569
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:601
size_type size() const
return current size of the vector (bits)
Definition: bm.h:1660
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:609
bm::id_t size_type
Definition: bm.h:117
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:3136
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:617
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:4829
static void DemoSUB()
Bit-vector serialization class.
Definition: bmserial.h:77
void combine_or(BV &bv, It first, It last)
OR Combine bitvector and the iterable sequence.
Definition: bmalgo_impl.h:1148
void combine_sub(BV &bv, It first, It last)
SUB Combine bitvector and the iterable sequence.
Definition: bmalgo_impl.h:1316
void clear(const size_type *ids, size_type ids_size, bm::sort_order so=bm::BM_UNKNOWN)
clear list of bits in this bitset
Definition: bm.h:3504
#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:536
Algorithms for fast aggregation of N bvectors.
enumerator first() const
Returns enumerator pointing on the first non-zero bit.
Definition: bm.h:2122
input set is sorted (ascending order)
Definition: bmconst.h:192
bvector< Alloc > & set(size_type n, bool val=true)
Sets bit n if val is true, clears bit n if val is false.
Definition: bm.h:3539
size_type serialize(const BV &bv, unsigned char *buf, size_t buf_size)
Bitvector serialization into memory block.
Definition: bmserial.h:1608
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:105
void combine_xor(BV &bv, It first, It last)
XOR Combine bitvector and the iterable sequence.
Definition: bmalgo_impl.h:1229
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:5021
static void make_BLOB(vector< unsigned char > &target_buf, bm::bvector<> &bv)
bool valid() const
Checks if iterator is still valid.
Definition: bm.h:277
Algorithms for fast aggregation of a group of bit-vectors.
Definition: bmaggregator.h:58
static void print_bvector(const bm::bvector<> &bv)
void keep(const size_type *ids, size_type ids_size, bm::sort_order so=bm::BM_UNKNOWN)
Keep list of bits in this bitset, others are cleared.
Definition: bm.h:3476
void combine_and(BV &bv, It first, It last)
AND Combine bitvector and the iterable sequence.
Definition: bmalgo_impl.h:1433
Serialization / compression of bvector<>. Set theoretical operations on compressed BLOBs...
void merge(bm::bvector< Alloc > &bvect)
Merge/move content from another vector.
Definition: bm.h:4657
static void DemoOR()
Constant iterator designed to enumerate "ON" bits.
Definition: bm.h:590
static void DemoXOR()
static void DemoINV()
void resize(size_type new_size)
Change size of the bvector.
Definition: bm.h:2546
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:3055
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:4927
void combine_operation(const bm::bvector< Alloc > &bvect, bm::operation opcode)
perform a set-algebra operation by operation code
Definition: bm.h:5434
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:4742
static void DemoAND()
void set_compression_level(unsigned clevel)
Set compression level.
Definition: bmserial.h:790
Deserializer, performs logical operations between bit-vector and serialized bit-vector.
Definition: bmserial.h:622
static void DemoAND_SUB()