21 if (r < c) std::swap(r, c);
22 return bitvec::operator[]((r * r + r) / 2 + c);
24 bool operator()(
unsigned r,
unsigned c)
const {
25 if (r < c) std::swap(r, c);
26 return bitvec::operator[]((r * r + r) / 2 + c);
28 unsigned size()
const {
29 if (empty())
return 0;
32 while ((r * r + r) / 2 <= m) r++;
37 using bitvec::operator bool;
40 using bitvec::operator|=;
46 rowref(T &s,
unsigned r) : self(s), row(r) {}
49 rowref(
const rowref &) =
default;
50 rowref(rowref &&) =
default;
51 explicit operator bool()
const {
52 if (row < bits_per_unit) {
53 if (self.getrange((row * row + row) / 2, row + 1) != 0)
return true;
55 if (self.getslice((row * row + row) / 2, row + 1))
return true;
57 const auto size = self.size();
58 for (
auto c = row + 1; c < size; ++c)
59 if (self(row, c))
return true;
62 operator bitvec()
const {
63 auto rv = self.getslice((row * row + row) / 2, row + 1);
64 const auto size = self.size();
65 for (
auto c = row + 1; c < size; ++c)
66 if (self(row, c)) rv[c] = 1;
70 class nonconst_rowref :
public rowref<SymBitMatrix> {
74 void operator|=(bitvec a)
const {
79 nonconst_bitref operator[](
unsigned col)
const {
return self(row, col); }
81 class const_rowref :
public rowref<const SymBitMatrix> {
85 bool operator[](
unsigned col)
const {
return self(row, col); }
89 nonconst_rowref operator[](
unsigned r) {
return nonconst_rowref(*
this, r); }
90 const_rowref operator[](
unsigned r)
const {
return const_rowref(*
this, r); }
92 bool operator==(
const SymBitMatrix &a)
const {
return bitvec::operator==(a); }
93 bool operator!=(
const SymBitMatrix &a)
const {
return bitvec::operator!=(a); }
94 bool operator|=(
const SymBitMatrix &a) {
return bitvec::operator|=(a); }
TODO: this is not really specific to BMV2, it should reside somewhere else.
Definition applyOptionsPragmas.cpp:13