5 #include "permutations.hpp"
43 _length = other._length;
44 _dimension = other._dimension;
46 _vectors.reserve(other.
vectors());
47 std::copy(other._vectors.begin(), other._vectors.end(), std::back_inserter(_vectors));
58 return _vectors[index];
76 return _vectors.size();
98 assert (vector.size() ==
length());
116 assert (vector.size() ==
length());
118 size_t begin = 1 << _dimension;
120 size_t end = 1 << _dimension;
121 _vectors.resize(end, vector);
122 for (
size_t current = begin + 1; current < end; current++)
123 vector_sum(vector, _vectors[current - begin], _vectors[current]);
135 assert (vector.size() ==
length());
137 for (
size_t j = 0; j < _vectors.size(); ++j)
141 for (
size_t i = 0; i < _length; ++i)
143 if (current_vector[i] ? !vector[i] : vector[i])
164 assert (vector.size() ==
length());
166 return find(vector) >= 0;
182 assert (first.size() == second.size());
183 assert (first.size() == result.size());
185 for (
size_t i = 0; i < first.size(); ++i)
187 result[i] = first[i] ? !second[i] : second[i];
194 std::vector <vector_type> _vectors;
207 for (
size_t i = 0; i < space.
vectors(); ++i)
209 for (
size_t j = 0; j < space.
length(); ++j)
211 stream <<
' ' << (space[i][j] ?
'1' :
'0');
Definition: binary_linear_space.hpp:16
const vector_type & operator[](size_t index) const
Definition: binary_linear_space.hpp:56
std::vector< bool > vector_type
Definition: binary_linear_space.hpp:19
size_t length() const
Definition: binary_linear_space.hpp:65
size_t vectors() const
Definition: binary_linear_space.hpp:74
static void vector_sum(const vector_type &first, const vector_type &second, vector_type &result)
Definition: binary_linear_space.hpp:180
bool insert_checked(const vector_type &vector)
Definition: binary_linear_space.hpp:96
void insert(const vector_type &vector)
Definition: binary_linear_space.hpp:114
binary_linear_space(size_t length)
Definition: binary_linear_space.hpp:28
int find(const vector_type &vector) const
Definition: binary_linear_space.hpp:133
bool is_spanned(const vector_type &vector) const
Definition: binary_linear_space.hpp:162
size_t dimension() const
Definition: binary_linear_space.hpp:83
binary_linear_space(const binary_linear_space &other)
Definition: binary_linear_space.hpp:41
Definition: algorithm.hpp:14
std::ostream & operator<<(std::ostream &stream, const binary_linear_space &space)
Definition: binary_linear_space.hpp:205