Main Page | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members

atlas::bitvector::BitVector< dim > Class Template Reference

The template class |BitVector<dim>| represents a number |size| with |0<=size<=dim|, and a vector in the (Z/2Z)-vector space (Z/2Z)^size. More...

#include <bitvector.h>

Collaboration diagram for atlas::bitvector::BitVector< dim >:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 BitVector ()
 BitVector (size_t n)
 BitVector (size_t n, size_t j)
 BitVector (bitset::BitSet< dim > data, size_t n)
 BitVector (const latticetypes::LatticeElt &weight)
 ~BitVector ()
 BitVector (const BitVector &v)
BitVectoroperator= (const BitVector &v)
bool operator< (const BitVector &v) const
bool operator== (const BitVector &v) const
bool operator!= (const BitVector &v) const
bool operator[] (size_t i) const
size_t count ()
const bitset::BitSet< dim > & data () const
size_t firstBit () const
bool isZero () const
bool nonZero () const
size_t size () const
BitVectoroperator+= (const BitVector &v)
BitVectoroperator-= (const BitVector &v)
BitVectoroperator &= (const BitVector &v)
BitVectoroperator>>= (size_t pos)
BitVectoroperator<<= (size_t pos)
BitVectorflip (size_t i)
BitVectorpushBack (bool)
 Adds b to the bitvector (as the last coordinate), increasing the size by one.
BitVectorset (size_t i)
void set (size_t i, bool b)
void set_mod2 (size_t i, unsigned long v)
BitVectorreset ()
BitVectorreset (size_t i)
void resize (size_t n)
void slice (const bitset::BitSet< dim > &mask)
 Extracts the bits flagged by |t|, and packs their value into consecutive positions; resets the size to the number of bits so packed.
void unslice (bitset::BitSet< dim > mask, size_t new_size)
 Undoes the effect of |slice|, inserting zero bits where needed.

Private Attributes

bitset::BitSet< dim > d_data
size_t d_size

Friends

void BitMatrix (BitVector< dim > &, const BitVector< dim > &) const

Detailed Description

template<size_t dim>
class atlas::bitvector::BitVector< dim >

The template class |BitVector<dim>| represents a number |size| with |0<=size<=dim|, and a vector in the (Z/2Z)-vector space (Z/2Z)^size.

The software envisions dim between 0 and four times the machine word length (precisely, four times the constant |longBits|, which is the number of bits in an unsigned long integer). What is now fully implemented allows |dim| to be one or two times the word length (see the discussion in the description of the class BitSet<n>). It seems that only BitVector<RANK_MAX> and BitVector<2*RANK_MAX> are now instantiated, (that is <16> or <32>), so |dim| is not very relevant; one could imagine |dim==longBits| throughout.

Let the integer |m| be $\lceil dim/longBits \rceil$ (quotient rounded upwards) . The vector is stored as the BitSet<dim> |d_data|, which is a (fixed size) array of |m| words of memory. (On a 32 bit machine with RANK_MAX=16 one always has |m==1|, so that |d_data| is a single word of memory.) We look only at the first |d_size| bits of |d_data|; but |d_size| can be changed by manipulators (like the member functions resize and pushBack). [Maybe |d_size| never exceeds |RANK_MAX+1|, even for variables declared as |BitVector<2*RANK_MAX>| MvL]

Given the number of methods that are passed on to the |BitSet<dim>| field |d_data|, one might wonder if it would not have been better to publicly derive from |BitSet<dim>|, MvL.

A BitVector should be thought of as a column vector. A Bitmatrix will in general act on it on the left. [I thought that Fokko always prefers matrices acting on the right on row vectors; but if I am reading this correctly, that preference didn't make it into this software. DV]

Definition at line 147 of file bitvector.h.


Constructor & Destructor Documentation

template<size_t dim>
atlas::bitvector::BitVector< dim >::BitVector  )  [inline]
 

Definition at line 160 of file bitvector.h.

template<size_t dim>
atlas::bitvector::BitVector< dim >::BitVector size_t  n  )  [inline, explicit]
 

Definition at line 164 of file bitvector.h.

template<size_t dim>
atlas::bitvector::BitVector< dim >::BitVector size_t  n,
size_t  j
[inline]
 

Definition at line 168 of file bitvector.h.

References atlas::bitset::set().

template<size_t dim>
atlas::bitvector::BitVector< dim >::BitVector bitset::BitSet< dim >  data,
size_t  n
[inline]
 

Definition at line 174 of file bitvector.h.

template<size_t dim>
atlas::bitvector::BitVector< dim >::BitVector const latticetypes::LatticeElt weight  ) 
 

Definition at line 37 of file bitvector_def.h.

References atlas::bitvector::BitVector< dim >::d_data, atlas::bitvector::BitVector< dim >::d_size, and atlas::bitset::BitSet< n >::set().

template<size_t dim>
atlas::bitvector::BitVector< dim >::~BitVector  )  [inline]
 

Definition at line 180 of file bitvector.h.

template<size_t dim>
atlas::bitvector::BitVector< dim >::BitVector const BitVector< dim > &  v  )  [inline]
 

Definition at line 184 of file bitvector.h.


Member Function Documentation

template<size_t dim>
size_t atlas::bitvector::BitVector< dim >::count  )  [inline]
 

Definition at line 217 of file bitvector.h.

References atlas::bitset::BitSet< n >::count().

Referenced by atlas::bitvector::scalarProduct().

template<size_t dim>
const bitset::BitSet<dim>& atlas::bitvector::BitVector< dim >::data  )  const [inline]
 

Definition at line 221 of file bitvector.h.

Referenced by atlas::bitvector::BitMatrix< constants::RANK_MAX >::addColumn(), atlas::bitvector::BitMatrix< constants::RANK_MAX >::addToColumn(), atlas::bitvector::BitMatrix< dim >::apply(), atlas::subquotient::Subspace< dim >::fromBasis(), atlas::tits::TE_Entry::hashCode(), and atlas::cartanclass::Fiber::toAdjoint().

template<size_t dim>
size_t atlas::bitvector::BitVector< dim >::firstBit  )  const [inline]
 

Definition at line 225 of file bitvector.h.

References atlas::bitset::BitSet< n >::firstBit().

Referenced by atlas::bitvector::firstSolution(), atlas::bitvector::normalSpanAdd(), atlas::bitvector::FirstBit< dim >::operator()(), and atlas::bitvector::spanAdd().

template<size_t dim>
BitVector& atlas::bitvector::BitVector< dim >::flip size_t  i  )  [inline]
 

Definition at line 271 of file bitvector.h.

References atlas::bitset::BitSet< n >::flip().

template<size_t dim>
bool atlas::bitvector::BitVector< dim >::isZero  )  const [inline]
 

Definition at line 229 of file bitvector.h.

References atlas::bitset::BitSet< n >::none().

Referenced by atlas::subquotient::Subspace< dim >::contains(), atlas::bitvector::firstSolution(), atlas::bitvector::normalSpanAdd(), and atlas::bitvector::spanAdd().

template<size_t dim>
bool atlas::bitvector::BitVector< dim >::nonZero  )  const [inline]
 

Definition at line 233 of file bitvector.h.

References atlas::bitset::BitSet< n >::any().

template<size_t dim>
BitVector& atlas::bitvector::BitVector< dim >::operator &= const BitVector< dim > &  v  )  [inline]
 

Definition at line 255 of file bitvector.h.

References atlas::bitvector::BitVector< dim >::d_data, and atlas::bitvector::BitVector< dim >::d_size.

template<size_t dim>
bool atlas::bitvector::BitVector< dim >::operator!= const BitVector< dim > &  v  )  const [inline]
 

Definition at line 207 of file bitvector.h.

References atlas::bitvector::BitVector< dim >::d_data, and atlas::bitvector::BitVector< dim >::d_size.

template<size_t dim>
BitVector& atlas::bitvector::BitVector< dim >::operator+= const BitVector< dim > &  v  )  [inline]
 

Definition at line 243 of file bitvector.h.

References atlas::bitvector::BitVector< dim >::d_data, and atlas::bitvector::BitVector< dim >::d_size.

template<size_t dim>
BitVector& atlas::bitvector::BitVector< dim >::operator-= const BitVector< dim > &  v  )  [inline]
 

Definition at line 249 of file bitvector.h.

References atlas::bitvector::BitVector< dim >::d_data, and atlas::bitvector::BitVector< dim >::d_size.

template<size_t dim>
bool atlas::bitvector::BitVector< dim >::operator< const BitVector< dim > &  v  )  const [inline]
 

Definition at line 197 of file bitvector.h.

References atlas::bitvector::BitVector< dim >::d_data, and atlas::bitvector::BitVector< dim >::d_size.

template<size_t dim>
BitVector& atlas::bitvector::BitVector< dim >::operator<<= size_t  pos  )  [inline]
 

Definition at line 266 of file bitvector.h.

template<size_t dim>
BitVector& atlas::bitvector::BitVector< dim >::operator= const BitVector< dim > &  v  )  [inline]
 

Definition at line 189 of file bitvector.h.

References atlas::bitvector::BitVector< dim >::d_data, and atlas::bitvector::BitVector< dim >::d_size.

template<size_t dim>
bool atlas::bitvector::BitVector< dim >::operator== const BitVector< dim > &  v  )  const [inline]
 

Definition at line 202 of file bitvector.h.

References atlas::bitvector::BitVector< dim >::d_data, and atlas::bitvector::BitVector< dim >::d_size.

template<size_t dim>
BitVector& atlas::bitvector::BitVector< dim >::operator>>= size_t  pos  )  [inline]
 

Definition at line 261 of file bitvector.h.

template<size_t dim>
bool atlas::bitvector::BitVector< dim >::operator[] size_t  i  )  const [inline]
 

Definition at line 212 of file bitvector.h.

template<size_t dim>
BitVector< dim > & atlas::bitvector::BitVector< dim >::pushBack bool  b  ) 
 

Adds b to the bitvector (as the last coordinate), increasing the size by one.

It is the user's responsibility to make sure that the |size| does not exceed |dim|. This is typically applied with |d_size<=RANK_MAX| initially, and |dim>=RANK_MAX+1|.

Definition at line 55 of file bitvector_def.h.

References atlas::bitvector::BitVector< dim >::d_data, atlas::bitvector::BitVector< dim >::d_size, and atlas::bitset::BitSet< n >::set().

Referenced by atlas::compactEquations(), and atlas::kgb::KGBHelp::grading_seed().

template<size_t dim>
BitVector& atlas::bitvector::BitVector< dim >::reset size_t  i  )  [inline]
 

Definition at line 299 of file bitvector.h.

References atlas::bitset::BitSet< n >::reset().

template<size_t dim>
BitVector& atlas::bitvector::BitVector< dim >::reset  )  [inline]
 

Definition at line 294 of file bitvector.h.

References atlas::bitset::BitSet< n >::reset().

Referenced by atlas::bitvector::combination(), atlas::bitvector::firstSolution(), and atlas::bitvector::BitMatrix< dim >::row().

template<size_t dim>
void atlas::bitvector::BitVector< dim >::resize size_t  n  )  [inline]
 

Definition at line 305 of file bitvector.h.

Referenced by atlas::bitvector::firstSolution(), atlas::lattice::mod2(), and atlas::bitvector::BitMatrix< dim >::row().

template<size_t dim>
void atlas::bitvector::BitVector< dim >::set size_t  i,
bool  b
[inline]
 

Definition at line 285 of file bitvector.h.

References atlas::bitset::BitSet< n >::set().

template<size_t dim>
BitVector& atlas::bitvector::BitVector< dim >::set size_t  i  )  [inline]
 

Definition at line 279 of file bitvector.h.

References atlas::bitset::BitSet< n >::set().

Referenced by atlas::bitvector::firstSolution(), atlas::cartanclass::Fiber::gradingGroup(), atlas::bitvector::BitMatrix< dim >::kernel(), atlas::cartanclass::Fiber::makeFiberMap(), atlas::rGenerators(), and atlas::bitvector::BitMatrix< dim >::row().

template<size_t dim>
void atlas::bitvector::BitVector< dim >::set_mod2 size_t  i,
unsigned long  v
[inline]
 

Definition at line 290 of file bitvector.h.

References atlas::bitset::set().

Referenced by atlas::lattice::mod2().

template<size_t dim>
size_t atlas::bitvector::BitVector< dim >::size  )  const [inline]
 

Definition at line 237 of file bitvector.h.

Referenced by atlas::bitvector::BitMatrix< constants::RANK_MAX >::addColumn(), atlas::bitvector::BitMatrix< constants::RANK_MAX >::addToColumn(), atlas::bitvector::firstSolution(), atlas::subquotient::Subquotient< constants::RANK_MAX >::fromBasis(), atlas::subquotient::Subspace< dim >::fromBasis(), atlas::bitvector::normalSpanAdd(), atlas::basic_io::operator<<(), atlas::realweyl::RealWeylGenerators::RealWeylGenerators(), atlas::rGenerators(), atlas::bitvector::BitVector< dim >::slice(), atlas::bitvector::spanAdd(), atlas::subquotient::subquotientMap(), atlas::subquotient::Subquotient< constants::RANK_MAX >::toBasis(), and atlas::subquotient::Subspace< dim >::toBasis().

template<size_t dim>
void atlas::bitvector::BitVector< dim >::slice const bitset::BitSet< dim > &  t  ) 
 

Extracts the bits flagged by |t|, and packs their value into consecutive positions; resets the size to the number of bits so packed.

This is value is useful to transform an element known to lie in a subspace to the canonical basis of the subspace; that notion is so defined as to make this base change just a selection of coordinate values at increasing positions. This is so because the canonical basis $b$ comes with a set of coordinate positions $j$ such that only one $b_i$ has $b_i[j]==1; for a linear combination of basis vectors to be equal to $v$, the coefficient of $b_i$ must then be $v[j]$.

Note that |slice| changes (weakly decreases) the size of its |BitVector|.

Definition at line 80 of file bitvector_def.h.

References atlas::bitvector::BitVector< dim >::d_data, atlas::bitvector::BitVector< dim >::d_size, atlas::bitset::BitSet< n >::set(), and atlas::bitvector::BitVector< dim >::size().

Referenced by atlas::subquotient::Subquotient< constants::RANK_MAX >::toBasis(), and atlas::subquotient::Subspace< dim >::toBasis().

template<size_t dim>
void atlas::bitvector::BitVector< dim >::unslice bitset::BitSet< dim >  t,
size_t  new_size
 

Undoes the effect of |slice|, inserting zero bits where needed.

This cannot be used to undo the use of |slice| to express a vector on a subspace basis (you need to form a linear combination of the basis for that), but when |slice| is used during a projection modulo a subspace (as happens in subquotients), then |unslice| can reconstruct a preimage.

Note that |unslice| changes (weakly increases) the size of its |BitVector|.

Definition at line 108 of file bitvector_def.h.

References atlas::bitset::BitSet< n >::begin(), atlas::bitvector::BitVector< dim >::d_data, atlas::bitvector::BitVector< dim >::d_size, and atlas::bitset::BitSet< n >::set().

Referenced by atlas::subquotient::Subquotient< constants::RANK_MAX >::fromBasis().


Friends And Related Function Documentation

template<size_t dim>
void BitMatrix BitVector< dim > &  ,
const BitVector< dim > & 
const [friend]
 


Member Data Documentation

template<size_t dim>
bitset::BitSet<dim> atlas::bitvector::BitVector< dim >::d_data [private]
 

Definition at line 154 of file bitvector.h.

Referenced by atlas::bitvector::BitVector< dim >::BitVector(), atlas::bitvector::BitVector< dim >::operator &=(), atlas::bitvector::BitVector< dim >::operator!=(), atlas::bitvector::BitVector< dim >::operator+=(), atlas::bitvector::BitVector< dim >::operator-=(), atlas::bitvector::BitVector< dim >::operator<(), atlas::bitvector::BitVector< dim >::operator=(), atlas::bitvector::BitVector< dim >::operator==(), atlas::bitvector::BitVector< dim >::pushBack(), atlas::bitvector::BitVector< dim >::slice(), and atlas::bitvector::BitVector< dim >::unslice().

template<size_t dim>
size_t atlas::bitvector::BitVector< dim >::d_size [private]
 

Definition at line 155 of file bitvector.h.

Referenced by atlas::bitvector::BitVector< dim >::BitVector(), atlas::bitvector::BitVector< dim >::operator &=(), atlas::bitvector::BitVector< dim >::operator!=(), atlas::bitvector::BitVector< dim >::operator+=(), atlas::bitvector::BitVector< dim >::operator-=(), atlas::bitvector::BitVector< dim >::operator<(), atlas::bitvector::BitVector< dim >::operator=(), atlas::bitvector::BitVector< dim >::operator==(), atlas::bitvector::BitVector< dim >::pushBack(), atlas::bitvector::BitVector< dim >::slice(), and atlas::bitvector::BitVector< dim >::unslice().


The documentation for this class was generated from the following files:
Generated on Wed Mar 26 16:52:20 2008 for atlas by  doxygen 1.3.9.1