32 (
const std::vector<BitVector<dim> >& b,
34 const BitSet<dim>&
e);
38 BitSet<dim>
combination(
const std::vector<BitSet<dim> >&,
48 const BitVector<dim>& rhs,
62 template<
size_t dimsol,
size_t dimeq>
63 bool solvable(
const std::vector<BitVector<dimeq> >& eqns,
64 BitVector<dimsol>& sol);
68 template<
size_t dim>
void initBasis(std::vector<BitVector<dim> >&,
size_t);
71 void Gauss_Jordan(BitSet<dim>&, std::vector<BitVector<dim> >&);
74 void normalSpanAdd(std::vector<BitVector<dim> >&, std::vector<size_t>&,
75 const BitVector<dim>&);
97 void spanAdd(std::vector<BitVector<dim> >&, std::vector<size_t>&,
98 const BitVector<dim>&);
134 template<
size_t dim>
class BitVector
146 : d_data(), d_size(n)
150 : d_data(), d_size(n)
156 : d_data(data), d_size(n)
178 assert(d_size==v.d_size);
179 return d_data<v.d_data;
184 assert(d_size==v.d_size);
185 return d_data == v.d_data;
190 assert(d_size==v.d_size);
191 return d_data != v.d_data;
204 size_t firstBit()
const {
return d_data.firstBit(); }
206 size_t count() {
return d_data.count(); }
208 bool isZero()
const {
return d_data.none(); }
214 {
return ((d_data & v.d_data).count()&1u)!=0; }
225 #ifdef incompletecpp11 231 for (
unsigned int i=
size(); i-->0;)
240 assert(d_size==v.d_size);
247 assert(d_size==v.d_size);
254 assert(d_size==v.d_size);
278 void set(
size_t i,
bool b) { assert(i<d_size); d_data.set(i,b); }
280 void set_mod2(
size_t i,
unsigned long v) {
set(i,(v&1)!=0); }
291 void resize(
size_t n) { assert(n<=dim); d_size =
n; }
293 void slice(
const BitSet<dim>& mask);
294 void unslice(BitSet<dim> mask,
size_t new_size);
302 :
public std::vector<BitVector<dim> >
329 : std::vector<
BitVector<dim> >(begin,end)
393 unsigned short int num_rows);
398 for (
size_t i=0; i<
n; ++i)
408 bool test(
size_t i,
size_t j)
const 412 return d_data[j].test(i);
418 template<
typename I,
typename O>
void apply(
const I&,
const I&, O)
const;
450 assert(c.size()==d_rows);
456 assert(v.size()==d_rows);
457 d_data[j] ^= v.data();
478 void set(
size_t i,
size_t j,
bool b) {
479 if (b)
set(i,j);
else reset(i,j);
495 void resize(
size_t m,
size_t n);
void unslice(BitSet< dim > mask, size_t new_size)
Definition: bitvector.cpp:112
void addToColumn(size_t j, const BitVector< dim > &v)
Definition: bitvector.h:455
BitVector< dim > combination(const std::vector< BitVector< dim > > &b, size_t n, const BitSet< dim > &e)
Puts in |v| the linear combination of the elements of |b| given by |e|.
Definition: bitvector.cpp:470
matrix::Vector< int > int_Vector
Definition: Atlas.h:149
BitVector operator-(const BitVector &v) const
Definition: bitvector.h:221
BitVector< constants::RANK_MAX > SmallBitVector
Definition: Atlas.h:181
BitMatrix & reset(size_t i, size_t j)
Definition: bitvector.h:471
void addColumn(const BitVector< dim > &c)
Definition: bitvector.h:449
BitMatrix(size_t m, size_t n)
Definition: bitvector.h:384
bool operator[](size_t i) const
Definition: bitvector.h:194
BitVector & reset(size_t i)
Definition: bitvector.h:284
void initBasis(std::vector< BitVector< dim > > &b, size_t n)
Initializes b to the canonical basis in dimension n.
Definition: bitvector.cpp:642
unsigned short int d_size
Definition: bitvector.h:140
BitVectorList(const std::vector< matrix::Vector< int > > &l)
Definition: bitvector.h:323
void identityMatrix(BitMatrix< dim > &m, size_t n)
Puts in m the identity matrix in rank n.
Definition: bitvector.cpp:629
bool test(size_t i, size_t j) const
The (i,j) entry of the BitMatrix.
Definition: bitvector.h:408
BitVectorList()
Definition: bitvector.h:306
bool nonZero() const
Definition: bitvector.h:210
void swap(simple_list< T, Alloc > &x, simple_list< T, Alloc > &y)
Definition: sl_list.h:674
void resize(size_t n)
Definition: bitvector.h:291
bool isZero() const
Definition: bitvector.h:208
BitVectorList(size_t n)
Definition: bitvector.h:309
size_t numColumns() const
Definition: bitvector.h:423
void resize(size_t n)
Definition: bitvector.h:493
BitMatrix & set(size_t i, size_t j)
Definition: bitvector.h:464
BitVector< dim > column(size_t j) const
Column $j$ of the BitMatrix, as a BitVector.
Definition: bitvector.h:429
void normalSpanAdd(std::vector< BitVector< dim > > &a, std::vector< size_t > &f, const BitVector< dim > &v)
Definition: bitvector.cpp:740
BitVectorList(size_t n, BitVector< dim > model)
Definition: bitvector.h:312
LatticeMatrix kernel(const LatticeMatrix &M)
Definition: lattice.cpp:130
BitVector & reset()
Definition: bitvector.h:282
BitMatrix(size_t n)
Definition: bitvector.h:376
static BitMatrix identity(unsigned int n)
Definition: bitvector.h:396
BitVector< constants::RANK_MAX+1 > BinaryEquation
Definition: Atlas.h:183
BitVector(size_t n)
Definition: bitvector.h:145
size_t firstBit() const
Definition: bitvector.h:204
void slice(const BitSet< dim > &mask)
Definition: bitvector.cpp:83
RationalVector< C2 > operator*(const matrix::Matrix< C1 > &M, const RationalVector< C2 > &v)
Definition: ratvec.cpp:158
unsigned short int d_columns
Definition: bitvector.h:371
void addColumn(const BitSet< dim > &f)
Definition: bitvector.h:444
base_set d_data
Definition: bitvector.h:139
size_t size() const
Definition: bitvector.h:200
void set_mod2(size_t i, unsigned long v)
Definition: bitvector.h:280
size_t numRows() const
Definition: bitvector.h:424
int_Vector lift(const BitVector< dim > &v)
Definition: bitvector.cpp:819
BitVector & pushBack(bool)
Definition: bitvector.cpp:58
std::vector< BitSet< dim > > d_data
Definition: bitvector.h:365
BitVector & operator>>=(size_t pos)
Definition: bitvector.h:259
bool operator<(const BitVector &v) const
Definition: bitvector.h:176
BitVector & flip(size_t i)
Definition: bitvector.h:262
bool operator==(const BitVector &v) const
Definition: bitvector.h:182
BitVector & operator+=(const BitVector &v)
Definition: bitvector.h:238
bool dot(const BitVector &v) const
Definition: bitvector.h:213
BinaryEquation make_equation(const SmallBitVector &lhs, bool rhs)
Definition: bitvector.h:517
unsigned short int d_rows
Definition: bitvector.h:368
void setColumn(size_t j, const BitSet< dim > &data)
Definition: bitvector.h:498
bool combination_exists(const std::vector< BitVector< dim > > &b, const BitVector< dim > &rhs, BitSet< dim > &c)
Definition: bitvector.cpp:505
BitVector(const BitVector &v)
Definition: bitvector.h:163
BitVector(BitSet< dim > data, size_t n)
Definition: bitvector.h:155
bool solvable(const std::vector< BitVector< dimeq > > &eqns, BitVector< dimsol > &sol)
Either find a solution of the system of equations |eqn|, putting it into |sol| and returning |true|...
Definition: bitvector.cpp:586
BitVector & operator-=(const BitVector &v)
Definition: bitvector.h:245
unsigned long n
Definition: axis.cpp:77
const BitSet< dim > & data() const
Definition: bitvector.h:202
BitVector & operator<<=(size_t pos)
Definition: bitvector.h:260
simple_list< T, Alloc >::const_iterator end(const simple_list< T, Alloc > &l)
Definition: sl_list.h:650
size_t count()
Definition: bitvector.h:206
BitSet< dim > base_set
Definition: bitvector.h:137
BitVector(size_t n, size_t j)
Definition: bitvector.h:149
bool operator!=(const BitVector &v) const
Definition: bitvector.h:188
void spanAdd(std::vector< BitVector< dim > > &a, std::vector< size_t > &f, const BitVector< dim > &v)
Enlarges the basis |a| so as to span |v|.
Definition: bitvector.cpp:795
void set_mod2(size_t i, size_t j, unsigned long v)
Definition: bitvector.h:482
Class definitions and function declarations for the BitSet class.
void Gauss_Jordan(BitSet< dim > &t, std::vector< BitVector< dim > > &b)
Replaces |b| by the ordered canonical basis of the vector space $V$ it spans. Flags in |t| the set of...
Definition: bitvector.cpp:681
const expr & e
Definition: axis.cpp:95
BitVector & operator&=(const BitVector &v)
Definition: bitvector.h:252
BitVector operator+(const BitVector &v) const
Definition: bitvector.h:216
void get_column(BitVector< dim > &c, size_t j) const
Definition: bitvector.h:434
BitVector & operator=(const BitVector &v)
Definition: bitvector.h:168
BitVectorList(const std::vector< BitVector< dim > > &v)
Definition: bitvector.h:317
void transpose(Endomorphism &e, const FiniteAbelianGroup &A)
Definition: abelian.cpp:675
Vertex v
Definition: graph.cpp:116
BitVectorList(I begin, I end)
Definition: bitvector.h:328