#include <bitmap.h>
Public Types | |
| typedef unsigned long | value_type |
| typedef value_type & | reference |
| typedef const value_type & | const_reference |
| typedef value_type * | pointer |
| typedef const value_type * | const_pointer |
| typedef ptrdiff_t | difference_type |
| typedef unsigned long | size_type |
| typedef iterator | const_iterator |
Public Member Functions | |
| iterator | begin () const |
| iterator | end () const |
| returns the past-the-end iterator for the bitmap. | |
| iterator | pos (unsigned long) const |
| BitMap () | |
| BitMap (unsigned long n) | |
| Constructs a zero-initialized bitmap with a capacity of n bits. | |
| BitMap (const BitMap &b) | |
| template<typename I, typename J> | |
| BitMap (const I &, const I &, const J &, const J &) | |
| ~BitMap () | |
| BitMap & | operator= (const BitMap &) |
| bool | operator< (const BitMap &b) const |
| bool | operator== (const BitMap &b) const |
| bool | back_up (unsigned long &n) const |
| unsigned long | capacity () const |
| bool | contains (const BitMap &b) const |
| bool | empty () const |
| unsigned long | front () const |
| bool | full () const |
| bool | isMember (unsigned long n) const |
| unsigned long | n_th (unsigned long) const |
| unsigned long | position (unsigned long) const |
| unsigned long | range (unsigned long first, unsigned long number) const |
| size_type | size () const |
| BitMap & | operator~ () |
| bool | operator &= (const BitMap &) |
| BitMap & | operator|= (const BitMap &) |
| BitMap & | operator^= (const BitMap &) |
| bool | andnot (const BitMap &) |
| void | fill () |
| void | fill (unsigned long) |
| void | flip (unsigned long n) |
| void | insert (unsigned long n) |
| void | remove (unsigned long n) |
| void | set_to (unsigned long n, bool b) |
| void | set_mod2 (unsigned long n, unsigned long v) |
| template<typename I> | |
| void | insert (const I &, const I &) |
| iterator | insert (iterator, unsigned long n) |
| void | reset () |
| void | set_capacity (unsigned long n) |
| void | resize (unsigned long n) |
| void | setRange (unsigned long, unsigned long, unsigned long) |
| void | swap (BitMap &) |
Private Attributes | |
| std::vector< unsigned long > | d_map |
| unsigned long | d_capacity |
Static Private Attributes | |
| unsigned long | posBits = constants::posBits |
| unsigned long | baseBits = constants::baseBits |
| unsigned long | baseShift = constants::baseShift |
From the point of view of a user of the class, a BitMap should be seen as a container of _unsigned long_, not bits: these unsigned longs are the addresses of the set bits. When the class is used for example to flag the noncompact roots in a set of roots, it is most convenient to think of it as containing the numbers of the noncompact roots (on a fixed list of all roots). The class obeys the semantics of a Forward Container (from the C++ standard library). Its "size" as a container is the number of unsigned long that it "contains"; that is, the number of set bits in the bitmap.
The basic data is in d_map, a vector of unsigned long integers. Each of these integers is a "chunk" (of size longBits, presumably the machine word length) of the bit map. The capacity (in bits) of the BitMap is d_capacity; the size of the vector d_map is d_capacity/longBits (plus one if there is a remainder in the division).
We wish to provide bit-address access to this map; for this purpose we use the reference trick from vector<bool>. Also we wish to define an iterator class, which traverses the _set_ bits of the bitmap; so that for instance, b.begin() would be a reference to the first set bit. Dereferencing the iterator yields its bit-address.
Definition at line 51 of file bitmap.h.
|
|
Definition at line 78 of file bitmap.h. Referenced by atlas::bitmap::BitMap::iterator::iterator(), n_th(), and size(). |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
type for a component of the vector d_map holding the BitMap |
|
|
|
|
|
Constructs a zero-initialized bitmap with a capacity of n bits. Notice that the size of the vector |d_map| exceeds |n >> baseShift| by one unless |longBits| exactly divides |n|. Definition at line 92 of file bitmap.h. References atlas::constants::baseShift, and atlas::constants::posBits. |
|
|
|
|
||||||||||||||||||||||||
|
In this constructor template we assume that I and J are iterator types with the same value_type. The idea is that [first,last[ is an ordered range, for which we can call lower_bound. Then we construct the bitmap which flags the elements from [fsub,lsub[ (not necessarily assumed ordered or in range; I should be random-access, but J can basically be any input iterator.) It is assumed of course that the elements from [fsub,lsub[ will be found in [first,last[. Definition at line 24 of file bitmap_def.h. |
|
|
|
|
|
Synopsis: takes the current bitmap into its set-difference with |b|, i.e., removes from our bitmap any elements appearing in |b|. Return whether any bits remain in the result. Definition at line 403 of file bitmap.cpp. References capacity(), and d_map. Referenced by atlas::cartanclass::Fiber::compactRoots(), atlas::cartanset::CartanClassSet::extend(), atlas::poset::Poset::findMaximals(), atlas::quotGenerator(), atlas::abelian::quotReps(), atlas::setCycGenerator(), and atlas::updateCycGenerator(). |
|
|
Synopsis: decrements |n| until it points to a member of the bitset, or if none is found returns |false| (in which case |n| is unchanged) Definition at line 133 of file bitmap.cpp. References d_map, and atlas::bits::lastBit(). Referenced by atlas::poset::Poset::findMaximals(). |
|
|
|
Number of bits in use in the bitmap. This is the capacity of the BitMap as a standard library container, not d_map.size(), which is approximately longBits times smaller. Definition at line 124 of file bitmap.h. Referenced by andnot(), atlas::poset::Poset::findMaximals(), operator &=(), operator^=(), operator|=(), atlas::prettyprint::prettyPrint(), and atlas::filekl::write_KL_row(). |
|
|
Tells whether the current bitmap contains |b|. It is assumed that |b.capacity()<=capacity()|. This would amount to |b.andnot(*this).empty()| if |b| were by-value rather than reference, and if capacities were equal. Definition at line 147 of file bitmap.cpp. |
|
|
Tells whether the bitmap is empty. Thanks to our convention of zeroing unused bits, it is enough to check whether all the components of d_map are zero. Definition at line 173 of file bitmap.cpp. References d_map. Referenced by atlas::setCycGenerator(), and atlas::cartanclass::toMostSplit(). |
|
|
|
Synopsis: sets all the bits in position < n, AND clears all later bits Equivalent to |fill()| if |n >= d_capacity|, and to |reset()| if |n=0|. Definition at line 431 of file bitmap.cpp. |
|
|
Synopsis: sets all the bits in the bitmap. As usual we have to be careful to leave the unused bits at the end to zero. Definition at line 418 of file bitmap.cpp. References d_capacity, and d_map. Referenced by atlas::abelian::cycGenerators(), atlas::kgb::KGB::KGB(), atlas::kl::KLContext::makeExtremalRow(), atlas::kl::KLContext::makePrimitiveRow(), atlas::kl::KLContext::primMap(), and atlas::abelian::quotReps(). |
|
|
Definition at line 172 of file bitmap.h. Referenced by atlas::gradings::gradingType(), and atlas::cartanclass::toMostSplit(). |
|
|
Synopsis: returns the address of the first member (set bit) of the bitmap, or past-the-end indicator |d_capacity| if there is no such. Definition at line 187 of file bitmap.cpp. References d_map, and atlas::bits::firstBit(). Referenced by begin(), atlas::gradings::gradingType(), and atlas::cartanclass::toMostSplit(). |
|
|
Tells whether the bitmap is full. This means that all blocks are full, except maybe for the last one where we have to look only at the significant part. Definition at line 204 of file bitmap.cpp. References d_capacity, and d_map. |
|
||||||||||||
|
Definition at line 441 of file bitmap.cpp. References d_map. |
|
||||||||||||||||
|
Here we assume that I is an iterator whose value_type is unsigned long, and we do the sequence of insertions from the range [first,last[. Definition at line 43 of file bitmap_def.h. References insert(). |
|
|
|
Tests whether bit n in the bitmap is set; that is, whether element n is a member of the set. Definition at line 140 of file bitmap.h. Referenced by atlas::cartanset::CartanClassSet::correlateDualForms(), atlas::cartanset::CartanClassSet::correlateForms(), atlas::interpreter::dual_occurrence_matrix_wrapper(), atlas::cartanset::CartanClassSet::extend(), atlas::kgb::KGBHelp::is_compact(), atlas::rootdata::RootDatum::isPosRoot(), atlas::rootdata::RootDatum::isSimpleRoot(), atlas::interpreter::occurrence_matrix_wrapper(), atlas::kl::helper::ThicketIterator::operator++(), atlas::prettyprint::prettyPrint(), atlas::poset_io::printSymmetricPoset(), and atlas::cartanclass::restrictGrading(). |
|
|
Synopsis: returns the index of set bit number i in the bitset; in other words, viewing a bitset b as a container of unsigned long, b.n_th(i) is the value of the element i of b, and the syntax b[i] would have been logical (as usual, the first element is number 0). This returns d_capacity if there is no such element, in other words if at most i bits are set in the bitmap. The condition b.position(b.n_th(i))==i holds whenever 0<=i<=size(). Definition at line 222 of file bitmap.cpp. References atlas::bits::bitCount(), const_iterator, and atlas::bits::firstBit(). Referenced by atlas::interpreter::Cartan_class_wrapper(). |
|
|
Synopsis: intersects the current bitmap with |b|, return value tells whether the result is non-empty. Definition at line 360 of file bitmap.cpp. References capacity(), d_map, and size(). |
|
|
Definition at line 107 of file bitmap.h. References d_map. |
|
|
Definition at line 84 of file bitmap.cpp. References d_capacity, and d_map. |
|
|
Definition at line 111 of file bitmap.h. References d_map. |
|
|
Synopsis: xor's |b| into the current bitmap. Definition at line 389 of file bitmap.cpp. References capacity(), d_map, and size(). |
|
|
Synopsis: unites |b| into the current bitmap. Definition at line 377 of file bitmap.cpp. References capacity(), d_map, and size(). |
|
|
Synopsis: transforms the bitmap into its bitwise complement at returns itself NOTE: one has to be careful about the last chunk, resetting the unused bits to zero. NOTE: the naming of this manipulator is dangerous, as the user might write something like |a &= ~b| and be surprised by the fact that |b| changes value. Incidentally, for that special case there is |a.andnot(b)|. Definition at line 344 of file bitmap.cpp. References d_capacity, and d_map. |
|
|
Synopsis: returns an iterator with bit-address n. Definition at line 120 of file bitmap.cpp. References d_map. Referenced by begin(), atlas::testrun::CoveringIterator::CoveringIterator(), and atlas::testrun::SubgroupIterator::operator=(). |
|
|
Synopsis: returns the number of set bits in positions < n; viewing a bitset b as a container of unsigned long, this is the number of values < n that b contains. If n itself is a member of b, then n==b.n_th(b.position(n)). Definition at line 275 of file bitmap.cpp. References atlas::bits::bitCount(), d_map, and posBits. |
|
||||||||||||
|
Synopsis: returns r bits from position n. Precondition: r divides longBits, and n is a multiple of r. Thus the bits extracted are found in single element of d_map, and such elements define an integral number of disjoint ranges It is required that |n<capacity()|, but not that |n+r<=capacity()|; if the latter fails, the return value is padded out with (leading) zero bits. Definition at line 301 of file bitmap.cpp. References d_map, and atlas::constants::lMask. Referenced by atlas::filekl::write_KL_row(). |
|
|
Puts a 0 in position n of the bitmap (that is, removes an element of the set). Definition at line 187 of file bitmap.h. Referenced by atlas::graph::OrientedGraph::addLinks(), atlas::abelian::cycGenerators(), atlas::gradings::gradingType(), and atlas::cartanclass::toMostSplit(). |
|
|
Definition at line 207 of file bitmap.h. Referenced by atlas::abelian::coset(). |
|
|
Definition at line 213 of file bitmap.h. Referenced by BitMap(), fill(), atlas::firstType(), set_capacity(), and atlas::shape(). |
|
|
Synopsis: sets the capacity of the bitmap to n. Does not modify the contents up to the previous size, at least if n is larger. The new elements are initialized to zero. Definition at line 455 of file bitmap.cpp. References baseShift, d_capacity, d_map, atlas::constants::posBits, posBits, and resize(). Referenced by atlas::testrun::CoveringIterator::CoveringIterator(), atlas::abelian::cycGenerators(), atlas::poset::n_comparable_from_Hasse(), atlas::poset::Poset::Poset(), atlas::rootdata::RootDatum::RootDatum(), atlas::kl::helper::ThicketIterator::ThicketIterator(), and atlas::cartanset::CartanClassSet::updateSupports(). |
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||||||
|
Synopsis: sets r bits from position n to the first r bits in a. Precondition: r divides longBits, and n is aligned (i.e., n is a multiple of r). In this way, we are sure that things happen inside a single word in d_map. Definition at line 472 of file bitmap.cpp. References d_map, and atlas::constants::lMask. Referenced by combine_rows(). |
|
|
Returns the number of set bits in the bitmap (this is its size as a container of unsigned long.) NOTE: correctness depends on unused bits in the final word being cleared. Definition at line 319 of file bitmap.cpp. References atlas::bits::bitCount(), const_iterator, and d_map. Referenced by atlas::graph::OrientedGraph::addLinks(), combine_rows(), fill(), atlas::rootdata::RootDatum::isRoot(), atlas::kgb::KGB::KGB(), atlas::kl::KLContext::makeExtremalRow(), atlas::kl::KLContext::makePrimitiveRow(), atlas::poset::n_comparable_from_Hasse(), atlas::nextInShape(), atlas::nextShape(), atlas::realredgp::RealReductiveGroup::numCartan(), atlas::cartanset::CartanClassSet::numCartan(), atlas::rootdata::RootDatum::numPosRoots(), atlas::rootdata::RootDatum::numRoots(), operator &=(), operator^=(), operator|=(), atlas::kl::KLContext::primMap(), atlas::rGenerators(), atlas::blocks::Block::size(), and atlas::filekl::write_KL_row(). |
|
|
Definition at line 482 of file bitmap.cpp. References d_capacity, and d_map. Referenced by atlas::cartanset::CartanClassSet::extend(), atlas::abelian::generateSubgroup(), atlas::gradings::gradingType(), atlas::rootdata::RootDatum::swap(), atlas::cartanclass::Fiber::swap(), atlas::cartanclass::InvolutionData::swap(), and atlas::cartanset::CartanClassSet::updateTwistedInvolutions(). |
|
|
Constant used to pick a bit-address apart: this is the logical complement of posBits, and masks the word-address within a BitMap index (which still must be shifted right by baseShift to be interpreted correctly, whence this constant is actually little used). It is assumed that the number of bits in an unsigned long is a power of two. Definition at line 59 of file bitmap.cpp. |
|
|
Constant saying how much we have to shift the BitMap index n of a bit (that is, the power of two by which it much be divided) to get the index of the d_map element that contains this bit (it is the number of set bits in posBits, typically 5 or 6). Definition at line 67 of file bitmap.cpp. Referenced by fill(), and set_capacity(). |
|
|
Definition at line 56 of file bitmap.h. Referenced by fill(), full(), operator=(), operator~(), set_capacity(), and swap(). |
|
|
Definition at line 55 of file bitmap.h. Referenced by andnot(), back_up(), empty(), end(), fill(), front(), full(), insert(), operator &=(), operator<(), operator=(), operator==(), operator^=(), operator|=(), operator~(), pos(), position(), range(), set_capacity(), setRange(), size(), and swap(). |
|
|
Definition at line 49 of file bitmap.cpp. Referenced by position(), and set_capacity(). |
1.3.9.1