Storm 1.11.1.1
A Modern Probabilistic Model Checker
Loading...
Searching...
No Matches
BitVectorTest.cpp
Go to the documentation of this file.
1#include "storm-config.h"
2#include "test/storm_gtest.h"
3
7
8TEST(BitVectorTest, InitToZero) {
10
11 for (uint64_t i = 0; i < 32; ++i) {
12 ASSERT_FALSE(vector.get(i));
13 }
14
15 ASSERT_TRUE(vector.empty());
16 ASSERT_FALSE(vector.full());
17}
18
19TEST(BitVectorTest, InitToOne) {
20 storm::storage::BitVector vector(32, true);
21
22 for (uint64_t i = 0; i < 32; ++i) {
23 ASSERT_TRUE(vector.get(i));
24 }
25 ASSERT_FALSE(vector.empty());
26 ASSERT_TRUE(vector.full());
27}
28
29TEST(BitVectorTest, InitFromIterator) {
30 std::vector<uint64_t> valueVector = {0, 4, 10};
31 storm::storage::BitVector vector(32, valueVector.begin(), valueVector.end());
32
33 ASSERT_EQ(32ul, vector.size());
34
35 for (uint64_t i = 0; i < 32; ++i) {
36 if (i == 0 || i == 4 || i == 10) {
37 ASSERT_TRUE(vector.get(i));
38 } else {
39 ASSERT_FALSE(vector.get(i));
40 }
41 }
42}
43
44TEST(BitVectorTest, InitFromIntVector) {
45 std::vector<uint64_t> valueVector = {0, 4, 10};
46 storm::storage::BitVector vector(32, valueVector);
47
48 ASSERT_EQ(32ul, vector.size());
49
50 for (uint64_t i = 0; i < 32; ++i) {
51 if (i == 0 || i == 4 || i == 10) {
52 ASSERT_TRUE(vector.get(i));
53 } else {
54 ASSERT_FALSE(vector.get(i));
55 }
56 }
57}
58
59TEST(BitVectorTest, GetSet) {
61
62 for (uint64_t i = 0; i < 32; ++i) {
63 vector.set(i, i % 2 == 0);
64 }
65
66 for (uint64_t i = 0; i < 32; ++i) {
67 ASSERT_EQ(i % 2 == 0, vector.get(i));
68 }
69}
70
71TEST(BitVectorTest, GetAsInt) {
73
74 vector.set(62);
75 vector.set(63);
76 vector.set(64);
77 vector.set(65);
78
79 EXPECT_EQ(3ul, vector.getAsInt(0, 64));
80 EXPECT_EQ(1ul, vector.getAsInt(62, 1));
81 EXPECT_EQ(3ul, vector.getAsInt(62, 2));
82 EXPECT_EQ(7ul, vector.getAsInt(62, 3));
83 EXPECT_EQ(15ul, vector.getAsInt(62, 4));
84
85 vector.set(64, false);
86
87 EXPECT_EQ(1ul, vector.getAsInt(62, 1));
88 EXPECT_EQ(3ul, vector.getAsInt(62, 2));
89 EXPECT_EQ(6ul, vector.getAsInt(62, 3));
90 EXPECT_EQ(13ul, vector.getAsInt(62, 4));
91
92 vector.set(61);
93 vector.set(62, false);
94 EXPECT_EQ(2ul, vector.getAsInt(61, 2));
95}
96
97TEST(BitVectorTest, SetFromInt) {
99
100 vector.setFromInt(62, 1, 1);
101
102 EXPECT_TRUE(vector.get(62));
103 EXPECT_FALSE(vector.get(63));
104 EXPECT_FALSE(vector.get(64));
105 EXPECT_FALSE(vector.get(65));
106
107 vector.setFromInt(61, 2, 2);
108
109 EXPECT_TRUE(vector.get(61));
110 EXPECT_FALSE(vector.get(62));
111 EXPECT_FALSE(vector.get(63));
112
113 vector.setFromInt(61, 3, 5);
114
115 EXPECT_TRUE(vector.get(61));
116 EXPECT_FALSE(vector.get(62));
117 EXPECT_TRUE(vector.get(63));
118
119 vector = storm::storage::BitVector(77);
120 vector.setFromInt(62, 4, 15);
121
122 EXPECT_TRUE(vector.get(62));
123 EXPECT_TRUE(vector.get(63));
124 EXPECT_TRUE(vector.get(64));
125 EXPECT_TRUE(vector.get(65));
126
127 vector.setFromInt(62, 5, 17);
128}
129
130TEST(BitVectorTest, GetSetInt) {
131 storm::storage::BitVector vector(77);
132
133 vector.setFromInt(63, 3, 2);
134 EXPECT_EQ(2ul, vector.getAsInt(63, 3));
135}
136
137TEST(BitVectorDeathTest, GetSetAssertion) {
138 storm::storage::BitVector vector(32);
139
140#ifndef NDEBUG
141 EXPECT_DEATH_IF_SUPPORTED(vector.get(32), "");
142 EXPECT_DEATH_IF_SUPPORTED(vector.set(32), "");
143#else
144 std::cerr << "WARNING: Not testing GetSetAssertions, as they are disabled in release mode.\n";
145 SUCCEED();
146#endif
147}
148
149TEST(BitVectorTest, Resize) {
150 storm::storage::BitVector vector(32);
151
152 for (uint64_t i = 0; i < 32; ++i) {
153 vector.set(i);
154 }
155
156 vector.resize(70);
157
158 ASSERT_EQ(70ul, vector.size());
159 ASSERT_EQ(32ul, vector.getNumberOfSetBits());
160
161 for (uint64_t i = 0; i < 32; ++i) {
162 ASSERT_TRUE(vector.get(i));
163 }
164 bool result;
165 for (uint64_t i = 32; i < 70; ++i) {
166 result = true;
167 ASSERT_NO_THROW(result = vector.get(i));
168 ASSERT_FALSE(result);
169 }
170
171 vector.resize(72, true);
172
173 std::cout << vector << std::endl;
174 ASSERT_EQ(72ul, vector.size());
175 ASSERT_EQ(34ul, vector.getNumberOfSetBits());
176
177 for (uint64_t i = 0; i < 32; ++i) {
178 ASSERT_TRUE(vector.get(i));
179 }
180 for (uint64_t i = 32; i < 70; ++i) {
181 result = true;
182 ASSERT_NO_THROW(result = vector.get(i));
183 ASSERT_FALSE(result);
184 }
185 for (uint64_t i = 70; i < 72; ++i) {
186 ASSERT_TRUE(vector.get(i));
187 }
188
189 vector.resize(16, 0);
190 ASSERT_EQ(16ul, vector.size());
191 ASSERT_EQ(16ul, vector.getNumberOfSetBits());
192
193 for (uint64_t i = 0; i < 16; ++i) {
194 ASSERT_TRUE(vector.get(i));
195 }
196
197 vector.resize(65, 1);
198 ASSERT_EQ(65ul, vector.size());
199 ASSERT_TRUE(vector.full());
200}
201
202TEST(BitVectorTest, OperatorAnd) {
203 storm::storage::BitVector vector1(32);
204 storm::storage::BitVector vector2(32);
205
206 for (int i = 0; i < 32; ++i) {
207 vector1.set(i, i % 2 == 0);
208 vector2.set(i, i % 2 == 1);
209 }
210 vector1.set(31);
211 vector2.set(31);
212
213 storm::storage::BitVector andResult = vector1 & vector2;
214 for (uint64_t i = 0; i < 31; ++i) {
215 ASSERT_FALSE(andResult.get(i));
216 }
217 ASSERT_TRUE(andResult.get(31));
218}
219
220TEST(BitVectorTest, OperatorAndEqual) {
221 storm::storage::BitVector vector1(32);
222 storm::storage::BitVector vector2(32);
223
224 for (int i = 0; i < 32; ++i) {
225 vector1.set(i, i % 2 == 0);
226 vector2.set(i, i % 2 == 1);
227 }
228 vector1.set(31);
229 vector2.set(31);
230
231 vector1 &= vector2;
232
233 for (uint64_t i = 0; i < 31; ++i) {
234 ASSERT_FALSE(vector1.get(i));
235 }
236 ASSERT_TRUE(vector1.get(31));
237}
238
239TEST(BitVectorTest, OperatorOr) {
240 storm::storage::BitVector vector1(32);
241 storm::storage::BitVector vector2(32);
242
243 for (uint64_t i = 0; i < 32; ++i) {
244 vector1.set(i, i % 2 == 0);
245 vector2.set(i, i % 2 == 1);
246 }
247 vector1.set(31, false);
248 vector2.set(31, false);
249
250 storm::storage::BitVector orResult = vector1 | vector2;
251
252 for (uint64_t i = 0; i < 31; ++i) {
253 ASSERT_TRUE(orResult.get(i));
254 }
255 ASSERT_FALSE(orResult.get(31));
256}
257
258TEST(BitVectorTest, OperatorOrEqual) {
259 storm::storage::BitVector vector1(32);
260 storm::storage::BitVector vector2(32);
261
262 for (uint64_t i = 0; i < 32; ++i) {
263 vector1.set(i, i % 2 == 0);
264 vector2.set(i, i % 2 == 1);
265 }
266 vector1.set(31, false);
267 vector2.set(31, false);
268
269 vector1 |= vector2;
270
271 for (uint64_t i = 0; i < 31; ++i) {
272 ASSERT_TRUE(vector1.get(i));
273 }
274 ASSERT_FALSE(vector1.get(31));
275}
276
277TEST(BitVectorTest, OperatorXor) {
278 storm::storage::BitVector vector1(32);
279 storm::storage::BitVector vector2(32);
280
281 for (uint64_t i = 0; i < 32; ++i) {
282 vector1.set(i);
283 vector2.set(i, i % 2 == 1);
284 }
285
286 storm::storage::BitVector vector3 = vector1 ^ vector2;
287 storm::storage::BitVector vector4 = ~vector2;
288 storm::storage::BitVector vector5 = vector1 ^ vector1;
289
290 for (uint64_t i = 0; i < 32; ++i) {
291 ASSERT_EQ(vector3.get(i), vector4.get(i));
292 ASSERT_FALSE(vector5.get(i));
293 }
294}
295
296TEST(BitVectorTest, OperatorModulo) {
297 storm::storage::BitVector vector1(32);
298 storm::storage::BitVector vector2(32);
299
300 for (uint64_t i = 0; i < 15; ++i) {
301 vector2.set(i, i % 2 == 0);
302 }
303
304 vector1.set(2);
305 vector1.set(5);
306 vector1.set(6);
307
308 storm::storage::BitVector moduloResult = vector1 % vector2;
309
310 ASSERT_EQ(8ul, moduloResult.size());
311 ASSERT_EQ(2ul, moduloResult.getNumberOfSetBits());
312
313 for (uint64_t i = 0; i < 8; ++i) {
314 if (i == 1 || i == 3) {
315 ASSERT_TRUE(moduloResult.get(i));
316 } else {
317 ASSERT_FALSE(moduloResult.get(i));
318 }
319 }
320}
321
322TEST(BitVectorTest, OperatorNot) {
323 storm::storage::BitVector vector1(32);
324 storm::storage::BitVector vector2(32);
325
326 for (uint64_t i = 0; i < 32; ++i) {
327 vector1.set(i, i % 2 == 0);
328 vector2.set(i, i % 2 == 1);
329 }
330
331 storm::storage::BitVector notResult = ~vector2;
332
333 for (uint64_t i = 0; i < 32; ++i) {
334 ASSERT_EQ(vector1.get(i), notResult.get(i));
335 }
336}
337
338TEST(BitVectorTest, Complement) {
339 storm::storage::BitVector vector1(32);
340 storm::storage::BitVector vector2(32);
341
342 for (uint64_t i = 0; i < 32; ++i) {
343 vector1.set(i, i % 2 == 0);
344 vector2.set(i, i % 2 == 1);
345 }
346
347 vector2.complement();
348
349 for (uint64_t i = 0; i < 32; ++i) {
350 ASSERT_EQ(vector1.get(i), vector2.get(i));
351 }
352}
353
354TEST(BitVectorTest, Increment) {
355 storm::storage::BitVector vector1(130, false);
356 storm::storage::BitVector vector2(130, false);
357
358 vector1.increment();
359 EXPECT_EQ(1ull, vector1.getNumberOfSetBits());
360 vector2.set(0, true);
361 EXPECT_EQ(vector1, vector2);
362
363 vector1.increment();
364 EXPECT_EQ(1ull, vector1.getNumberOfSetBits());
365 vector2.clear();
366 vector2.set(1, true);
367 EXPECT_EQ(vector1, vector2);
368
369 vector1.increment();
370 EXPECT_EQ(2ull, vector1.getNumberOfSetBits());
371 vector2.set(0, true);
372 EXPECT_EQ(vector1, vector2);
373
374 vector1.clear();
375 for (uint64_t i = 0; i < 66; ++i) {
376 vector1.set(i, true);
377 }
378 vector1.increment();
379 EXPECT_EQ(1ull, vector1.getNumberOfSetBits());
380 vector2.clear();
381 vector2.set(66, true);
382 EXPECT_EQ(vector1, vector2);
383
384 vector1.increment();
385 EXPECT_EQ(2ull, vector1.getNumberOfSetBits());
386 vector2.set(0, true);
387 EXPECT_EQ(vector1, vector2);
388
389 vector1.clear();
390 vector1.complement();
391 EXPECT_TRUE(vector1.full());
392 vector1.increment();
393 EXPECT_TRUE(vector1.empty());
394}
395
396TEST(BitVectorTest, permute) {
397 storm::storage::BitVector vector1(9, {3, 5});
398 std::vector<uint64_t> inversePermutation = {0, 1, 3, 2, 4, 6, 5, 8, 7};
399 storm::storage::BitVector vector2 = vector1.permute(inversePermutation);
400 EXPECT_EQ(vector1.getNumberOfSetBits(), vector2.getNumberOfSetBits());
401 EXPECT_TRUE(vector2.get(2));
402 EXPECT_TRUE(vector2.get(6));
403}
404
405TEST(BitVectorTest, permuteGrouped) {
406 storm::storage::BitVector vector1(6, {0, 2, 5});
407 std::vector<uint64_t> inversePermutation = {1, 0, 2};
408 std::vector<uint64_t> groupIndices = {0, 3, 5, 6};
409 storm::storage::BitVector permuted = vector1.permuteGroupedVector(inversePermutation, groupIndices);
410 storm::storage::BitVector expected(6, {2, 4, 5});
411 EXPECT_EQ(expected, permuted);
412}
413
414TEST(BitVectorTest, Implies) {
415 storm::storage::BitVector vector1(32);
416 storm::storage::BitVector vector2(32, true);
417
418 for (uint64_t i = 0; i < 32; ++i) {
419 vector1.set(i, i % 2 == 0);
420 }
421 vector2.set(31, false);
422 vector2.set(30, false);
423
424 storm::storage::BitVector impliesResult = vector1.implies(vector2);
425
426 for (uint64_t i = 0; i < 30; ++i) {
427 ASSERT_TRUE(impliesResult.get(i));
428 }
429 ASSERT_FALSE(impliesResult.get(30));
430 ASSERT_TRUE(impliesResult.get(31));
431}
432
433TEST(BitVectorTest, Subset) {
434 storm::storage::BitVector vector1(32);
435 storm::storage::BitVector vector2(32, true);
436
437 for (uint64_t i = 0; i < 32; ++i) {
438 vector1.set(i, i % 2 == 0);
439 }
440
441 ASSERT_TRUE(vector1.isSubsetOf(vector2));
442
443 vector2.set(16, false);
444
445 ASSERT_FALSE(vector1.isSubsetOf(vector2));
446}
447
448TEST(BitVectorTest, Disjoint) {
449 storm::storage::BitVector vector1(32);
450 storm::storage::BitVector vector2(32);
451
452 for (uint64_t i = 0; i < 32; ++i) {
453 vector1.set(i, i % 2 == 0);
454 vector2.set(i, i % 2 == 1);
455 }
456
457 ASSERT_TRUE(vector1.isDisjointFrom(vector2));
458
459 vector2.set(16, true);
460
461 ASSERT_FALSE(vector1.isDisjointFrom(vector2));
462}
463
464TEST(BitVectorTest, Empty) {
465 storm::storage::BitVector vector(32);
466
467 ASSERT_TRUE(vector.empty());
468
469 vector.set(17, true);
470
471 ASSERT_FALSE(vector.empty());
472
473 vector.set(17, false);
474 vector.set(18, false);
475
476 ASSERT_TRUE(vector.empty());
477}
478
479TEST(BitVectorTest, Full) {
480 storm::storage::BitVector vector(32, true);
481
482 ASSERT_TRUE(vector.full());
483
484 vector.set(17, false);
485
486 ASSERT_FALSE(vector.full());
487
488 vector.set(17, true);
489 vector.set(18, true);
490
491 ASSERT_TRUE(vector.full());
492}
493
494TEST(BitVectorTest, NumberOfSetBits) {
495 storm::storage::BitVector vector(32);
496
497 for (uint64_t i = 0; i < 32; ++i) {
498 vector.set(i, i % 2 == 0);
499 }
500
501 ASSERT_EQ(16ul, vector.getNumberOfSetBits());
502}
503
504TEST(BitVectorTest, NumberOfSetBitsBeforeIndex) {
505 storm::storage::BitVector vector(32);
506
507 for (uint64_t i = 0; i < 32; ++i) {
508 vector.set(i, i % 2 == 0);
509 }
510
511 ASSERT_EQ(7ul, vector.getNumberOfSetBitsBeforeIndex(14));
512}
513
514TEST(BitVectorTest, BeginEnd) {
515 storm::storage::BitVector vector(32);
516
517 ASSERT_TRUE(vector.begin() == vector.end());
518
519 vector.set(17);
520
521 ASSERT_FALSE(vector.begin() == vector.end());
522
523 vector.set(17, false);
524
525 ASSERT_TRUE(vector.begin() == vector.end());
526}
527
528TEST(BitVectorTest, NextSetIndex) {
529 storm::storage::BitVector vector(32);
530
531 vector.set(14);
532 vector.set(17);
533
534 ASSERT_EQ(14ul, vector.getNextSetIndex(14));
535 ASSERT_EQ(17ul, vector.getNextSetIndex(15));
536 ASSERT_EQ(17ul, vector.getNextSetIndex(16));
537 ASSERT_EQ(17ul, vector.getNextSetIndex(17));
538 ASSERT_EQ(vector.size(), vector.getNextSetIndex(18));
539}
540
541TEST(BitVectorTest, NextUnsetIndex) {
542 storm::storage::BitVector vector(32);
543
544 vector.set(14);
545 vector.set(17);
546
547 vector.complement();
548
549 ASSERT_EQ(14ul, vector.getNextUnsetIndex(14));
550 ASSERT_EQ(17ul, vector.getNextUnsetIndex(15));
551 ASSERT_EQ(17ul, vector.getNextUnsetIndex(16));
552 ASSERT_EQ(17ul, vector.getNextUnsetIndex(17));
553 ASSERT_EQ(vector.size(), vector.getNextUnsetIndex(18));
554}
555
556TEST(BitVectorTest, SequenceBefore) {
557 storm::storage::BitVector vector(65);
558
559 vector.set(14);
560 vector.set(17);
561 vector.set(64);
562
563 auto vector_compl = ~vector;
564
565 for (uint64_t i = 0; i <= 65; ++i) {
566 uint64_t expected;
567 if (i <= 14) {
568 expected = 0ul;
569 } else if (i <= 17) {
570 expected = 15ul;
571 } else if (i <= 64) {
572 expected = 18ul;
573 } else {
574 expected = 65ul;
575 }
576 ASSERT_EQ(expected, vector.getStartOfZeroSequenceBefore(i)) << " input index is i=" << i;
577 ASSERT_EQ(expected, vector_compl.getStartOfOneSequenceBefore(i)) << " input index is i=" << i;
578 }
579}
580
581TEST(BitVectorTest, Iterator) {
582 storm::storage::BitVector vector(32);
583
584 for (uint64_t i = 0; i < 32; ++i) {
585 vector.set(i, i % 2 == 0);
586 }
587
588 uint64_t i = 0;
589 for (auto bit : vector) {
590 ASSERT_EQ(i, bit);
591 i += 2;
592 }
593 ASSERT_EQ(i, 32ull);
594}
595
596TEST(BitVectorTest, ReverseIterator) {
597 storm::storage::BitVector vector(547490);
598
599 uint64_t i = 2;
600 for (; i < vector.size(); i += 3) {
601 vector.set(i, true);
602 }
603
604 for (auto bitIt = vector.rbegin(); bitIt != vector.rend(); ++bitIt) {
605 i -= 3;
606 ASSERT_EQ(i, *bitIt);
607 }
608 ASSERT_EQ(i, 2ull);
609}
610
611TEST(BitVectorTest, CompareAndSwap) {
612 storm::storage::BitVector vector(140);
613 vector.setFromInt(0, 64, 2377830234574424100);
614 vector.setFromInt(64, 64, 1152921504607379586);
615 vector.setFromInt(128, 12, 2080);
616
617 bool result = vector.compareAndSwap(0, 68, 68);
618 ASSERT_FALSE(result);
619
620 result = vector.compareAndSwap(68, 0, 68);
621 ASSERT_TRUE(result);
622}
623
624TEST(BitVectorTest, Concat) {
625 storm::storage::BitVector vector1(64, {3, 5});
626 storm::storage::BitVector vector2(65, {10, 12});
627
628 vector1.concat(vector2);
629 ASSERT_EQ(129ul, vector1.size());
630 ASSERT_TRUE(vector1.get(3));
631 ASSERT_TRUE(vector1.get(5));
632 ASSERT_TRUE(vector1.get(10 + 64));
633 ASSERT_TRUE(vector1.get(12 + 64));
634 ASSERT_EQ(4ul, vector1.getNumberOfSetBits());
635}
636
637TEST(BitVectorTest, Expand) {
638 storm::storage::BitVector vector1(64, {3, 5});
639 vector1.expandSize();
640 ASSERT_EQ(64ul, vector1.size());
641 ASSERT_EQ(2ul, vector1.getNumberOfSetBits());
642 storm::storage::BitVector vector2(65, {10, 12});
643 vector2.expandSize();
644 ASSERT_EQ(128ul, vector2.size());
645 ASSERT_EQ(2ul, vector2.getNumberOfSetBits());
646}
647
648TEST(BitVectorTest, Assignment) {
649 storm::storage::BitVector v1(10), v2(100000);
650 v1 = v2;
651 v1.set(9999);
652 ASSERT_TRUE(v1.get(9999));
653}
654
655TEST(BitVectorTest, ZeroSized) {
657 EXPECT_EQ(0ul, v.size());
658 EXPECT_TRUE(v.empty());
659 EXPECT_TRUE(v.full());
660 EXPECT_EQ(0ul, v.getNumberOfSetBits());
661 EXPECT_EQ(0ul, v.getAsInt(0, 0));
662 EXPECT_EQ(0ul, v.getNextSetIndex(0));
663 EXPECT_EQ(v, v);
664 EXPECT_EQ(v, ~v);
665 for (auto const& entry : v) {
666 FAIL() << "Should not iterate over an empty bit vector.";
667 ASSERT_FALSE(entry);
668 }
669}
TEST(BitVectorTest, InitToZero)
PositionIteratorType Iterator
A bit vector that is internally represented as a vector of 64-bit values.
Definition BitVector.h:16
void complement()
Negates all bits in the bit vector.
const_reverse_iterator rbegin() const
Returns a reverse iterator to the indices of the set bits in the bit vector.
uint64_t getNextSetIndex(uint64_t startingIndex) const
Retrieves the index of the bit that is the next bit set to true in the bit vector.
bool isDisjointFrom(BitVector const &other) const
Checks whether none of the bits that are set in the current bit vector are also set in the given bit ...
bool full() const
Retrieves whether all bits are set in this bit vector.
const_reverse_iterator rend() const
Returns a reverse iterator pointing at the element past the front of the bit vector.
const_iterator end() const
Returns an iterator pointing at the element past the back of the bit vector.
bool empty() const
Retrieves whether no bits are set to true in this bit vector.
void clear()
Removes all set bits from the bit vector.
bool isSubsetOf(BitVector const &other) const
Checks whether all bits that are set in the current bit vector are also set in the given bit vector.
BitVector implies(BitVector const &other) const
Performs a logical "implies" with the given bit vector.
uint64_t getNumberOfSetBits() const
Returns the number of bits that are set to true in this bit vector.
uint64_t getNextUnsetIndex(uint64_t startingIndex) const
Retrieves the index of the bit that is the next bit set to false in the bit vector.
bool compareAndSwap(uint64_t start1, uint64_t start2, uint64_t length)
Compare two intervals [start1, start1+length] and [start2, start2+length] and swap them if the second...
void setFromInt(uint64_t bitIndex, uint64_t numberOfBits, uint64_t value)
Sets the selected number of lowermost bits of the provided value at the given bit index.
BitVector permute(std::vector< uint64_t > const &inversePermutation) const
Apply a permutation of entries.
void set(uint64_t index, bool value=true)
Sets the given truth value at the given index.
void increment()
Increments the (unsigned) number represented by this BitVector by one.
const_iterator begin() const
Returns an iterator to the indices of the set bits in the bit vector.
uint64_t getStartOfZeroSequenceBefore(uint64_t endIndex) const
Retrieves the smallest index i such that all bits in the range [i,endIndex) are 0.
uint64_t getAsInt(uint64_t bitIndex, uint64_t numberOfBits) const
Retrieves the content of the current bit vector at the given index for the given number of bits as an...
size_t size() const
Retrieves the number of bits this bit vector can store.
void resize(uint64_t newLength, bool init=false)
Resizes the bit vector to hold the given new number of bits.
void expandSize(bool init=false)
bool get(uint64_t index) const
Retrieves the truth value of the bit at the given index and performs a bound check.
uint64_t getNumberOfSetBitsBeforeIndex(uint64_t index) const
Retrieves the number of bits set in this bit vector with an index strictly smaller than the given one...
BitVector permuteGroupedVector(std::vector< uint64_t > const &inversePermutation, std::vector< uint64_t > const &rowGroupIndices) const
Apply a permutation of entries assuming a grouped vector.
void concat(BitVector const &extension)
Concatenate this bitvector with another bitvector.