30 if (r < c) std::swap(r, c);
31 return bitvec::operator[]((r * r + r) / 2 + c);
33 bool operator()(
unsigned r,
unsigned c)
const {
34 if (r < c) std::swap(r, c);
35 return bitvec::operator[]((r * r + r) / 2 + c);
37 unsigned size()
const {
38 if (empty())
return 0;
41 while ((r * r + r) / 2 <= m) r++;
46 using bitvec::operator bool;
49 using bitvec::operator|=;
55 rowref(T &s,
unsigned r) : self(s), row(r) {}
58 rowref(
const rowref &) =
default;
59 rowref(rowref &&) =
default;
60 explicit operator bool()
const {
61 if (row < bits_per_unit) {
62 if (self.getrange((row * row + row) / 2, row + 1) != 0)
return true;
64 if (self.getslice((row * row + row) / 2, row + 1))
return true;
66 const auto size = self.size();
67 for (
auto c = row + 1; c < size; ++c)
68 if (self(row, c))
return true;
72 auto rv = self.getslice((row * row + row) / 2, row + 1);
73 const auto size = self.size();
74 for (
auto c = row + 1; c < size; ++c)
75 if (self(row, c)) rv[c] = 1;
79 class nonconst_rowref :
public rowref<SymBitMatrix> {
83 void operator|=(
bitvec a)
const {
88 nonconst_bitref operator[](
unsigned col)
const {
return self(row, col); }
90 class const_rowref :
public rowref<const SymBitMatrix> {
94 bool operator[](
unsigned col)
const {
return self(row, col); }
98 nonconst_rowref operator[](
unsigned r) {
return nonconst_rowref(*
this, r); }
99 const_rowref operator[](
unsigned r)
const {
return const_rowref(*
this, r); }
101 bool operator==(
const SymBitMatrix &a)
const {
return bitvec::operator==(a); }
102 bool operator!=(
const SymBitMatrix &a)
const {
return bitvec::operator!=(a); }
103 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:24