#include <bitvector.h>
Public Member Functions | |
| BitMatrix () | |
| BitMatrix (size_t n) | |
| BitMatrix (size_t m, size_t n) | |
| BitMatrix (const std::vector< BitVector< dim > > &) | |
| BitMatrix (const latticetypes::LatticeMatrix &m) | |
| ~BitMatrix () | |
| BitMatrix (const BitMatrix &m) | |
| BitMatrix & | operator= (const BitMatrix &m) |
| void | apply (BitVector< dim > &, const BitVector< dim > &) const |
| Applies the |BitMatrix| to |source| and puts the result in |dest|. | |
| template<typename I, typename O> | |
| void | apply (const I &, const I &, O) const |
| A pipe-version of apply. | |
| const BitVector< dim > | column (size_t j) const |
| void | column (BitVector< dim > &, size_t) const |
| Puts in c the j-th column of the matrix. | |
| bool | isEmpty () const |
| BitVectorList< dim > | image () const |
| Puts in |b| a basis of the image of the matrix. | |
| void | kernel (std::vector< BitVector< dim > > &) const |
| Puts in |b| a normal basis for the kernel of the matrix (but not the canonical basis of that subspace; it is normal for the lexicographically {maximal} possible set of bit positions). | |
| size_t | numColumns () const |
| size_t | numRows () const |
| void | row (BitVector< dim > &, size_t) const |
| bool | test (size_t i, size_t j) const |
| BitMatrix & | operator+= (const BitMatrix &) |
| Increment *this by adding m. | |
| BitMatrix & | operator *= (const BitMatrix &) |
| Right multiply our BitMatrix by |m|. | |
| void | addColumn (const bitset::BitSet< dim > &f) |
| void | addColumn (const BitVector< dim > &c) |
| void | addToColumn (size_t j, const BitVector< dim > &v) |
| BitMatrix & | invert () |
| Replaces the current matrix by its inverse. | |
| BitMatrix & | set (size_t i, size_t j) |
| BitMatrix & | reset (size_t i, size_t j) |
| void | set (size_t i, size_t j, bool b) |
| void | set_mod2 (size_t i, size_t j, unsigned long v) |
| void | reset () |
| Resets the matrix to zero. | |
| void | resize (size_t n) |
| void | resize (size_t m, size_t n) |
| Resizes the matrix to |m| rows, |n| columns, leaving data around. | |
| void | setColumn (size_t j, const bitset::BitSet< dim > &data) |
| void | swap (BitMatrix &m) |
| Swaps contents with m. | |
| BitMatrix & | transpose () |
| Transposes the matrix. | |
Private Attributes | |
| std::vector< bitset::BitSet< dim > > | d_data |
| size_t | d_rows |
| size_t | d_columns |
The number of rows d_rows should be less than or equal to dim, which in turn is envisioned to be at most four times the machine word size. The present implementation allows dim at most twice the machine word size, and what is used is dim equal to RANK_MAX (now 16).
At least when d_columns is less than or equal to dim, the matrix can act on the left on a BitVector of size d_columns; in this setting each column of the matrix is the image of one of the standard basis vectors in the domain.
What is stored in d_data, as BitSet's, are the d_column column vectors of the matrix. Construction of a matrix is therefore most efficient when columns are added to it.
Notice that the columns are BitSets and not BitVectors. A BitVector is a larger data structure than a BitSet, including also an integer d_size saying how many of the available bits are significant. In a BitMatrix this integer must be the same for all of the columns, so it is easier and safer to store it once for the whole BitMatrix, and also to modify it just once when the matrix is resized.
Definition at line 378 of file bitvector.h.
|
|||||||||
|
Definition at line 401 of file bitvector.h. |
|
||||||||||
|
Definition at line 405 of file bitvector.h. |
|
||||||||||||||||
|
Definition at line 413 of file bitvector.h. |
|
||||||||||
|
Constructs the matrix whose columns are given by the vectors in |b|. NOTE : it is assumed that all the vectors in |b| have the same size. Definition at line 129 of file bitvector_def.h. References atlas::bitvector::BitMatrix< dim >::d_data, and atlas::bitvector::BitMatrix< dim >::d_rows. |
|
||||||||||
|
Definition at line 423 of file bitvector.h. |
|
|||||||||
|
Definition at line 435 of file bitvector.h. |
|
||||||||||
|
Definition at line 439 of file bitvector.h. |
|
||||||||||
|
Definition at line 521 of file bitvector.h. |
|
||||||||||
|
Adds the BitSet f as a new column at the end to the BitMatrix. Definition at line 516 of file bitvector.h. Referenced by atlas::subquotient::subquotientMap(). |
|
||||||||||||||||
|
Adds the BitVector v to column j of the BitMatrix. Definition at line 529 of file bitvector.h. |
|
||||||||||||||||||||||||
|
A pipe-version of apply. We assume that I is an InputIterator with value-type BitVector<dim>, and O an OutputIterator with the same value-type. Then we apply our matrix to each vector in [first,last[ and output it to out. Definition at line 173 of file bitvector_def.h. |
|
||||||||||||||||
|
Applies the |BitMatrix| to |source| and puts the result in |dest|. It is assumed that |d_columns| is equal to |source.size()|. The result size will be set from |d_rows|. Definition at line 154 of file bitvector_def.h. References atlas::bitvector::combination(), and atlas::bitvector::BitVector< dim >::data(). Referenced by atlas::subquotient::Subspace< dim >::apply(), atlas::subquotient::subquotientMap(), and atlas::cartanclass::Fiber::toAdjoint(). |
|
||||||||||||||||
|
Puts in c the j-th column of the matrix. NOTE: we cannot simply return d_data[j] because that would be a BitSet, not a BitVector! Definition at line 193 of file bitvector_def.h. |
|
||||||||||
|
Returns column $j$ of the BitMatrix, as a BitVector. Definition at line 463 of file bitvector.h. Referenced by atlas::bitvector::BitMatrix< dim >::image(), and atlas::cartanclass::Fiber::makeStrongRepresentatives(). |
|
|||||||||
|
Puts in |b| a basis of the image of the matrix.
Definition at line 229 of file bitvector_def.h. References atlas::bitvector::BitMatrix< dim >::column(), and atlas::bitvector::spanAdd(). Referenced by atlas::cartanclass::Fiber::makeRealFormPartition(). |
|
|||||||||
|
Replaces the current matrix by its inverse. [This code is untested by me, and may be removed if no use is found. MvL] It is the caller's responsibility to make sure that m is in fact invertible (in particular, that it is square). If necessary, this may be done by a call to isInvertible(). For the algorithm, we use the normalSpanAdd function. We start out with a matrix of size (2r,c) (if r,c is the size of our original matrix) containing the identity matrix below the given one. Then we apply normalSpanAdd; at the end, the upper part of our matrix is (some permutattion of) the identity. Setting it right will finish the job. Actually, since this would require working with BitMatrix<2*dim>, and since conversion functions don't seem to be forthcoming, we work with a pair of matrices, and just copy the code from normalSpanAdd. Definition at line 341 of file bitvector_def.h. References atlas::bitvector::BitMatrix< dim >::d_data, atlas::bitvector::BitMatrix< dim >::d_rows, atlas::bits::firstBit(), atlas::bitvector::BitMatrix< dim >::set(), and atlas::bitvector::BitMatrix< dim >::test(). |
|
|||||||||
|
Tests whether the BitMatrix is empty (has zero columns). Definition at line 473 of file bitvector.h. |
|
||||||||||
|
Puts in |b| a normal basis for the kernel of the matrix (but not the canonical basis of that subspace; it is normal for the lexicographically {maximal} possible set of bit positions). This is based on normalizing the transpose matrix, and then solving the resulting trivialised system of equations. Definition at line 241 of file bitvector_def.h. References atlas::bitset::BitSet< n >::begin(), atlas::bitvector::normalize(), and atlas::bitvector::BitVector< dim >::set(). Referenced by atlas::topology::Connectivity::Connectivity(), atlas::tori::dualPi0(), atlas::cartanclass::Fiber::gradingGroup(), and atlas::makeTopology(). |
|
|||||||||
|
Returns the number of columns of the BitMatrix. Definition at line 485 of file bitvector.h. Referenced by atlas::subquotient::Subspace< dim >::apply(), and atlas::subquotient::subquotientMap(). |
|
|||||||||
|
Returns the number of rows of the BitMatrix. Definition at line 492 of file bitvector.h. Referenced by atlas::subquotient::Subspace< dim >::apply(), and atlas::subquotient::subquotientMap(). |
|
||||||||||
|
Right multiply our BitMatrix by |m|. As in apply, this can be done rather efficently by computing a whole column at a time. NOTE : of course |m.d_rows| must be equal to |d_columns|. Definition at line 315 of file bitvector_def.h. References atlas::bitvector::combination(), atlas::bitvector::BitMatrix< dim >::d_columns, atlas::bitvector::BitMatrix< dim >::d_data, atlas::bitvector::BitMatrix< dim >::d_rows, and atlas::bitvector::BitMatrix< dim >::swap(). |
|
||||||||||
|
Increment *this by adding m. Precondition: m has the same size as the current matrix. Definition at line 297 of file bitvector_def.h. References atlas::bitvector::BitMatrix< dim >::d_columns, atlas::bitvector::BitMatrix< dim >::d_data, and atlas::bitvector::BitMatrix< dim >::d_rows. |
|
||||||||||
|
Definition at line 445 of file bitvector.h. |
|
|||||||||
|
Resets the matrix to zero.
Definition at line 400 of file bitvector_def.h. References atlas::bitvector::BitMatrix< dim >::d_data, and atlas::bitvector::BitMatrix< dim >::reset(). |
|
||||||||||||||||
|
Definition at line 546 of file bitvector.h. Referenced by atlas::bitvector::identityMatrix(), and atlas::bitvector::BitMatrix< dim >::reset(). |
|
||||||||||||||||
|
Resizes the matrix to |m| rows, |n| columns, leaving data around.
Definition at line 411 of file bitvector_def.h. References atlas::bitvector::BitMatrix< dim >::d_columns, atlas::bitvector::BitMatrix< dim >::d_data, atlas::bitvector::BitMatrix< dim >::d_rows, and atlas::bitvector::BitMatrix< dim >::resize(). |
|
||||||||||
|
Resizes the BitMatrix to an n by n square. NOTE: it is the caller's responsibility to check that n does not exceed dim. Definition at line 570 of file bitvector.h. Referenced by atlas::bitvector::identityMatrix(), atlas::lattice::mod2(), atlas::bitvector::BitMatrix< dim >::resize(), and atlas::subquotient::subquotientMap(). |
|
||||||||||||||||
|
Puts in r the i-th row of the matrix. Definition at line 208 of file bitvector_def.h. References atlas::bitvector::BitVector< dim >::reset(), atlas::bitvector::BitVector< dim >::resize(), atlas::bitvector::BitVector< dim >::set(), and test(). |
|
||||||||||||||||||||
|
Definition at line 553 of file bitvector.h. |
|
||||||||||||||||
|
Puts a 1 in row i and column j of the BitMatrix. Definition at line 539 of file bitvector.h. Referenced by atlas::bitvector::identityMatrix(), atlas::bitvector::initBasis(), atlas::bitvector::BitMatrix< dim >::invert(), and atlas::bitvector::BitMatrix< dim >::transpose(). |
|
||||||||||||||||||||
|
Definition at line 557 of file bitvector.h. Referenced by atlas::cartanclass::Fiber::makeBaseGrading(), and atlas::lattice::mod2(). |
|
||||||||||||||||
|
Puts the BitSet data in column j of the BitMatrix. Definition at line 579 of file bitvector.h. |
|
||||||||||
|
Swaps contents with m.
Definition at line 425 of file bitvector_def.h. References atlas::bitvector::BitMatrix< dim >::d_columns, atlas::bitvector::BitMatrix< dim >::d_data, and atlas::bitvector::BitMatrix< dim >::d_rows. Referenced by atlas::bitvector::BitMatrix< dim >::operator *=(), atlas::subquotient::Subspace< dim >::swap(), atlas::cartanclass::Fiber::swap(), and atlas::bitvector::BitMatrix< dim >::transpose(). |
|
||||||||||||||||
|
Tests the (i,j) entry of the BitMatrix. Definition at line 501 of file bitvector.h. Referenced by atlas::bitvector::BitMatrix< dim >::invert(), atlas::bitvector::BitMatrix< constants::RANK_MAX >::test(), and atlas::bitvector::BitMatrix< dim >::transpose(). |
|
|||||||||
|
Transposes the matrix. Transposes the BitMatrix NOTE: it is the caller's responsibility to check that d_columns does not exceed dim. Definition at line 436 of file bitvector_def.h. References atlas::bitvector::BitMatrix< dim >::d_columns, atlas::bitvector::BitMatrix< dim >::d_rows, atlas::bitvector::BitMatrix< dim >::set(), atlas::bitvector::BitMatrix< dim >::swap(), and atlas::bitvector::BitMatrix< dim >::test(). |
|
|||||
|
Number of columns of the BitMatrix. This field is redundant, see d_data. Definition at line 396 of file bitvector.h. Referenced by atlas::bitvector::BitMatrix< dim >::operator *=(), atlas::bitvector::BitMatrix< dim >::operator+=(), atlas::bitvector::BitMatrix< constants::RANK_MAX >::operator=(), atlas::bitvector::BitMatrix< dim >::resize(), atlas::bitvector::BitMatrix< dim >::swap(), and atlas::bitvector::BitMatrix< dim >::transpose(). |
|
|||||
|
A vector of d_columns BitSet's (each of size d_rows), the columns of the BitMatrix. Thus d_data.size()==d_columns at all times. Definition at line 386 of file bitvector.h. Referenced by atlas::bitvector::BitMatrix< dim >::BitMatrix(), atlas::bitvector::BitMatrix< dim >::invert(), atlas::bitvector::BitMatrix< dim >::operator *=(), atlas::bitvector::BitMatrix< dim >::operator+=(), atlas::bitvector::BitMatrix< constants::RANK_MAX >::operator=(), atlas::bitvector::BitMatrix< dim >::reset(), atlas::bitvector::BitMatrix< dim >::resize(), and atlas::bitvector::BitMatrix< dim >::swap(). |
|
|||||
|
Number of rows of the BitMatrix. Cannot exceed template argument dim Definition at line 391 of file bitvector.h. Referenced by atlas::bitvector::BitMatrix< dim >::BitMatrix(), atlas::bitvector::BitMatrix< dim >::invert(), atlas::bitvector::BitMatrix< dim >::operator *=(), atlas::bitvector::BitMatrix< dim >::operator+=(), atlas::bitvector::BitMatrix< constants::RANK_MAX >::operator=(), atlas::bitvector::BitMatrix< dim >::resize(), atlas::bitvector::BitMatrix< dim >::swap(), and atlas::bitvector::BitMatrix< dim >::transpose(). |
1.3.9.1