#include <bitset.h>
Inheritance diagram for atlas::bitset::BitSet< n >:


Public Types | |
| typedef Base::iterator | iterator |
| typedef iterator | const_iterator |
Public Member Functions | |
| BitSet () | |
| BitSet (unsigned long b) | |
| ~BitSet () | |
| template<size_t m> | |
| BitSet (const BitSet< m > &b) | |
| template<size_t m> | |
| BitSet & | operator= (const BitSet< m > &b) |
| bool | operator== (const BitSet &b) const |
| bool | operator!= (const BitSet &b) const |
| bool | operator< (const BitSet &b) const |
| bool | operator[] (size_t j) const |
| BitSet | operator & (const BitSet &b) const |
| BitSet | operator| (const BitSet &b) const |
| BitSet | operator^ (const BitSet &b) const |
| bool | any () const |
| Tests whether BitSet is nonempty. | |
| bool | any (const BitSet &b) const |
| Tests whether BitSet and b have non-empty intersection. | |
| iterator | begin () const |
| bool | contains (const BitSet &b) const |
| Tests whether BitSet contains b. | |
| size_t | count () const |
| Number of set bits in BitSet. | |
| size_t | firstBit () const |
| Position of the first set bit in BitSet. | |
| size_t | lastBit () const |
| position of the last set bit in BitSet. | |
| bool | none () const |
| Tests whether the corresponding set is empty. | |
| size_t | position (size_t j) const |
| Number of set bits in position < j. | |
| bool | scalarProduct (const BitSet &b) const |
| size_t | size () const |
| bool | test (size_t j) const |
| Tests bit j of BitSet. | |
| unsigned long | to_ulong () const |
| The first wordlength bits of BitSet, interpreted as an unsigned long integer. | |
| unsigned long | to_ulong1 () const |
| The second wordlength bits of BitSet, interpreted as an unsigned long integer. | |
| BitSet & | operator^= (const BitSet &b) |
| BitSet & | operator|= (const BitSet &b) |
| BitSet & | operator &= (const BitSet &b) |
| BitSet & | operator<<= (size_t c) |
| BitSet & | operator>>= (size_t c) |
| BitSet & | andnot (const BitSet &b) |
| BitSet & | flip () |
| BitSet & | flip (size_t j) |
| BitSet & | permute (const setutils::Permutation &a) |
| Applies the permutation a to the BitSet. | |
| BitSet & | reset () |
| Sets every bit of BitSet to zero. (Empties the set.). | |
| BitSet & | reset (size_t j) |
| BitSet & | set () |
| Sets the first n bits of BitSet to one. (Fills the set.). | |
| BitSet & | set (size_t j) |
| BitSet & | set (size_t j, bool b) |
| BitSet & | slice (const BitSet &c) |
| Replaces the bitset by the "defragmented" intersection with c (i.e., the bits of that intersection are written consecutively.). | |
| void | swap (BitSet &source) |
| BitSet & | truncate (size_t m) |
| Sets all bits after m to zero. | |
Private Types | |
| typedef BitSetBase< BaseSize< n >::value > | Base |
| Class from which BitSet<n> is derived. | |
The software formally allows for n between 0 and four times the machine word length; now up to two times the machine word length is implemented.
The BitSet class has essentially the functionality of the bitset class from the STL, but I have redone it because I needed some things that bitset doesn't seem to provide. This is a very important data type for the program, and it is crucial that it should be efficiently implemented.
The main difference is that _all_ my BitSets are fixed size; they are provided for up to 128 bits on 32-bit machines, 256 bits on 64-bit machines. So the intention is to use them for small bitmaps. This allows for optimal speed, at the cost of some code duplication (but almost all the functions in the class are easily inlined.) [In fact BitSets of size more than twice the word length are not fully implemented in the present software. The gap is that BitSet<n> calls on BitSetBase<m>, where m is the smallest integer greater than or equal to n/longBits. (The size m is computed from n by the function BaseSize::value.) The class BitSetBase<m> is actually implemented only for m = 1, 2. DV]
Just as for the implementation of bitset in the STL that I took as a model, the size is rounded of to multiples of the number of bits in an unsigned long, so that in effect there are only four instances of the BitSetBase to provide (or five, counting the 0-size BitSet.)
The main difference with the STL is the to_ulong() method; mine will truncate the bitset when the number of bits is too long, instead of throwing an exception.
Although I had implemented bit-references, and even though it is an interesting C++ trick that shows to what extent you can twist the notation to do what you want, I dismissed it now as syntactic sugar. Use b.set(i,value) instead of b[i] = value. Operator[] is now defined only as an access operator, equivalent to test().
The output operator is in io/ioutils.h.
The first typedef defines Base to be BitSetBase<m>. Consequently function references of the form Base::contains refer to BitSetBase<m>::contains. [DV doesn't know whether this could have been avoided by replacing ":private BitSetBase" by ":public BitSetBase" in the template for BitSet, and just invoking the (public) member functions of the base class directly. MvL thinks that that would be possible; this depends on the fact (also used in the actual implementation below) that the argument of 'contains' is implicitly converted to its base class BitSetBase<m> because the method of the base class requires this. However, this would expose _all_ public methods of BitSetBase to users of BitSet, which is not desired. This could however be remedied by making protected rather than public the methods of BitSetBase that are only for internal use by BitSet implementations.]
Definition at line 826 of file bitset.h.
|
|||||
|
Class from which BitSet<n> is derived.
|
|
|||||
|
|
|
|||||
|
|
|
|||||||||
|
|
|
||||||||||
|
|
|
|||||||||
|
|
|
||||||||||||||
|
Copy from other size BitSets is by truncation or extension by zero. |
|
||||||||||
|
Performs a bitwise "and not" of this BitSet with the argument BitSet b (which remains unchanged). Definition at line 1032 of file bitset.h. Referenced by atlas::dynkin::DynkinDiagram::component(), atlas::kl::helper::Helper::lengthOneMu(), and atlas::cartanclass::CartanClass::makeSimpleComplex(). |
|
||||||||||
|
Tests whether BitSet and b have non-empty intersection. Returns whether any bit is 1 in both BitSet and b. |
|
|||||||||
|
Tests whether BitSet is nonempty. Returns whether any bit of the BitSet is 1 Definition at line 897 of file bitset.h. Referenced by atlas::dynkin::DynkinDiagram::component(), atlas::cartanclass::CartanClass::isMostSplit(), atlas::kl::helper::Helper::lengthOneMu(), and atlas::bitvector::BitVector< dim >::nonZero(). |
|
|||||||||
|
Iterator pointing to the first set bit of BitSet. Seems not yet to be implemented for BitSetBase<2>. Definition at line 915 of file bitset.h. Referenced by atlas::rootdata::RootDatum::beginCoradical(), atlas::rootdata::RootDatum::beginCoroot(), atlas::rootdata::RootDatum::beginRadical(), atlas::rootdata::RootDatum::beginRoot(), atlas::cartanset::CartanClassSet::canonicalize(), atlas::dynkin::DynkinDiagram::DynkinDiagram(), atlas::bitvector::BitMatrix< dim >::kernel(), atlas::cartanclass::Fiber::makeFiberMap(), atlas::cartanclass::Fiber::makeGradingShifts(), atlas::cartanclass::CartanClass::makeSimpleComplex(), atlas::typeDNormalize(), and atlas::bitvector::BitVector< dim >::unslice(). |
|
||||||||||
|
Tests whether BitSet contains b.
Definition at line 922 of file bitset.h. Referenced by atlas::wgraph::wGraph(). |
|
|||||||||
|
Number of set bits in BitSet. This is the cardinality of the corresponding set. Definition at line 931 of file bitset.h. Referenced by atlas::bitvector::BitVector< dim >::count(), atlas::dynkin::DynkinDiagram::DynkinDiagram(), atlas::gradings::GradingCompare::operator()(), and atlas::printSimpleType(). |
|
|||||||||
|
Position of the first set bit in BitSet. Returns the capacity of the BitSet if there is no such bit. Definition at line 940 of file bitset.h. Referenced by atlas::interpreter::check_involution(), atlas::bitvector::BitVector< dim >::firstBit(), atlas::kl::helper::Helper::lengthOneMu(), atlas::kgb::makeHasse(), atlas::klsupport::KLSupport::primitivize(), and atlas::printSimpleType(). |
|
||||||||||
|
|
|
|||||||||
|
Definition at line 1037 of file bitset.h. Referenced by atlas::compactEquations(), atlas::bitvector::BitVector< dim >::flip(), atlas::bitset::operator~(), and atlas::cartanset::transformGrading(). |
|
|||||||||
|
position of the last set bit in BitSet. Returns 0 if there is no such bit. |
|
|||||||||
|
Tests whether the corresponding set is empty. Returns 1 if no bit of BitSet is set, and 0 otherwise. Definition at line 958 of file bitset.h. Referenced by atlas::cartanclass::CartanClass::isMostSplit(), atlas::bitvector::BitVector< dim >::isZero(), and atlas::kgb::makeHasse(). |
|
||||||||||
|
|
|
||||||||||
|
|
|
||||||||||
|
|
|
||||||||||
|
|
|
||||||||||
|
|
|
||||||||||||||
|
Assignment from other size BitSets is by truncation or extension by zero. |
|
||||||||||
|
|
|
||||||||||
|
|
|
||||||||||
|
|
|
||||||||||
|
|
|
||||||||||
|
|
|
||||||||||
|
|
|
||||||||||
|
|
|
||||||||||
|
Applies the permutation a to the BitSet.
Definition at line 1051 of file bitset.h. Referenced by atlas::interpreter::print_gradings_wrapper(), and atlas::cartan_io::printGradings(). |
|
||||||||||
|
Number of set bits in position < j. If j is set, this is the position of j in the set of set bits. Definition at line 967 of file bitset.h. Referenced by atlas::dynkin::DynkinDiagram::DynkinDiagram(). |
|
||||||||||
|
|
|
|||||||||
|
Sets every bit of BitSet to zero. (Empties the set.).
Definition at line 1059 of file bitset.h. Referenced by atlas::cartanset::CartanClassSet::canonicalize(), atlas::rootdata::RootDatum::fillStatus(), atlas::bitvector::firstSolution(), atlas::cartanclass::CartanClass::makeSimpleComplex(), atlas::bitvector::normalize(), atlas::bitvector::BitMatrix< constants::RANK_MAX >::reset(), and atlas::bitvector::BitVector< dim >::reset(). |
|
||||||||||
|
Definition at line 971 of file bitset.h. Referenced by atlas::FiberAction::grading(). |
|
||||||||||||||||
|
|
|
||||||||||
|
|
|
|||||||||
|
|||||||||
|
Definition at line 975 of file bitset.h. Referenced by atlas::interpreter::check_involution(), atlas::bitvector::firstSolution(), atlas::cartanset::makeRepresentative(), atlas::interpreter::print_gradings_wrapper(), and atlas::bitvector::BitMatrix< constants::RANK_MAX >::setColumn(). |
|
||||||||||
|
Replaces the bitset by the "defragmented" intersection with c (i.e., the bits of that intersection are written consecutively.). More precisely: if c has m set bits, then the BitSet is replaced by putting in its first m bits the values previously found in the positions flagged by c. The remaining bits are made 0. This is used for linear algebra, as follows. Suppose a subspace of (Z/2Z)^n is given its unique basis in row-reduced form, and that the leading bits of the basis vectors are flagged by c. (This is how subspaces are represented in the NormalSubspace class.) If the BitVector belongs to this subspace, then applying slice(c) puts in the BitVector its coordinates with respect to the row-reduced basis. Definition at line 1104 of file bitset.h. Referenced by atlas::subquotient::Subquotient< dim >::apply(), atlas::dynkin::DynkinDiagram::DynkinDiagram(), and atlas::subquotient::Subquotient< dim >::Subquotient(). |
|
||||||||||
|
||||||||||
|
|||||||||
|
The first wordlength bits of BitSet, interpreted as an unsigned long integer.
Definition at line 990 of file bitset.h. Referenced by atlas::cartanclass::Fiber::gradingRep(), atlas::tits::TE_Entry::hashCode(), atlas::cartanset::makeRepresentative(), atlas::GradingAction::operator()(), atlas::FiberAction::operator()(), atlas::bitset::BitSetBase< 2 >::operator=(), atlas::bitset::BitSetBase< 1 >::operator=(), atlas::gradings::Status::operator[](), atlas::filekl::block_info::prims_for_descents_of(), atlas::cartanclass::Fiber::toAdjoint(), and atlas::filekl::write_block_file(). |
|
|||||||||
|
The second wordlength bits of BitSet, interpreted as an unsigned long integer.
Definition at line 998 of file bitset.h. Referenced by atlas::bitset::BitSetBase< 2 >::operator=(). |
|
||||||||||
|
Sets all bits after m to zero.
Definition at line 1116 of file bitset.h. Referenced by atlas::printType(), and atlas::bitset::set(). |
1.3.9.1