HPCombi
High Performance Combinatorics in C++ using vector instructions v1.0.0
Loading...
Searching...
No Matches
bmat8_impl.hpp
Go to the documentation of this file.
1//****************************************************************************//
2// Copyright (C) 2018-2024 Finn Smith <fls3@st-andrews.ac.uk> //
3// Copyright (C) 2018-2024 James Mitchell <jdm3@st-andrews.ac.uk> //
4// Copyright (C) 2018-2024 Florent Hivert <Florent.Hivert@lisn.fr>, //
5// //
6// This file is part of HP-Combi <https://github.com/libsemigroups/HPCombi> //
7// //
8// HP-Combi is free software: you can redistribute it and/or modify it //
9// under the terms of the GNU General Public License as published by the //
10// Free Software Foundation, either version 3 of the License, or //
11// (at your option) any later version. //
12// //
13// HP-Combi is distributed in the hope that it will be useful, but WITHOUT //
14// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or //
15// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License //
16// for more details. //
17// //
18// You should have received a copy of the GNU General Public License along //
19// with HP-Combi. If not, see <https://www.gnu.org/licenses/>. //
20//****************************************************************************//
21
22// This file contains an implementation of fast boolean matrices up to
23// dimension 8 x 8.
24
25// NOLINT(build/header_guard)
26
27namespace HPCombi {
28static_assert(std::is_trivial<BMat8>(), "BMat8 is not a trivial class!");
29
30static const constexpr std::array<uint64_t, 8> ROW_MASK = {
31 {0xff00000000000000, 0xff000000000000, 0xff0000000000, 0xff00000000,
32 0xff000000, 0xff0000, 0xff00, 0xff}};
33
34static const constexpr std::array<uint64_t, 8> COL_MASK = {
35 0x8080808080808080, 0x4040404040404040, 0x2020202020202020,
36 0x1010101010101010, 0x808080808080808, 0x404040404040404,
37 0x202020202020202, 0x101010101010101};
38
39static const constexpr std::array<uint64_t, 64> BIT_MASK = {{0x8000000000000000,
40 0x4000000000000000,
41 0x2000000000000000,
42 0x1000000000000000,
43 0x800000000000000,
44 0x400000000000000,
45 0x200000000000000,
46 0x100000000000000,
47 0x80000000000000,
48 0x40000000000000,
49 0x20000000000000,
50 0x10000000000000,
51 0x8000000000000,
52 0x4000000000000,
53 0x2000000000000,
54 0x1000000000000,
55 0x800000000000,
56 0x400000000000,
57 0x200000000000,
58 0x100000000000,
59 0x80000000000,
60 0x40000000000,
61 0x20000000000,
62 0x10000000000,
63 0x8000000000,
64 0x4000000000,
65 0x2000000000,
66 0x1000000000,
67 0x800000000,
68 0x400000000,
69 0x200000000,
70 0x100000000,
71 0x80000000,
72 0x40000000,
73 0x20000000,
74 0x10000000,
75 0x8000000,
76 0x4000000,
77 0x2000000,
78 0x1000000,
79 0x800000,
80 0x400000,
81 0x200000,
82 0x100000,
83 0x80000,
84 0x40000,
85 0x20000,
86 0x10000,
87 0x8000,
88 0x4000,
89 0x2000,
90 0x1000,
91 0x800,
92 0x400,
93 0x200,
94 0x100,
95 0x80,
96 0x40,
97 0x20,
98 0x10,
99 0x8,
100 0x4,
101 0x2,
102 0x1}};
103
104inline bool BMat8::operator()(size_t i, size_t j) const noexcept {
105 HPCOMBI_ASSERT(i < 8);
106 HPCOMBI_ASSERT(j < 8);
107 return (_data << (8 * i + j)) >> 63;
108}
109
110inline void BMat8::set(size_t i, size_t j, bool val) noexcept {
111 HPCOMBI_ASSERT(i < 8);
112 HPCOMBI_ASSERT(j < 8);
113 _data ^= (-val ^ _data) & BIT_MASK[8 * i + j];
114}
115
116inline BMat8::BMat8(std::vector<std::vector<bool>> const &mat) {
117 HPCOMBI_ASSERT(mat.size() <= 8);
118 HPCOMBI_ASSERT(0 < mat.size());
119 _data = 0;
120 uint64_t pow = 1;
121 pow = pow << 63;
122 for (auto const &row : mat) {
123 HPCOMBI_ASSERT(row.size() == mat.size());
124 for (auto entry : row) {
125 if (entry) {
126 _data ^= pow;
127 }
128 pow = pow >> 1;
129 }
130 pow = pow >> (8 - mat.size());
131 }
132}
133
135 static std::random_device _rd;
136 static std::mt19937 _gen(_rd());
137 static std::uniform_int_distribution<uint64_t> _dist(0, 0xffffffffffffffff);
138
139 return BMat8(_dist(_gen));
140}
141
142inline BMat8 BMat8::random(size_t const dim) {
143 HPCOMBI_ASSERT(0 < dim && dim <= 8);
144 BMat8 bm = BMat8::random();
145 for (size_t i = dim; i < 8; ++i) {
146 bm._data &= ~ROW_MASK[i];
147 bm._data &= ~COL_MASK[i];
148 }
149 return bm;
150}
151
152inline BMat8 BMat8::transpose() const noexcept {
153 uint64_t x = _data;
154 uint64_t y = (x ^ (x >> 7)) & 0xAA00AA00AA00AA;
155 x = x ^ y ^ (y << 7);
156 y = (x ^ (x >> 14)) & 0xCCCC0000CCCC;
157 x = x ^ y ^ (y << 14);
158 y = (x ^ (x >> 28)) & 0xF0F0F0F0;
159 x = x ^ y ^ (y << 28);
160 return BMat8(x);
161}
162
163inline BMat8 BMat8::transpose_mask() const noexcept {
164 epu8 x = simde_mm_set_epi64x(_data, _data << 1);
165 uint64_t res = simde_mm_movemask_epi8(x);
166 x = x << Epu8(2);
167 res = res << 16 | simde_mm_movemask_epi8(x);
168 x = x << Epu8(2);
169 res = res << 16 | simde_mm_movemask_epi8(x);
170 x = x << Epu8(2);
171 res = res << 16 | simde_mm_movemask_epi8(x);
172 return BMat8(res);
173}
174
175inline BMat8 BMat8::transpose_maskd() const noexcept {
176 uint64_t res =
177 simde_mm_movemask_epi8(simde_mm_set_epi64x(_data, _data << 1));
178 res = res << 16 |
179 simde_mm_movemask_epi8(simde_mm_set_epi64x(_data << 2, _data << 3));
180 res = res << 16 |
181 simde_mm_movemask_epi8(simde_mm_set_epi64x(_data << 4, _data << 5));
182 res = res << 16 |
183 simde_mm_movemask_epi8(simde_mm_set_epi64x(_data << 6, _data << 7));
184 return BMat8(res);
185}
186
187using epu64 = uint64_t __attribute__((__vector_size__(16), __may_alias__));
188
189inline void BMat8::transpose2(BMat8 &a, BMat8 &b) noexcept {
190 epu64 x = simde_mm_set_epi64x(a._data, b._data);
191 epu64 y = (x ^ (x >> 7)) & (epu64{0xAA00AA00AA00AA, 0xAA00AA00AA00AA});
192 x = x ^ y ^ (y << 7);
193 y = (x ^ (x >> 14)) & (epu64{0xCCCC0000CCCC, 0xCCCC0000CCCC});
194 x = x ^ y ^ (y << 14);
195 y = (x ^ (x >> 28)) & (epu64{0xF0F0F0F0, 0xF0F0F0F0});
196 x = x ^ y ^ (y << 28);
197 a._data = simde_mm_extract_epi64(x, 1);
198 b._data = simde_mm_extract_epi64(x, 0);
199}
200
201static constexpr epu8 rotlow{7, 0, 1, 2, 3, 4, 5, 6};
202static constexpr epu8 rothigh{0, 1, 2, 3, 4, 5, 6, 7,
203 15, 8, 9, 10, 11, 12, 13, 14};
204static constexpr epu8 rotboth{7, 0, 1, 2, 3, 4, 5, 6,
205 15, 8, 9, 10, 11, 12, 13, 14};
206static constexpr epu8 rot2{6, 7, 0, 1, 2, 3, 4, 5,
207 14, 15, 8, 9, 10, 11, 12, 13};
208
209inline BMat8 BMat8::mult_transpose(BMat8 const &that) const noexcept {
210 epu8 x = simde_mm_set_epi64x(_data, _data);
211 epu8 y = simde_mm_shuffle_epi8(simde_mm_set_epi64x(that._data, that._data),
212 rothigh);
213 epu8 data{};
214 epu8 diag{0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80,
215 0x80, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40};
216 for (int i = 0; i < 4; ++i) {
217 data |= ((x & y) != epu8{}) & diag;
218 y = simde_mm_shuffle_epi8(y, rot2);
219 diag = simde_mm_shuffle_epi8(diag, rot2);
220 }
221 return BMat8(simde_mm_extract_epi64(data, 0) |
222 simde_mm_extract_epi64(data, 1));
223}
224
225inline epu8 BMat8::row_space_basis_internal() const noexcept {
226 epu8 res = remove_dups(revsorted8(simde_mm_set_epi64x(0, _data)));
227 epu8 rescy = res;
228 // We now compute the union of all the included different rows
229 epu8 orincl{};
230 for (int i = 0; i < 7; i++) {
231 rescy = permuted(rescy, rotlow);
232 orincl |= ((rescy | res) == res) & rescy;
233 }
234 res = (res != orincl) & res;
235 return res;
236}
237
238inline BMat8 BMat8::row_space_basis() const noexcept {
239 return BMat8(
240 simde_mm_extract_epi64(sorted8(row_space_basis_internal()), 0));
241}
242
243#if defined(FF)
244#error FF is defined !
245#endif // FF
246#define FF 0xff
247
248constexpr std::array<epu8, 4> masks{{
249 // clang-format off
250 {FF, 0,FF, 0,FF, 0,FF, 0,FF, 0,FF, 0,FF, 0,FF, 0}, // NOLINT()
251 {FF,FF, 1, 1,FF,FF, 1, 1,FF,FF, 1, 1,FF,FF, 1, 1}, // NOLINT()
252 {FF,FF,FF,FF, 2, 2, 2, 2,FF,FF,FF,FF, 2, 2, 2, 2}, // NOLINT()
253 {FF,FF,FF,FF,FF,FF,FF,FF, 3, 3, 3, 3, 3, 3, 3, 3} // NOLINT()
254 }};
255#undef FF
256
257static const epu8 shiftres{1, 2, 4, 8, 0x10, 0x20, 0x40, 0x80};
258
259namespace detail {
260
261inline void row_space_update_bitset(epu8 block, epu8 &set0, epu8 &set1)
262noexcept {
263 static const epu8 bound08 = simde_mm_slli_epi32(
264 static_cast<simde__m128i>(Epu8.id()), 3); // shift for *8
265 static const epu8 bound18 = bound08 + Epu8(0x80);
266 for (size_t slice8 = 0; slice8 < 16; slice8++) {
267 epu8 bm5 = Epu8(0xf8) & block; /* 11111000 */
268 epu8 shft = simde_mm_shuffle_epi8(shiftres, block - bm5);
269 set0 |= (bm5 == bound08) & shft;
270 set1 |= (bm5 == bound18) & shft;
271 block = simde_mm_shuffle_epi8(block, Epu8.right_cycle());
272 }
273}
274} // namespace detail
275
276inline void BMat8::row_space_bitset(epu8 &res0, epu8 &res1) const noexcept {
277 epu8 in = simde_mm_set_epi64x(0, _data);
278 epu8 block0{}, block1{};
279 for (epu8 m : masks) {
280 block0 |= static_cast<epu8>(simde_mm_shuffle_epi8(in, m));
281 block1 |= static_cast<epu8>(simde_mm_shuffle_epi8(in, m | Epu8(4)));
282 }
283 res0 = epu8{};
284 res1 = epu8{};
285 for (size_t r = 0; r < 16; r++) {
286 detail::row_space_update_bitset(block0 | block1, res0, res1);
287 block1 = simde_mm_shuffle_epi8(block1, Epu8.right_cycle());
288 }
289}
290
291inline uint64_t BMat8::row_space_size_bitset() const noexcept {
292 epu8 res0{}, res1{};
293 row_space_bitset(res0, res1);
294 return (__builtin_popcountll(simde_mm_extract_epi64(res0, 0)) +
295 __builtin_popcountll(simde_mm_extract_epi64(res1, 0)) +
296 __builtin_popcountll(simde_mm_extract_epi64(res0, 1)) +
297 __builtin_popcountll(simde_mm_extract_epi64(res1, 1)));
298}
299
300inline uint64_t BMat8::row_space_size_incl1() const noexcept {
301 epu8 in = simde_mm_set_epi64x(_data, _data);
302 epu8 block = Epu8.id();
303 uint64_t res = 0;
304 for (size_t r = 0; r < 16; r++) {
305 epu8 orincl{};
306 for (int i = 0; i < 8; i++) {
307 orincl |= ((in | block) == block) & in;
308 in = permuted(in, rotboth);
309 }
310 res += __builtin_popcountll(simde_mm_movemask_epi8(block == orincl));
311 block += Epu8(16);
312 }
313 return res;
314}
315
316inline uint64_t BMat8::row_space_size_incl() const noexcept {
317 epu8 in = simde_mm_set_epi64x(_data, _data);
318 epu8 block = Epu8.id();
319 uint64_t res = 0;
320 for (size_t r = 0; r < 16; r++) {
321 epu8 orincl = ((in | block) == block) & in;
322 for (int i = 0; i < 7; i++) { // Only rotating
323 in = permuted(in, rotboth);
324 orincl |= ((in | block) == block) & in;
325 }
326 res += __builtin_popcountll(simde_mm_movemask_epi8(block == orincl));
327 block += Epu8(16);
328 }
329 return res;
330}
331
332inline bool BMat8::row_space_included_bitset(BMat8 other) const noexcept {
333 epu8 this0, this1, other0, other1;
334 this->row_space_bitset(this0, this1);
335 other.row_space_bitset(other0, other1);
336 // Double inclusion of bitsets
337 return equal(this0 | other0, other0) && equal(this1 | other1, other1);
338}
339
340inline bool BMat8::row_space_included(BMat8 other) const noexcept {
341 epu8 in = simde_mm_set_epi64x(0, other._data);
342 epu8 block = simde_mm_set_epi64x(0, _data);
343 epu8 orincl = ((in | block) == block) & in;
344 for (int i = 0; i < 7; i++) { // Only rotating
345 in = permuted(in, rotlow);
346 orincl |= ((in | block) == block) & in;
347 }
348 return equal(block, orincl);
349}
350
351inline epu8 BMat8::row_space_mask(epu8 block) const noexcept {
352 epu8 in = simde_mm_set_epi64x(_data, _data);
353 epu8 orincl = ((in | block) == block) & in;
354 for (int i = 0; i < 7; i++) { // Only rotating
355 in = permuted(in, rotboth);
356 orincl |= ((in | block) == block) & in;
357 }
358 return block == orincl;
359}
360
361inline std::pair<bool, bool> BMat8::row_space_included2(BMat8 a0, BMat8 b0,
362 BMat8 a1, BMat8 b1) {
363 epu8 in = simde_mm_set_epi64x(b1._data, b0._data);
364 epu8 block = simde_mm_set_epi64x(a1._data, a0._data);
365 epu8 orincl = ((in | block) == block) & in;
366 for (int i = 0; i < 7; i++) { // Only rotating
367 in = permuted(in, rotboth);
368 orincl |= ((in | block) == block) & in;
369 }
370 epu8 res = (block == orincl);
371 return std::make_pair(simde_mm_extract_epi64(res, 0) == -1,
372 simde_mm_extract_epi64(res, 1) == -1);
373}
374
375inline std::bitset<256> BMat8::row_space_bitset_ref() const {
376 std::bitset<256> lookup;
377 std::vector<uint8_t> row_vec = row_space_basis().rows();
378 auto last = std::remove(row_vec.begin(), row_vec.end(), 0);
379 row_vec.erase(last, row_vec.end());
380 for (uint8_t x : row_vec) {
381 lookup.set(x);
382 }
383 lookup.set(0);
384 std::vector<uint8_t> row_space(row_vec.begin(), row_vec.end());
385 for (size_t i = 0; i < row_space.size(); ++i) {
386 for (uint8_t row : row_vec) {
387 uint8_t x = row_space[i] | row;
388 if (!lookup[x]) {
389 row_space.push_back(x);
390 lookup.set(x);
391 }
392 }
393 }
394 return lookup;
395}
396
397inline bool BMat8::row_space_included_ref(BMat8 other) const noexcept {
398 std::bitset<256> thisspace = row_space_bitset_ref();
399 std::bitset<256> otherspace = other.row_space_bitset_ref();
400 return (thisspace | otherspace) == otherspace;
401}
402
403inline uint64_t BMat8::row_space_size_ref() const {
404 return row_space_bitset_ref().count();
405}
406
407inline std::vector<uint8_t> BMat8::rows() const {
408 std::vector<uint8_t> rows;
409 for (size_t i = 0; i < 8; ++i) {
410 uint8_t row = static_cast<uint8_t>(_data << (8 * i) >> 56);
411 rows.push_back(row);
412 }
413 return rows;
414}
415
416inline size_t BMat8::nr_rows() const noexcept {
417 epu8 x = simde_mm_set_epi64x(_data, 0);
418 return __builtin_popcountll(simde_mm_movemask_epi8(x != epu8{}));
419}
420
421static constexpr epu8 rev8{7, 6, 5, 4, 3, 2, 1, 0,
422 8, 9, 10, 11, 12, 13, 14, 15};
423
424inline BMat8 BMat8::row_permuted(Perm16 p) const noexcept {
425 epu8 x = simde_mm_set_epi64x(0, _data);
426 x = permuted(x, rev8);
427 x = permuted(x, p);
428 x = permuted(x, rev8);
429 return BMat8(simde_mm_extract_epi64(x, 0));
430}
431
432inline BMat8 BMat8::col_permuted(Perm16 p) const noexcept {
433 return transpose().row_permuted(p).transpose();
434}
435
437 return one().row_permuted(p);
438}
439
441 return one().row_permuted(p).transpose();
442}
443
446 std::vector<uint8_t> rows = this->rows();
447 BMat8 product = *this * bm;
448 std::vector<uint8_t> prod_rows = product.rows();
449
450 HPCOMBI_ASSERT(product.row_space_basis() == bm);
451
452 std::vector<uint8_t> perm(8);
453 for (size_t i = 0; i < nr_rows(); ++i) {
454 uint8_t row = rows[i];
455 perm[i] =
456 std::distance(prod_rows.begin(),
457 std::find(prod_rows.begin(), prod_rows.end(), row));
458 }
459
460#ifndef __clang__
461#pragma GCC diagnostic push
462#pragma GCC diagnostic ignored "-Wstringop-overflow"
463#endif
464 std::iota(perm.begin() + nr_rows(), perm.end(), nr_rows());
465#ifndef __clang__
466#pragma GCC diagnostic pop
467#endif
468
470 for (size_t i = 0; i < 8; i++)
471 res[i] = perm[i];
472 return res;
473}
474
475inline Perm16 BMat8::right_perm_action_on_basis(BMat8 other) const noexcept {
476 epu8 x = permuted(simde_mm_set_epi64x(_data, 0), Epu8.rev());
477 epu8 y = permuted(simde_mm_set_epi64x((*this * other)._data, 0),
478 Epu8.rev());
479 // Vector ternary operator is not supported by clang.
480 // return (x != (epu8 {})) ? permutation_of(y, x) : Epu8.id();
481 return simde_mm_blendv_epi8(Epu8.id(), permutation_of(y, x), x != epu8{});
482}
483
484// Not noexcept because std::ostream::operator<< isn't
485inline std::ostream &BMat8::write(std::ostream &os) const {
486 uint64_t x = _data;
487 uint64_t pow = 1;
488 pow = pow << 63;
489 for (size_t i = 0; i < 8; ++i) {
490 for (size_t j = 0; j < 8; ++j) {
491 if (pow & x) {
492 os << "1";
493 } else {
494 os << "0";
495 }
496 x = x << 1;
497 }
498 os << "\n";
499 }
500 return os;
501}
502
503} // namespace HPCombi
504
505namespace std {
506
507// Not noexcept because BMat8::write isn't
508inline std::ostream &operator<<(std::ostream &os, HPCombi::BMat8 const &bm) {
509 return bm.write(os);
510}
511
512} // namespace std
#define FF
Definition bmat8_impl.hpp:246
Class for fast boolean matrices of dimension up to 8 x 8.
Definition bmat8.hpp:52
uint64_t row_space_size_incl() const noexcept
Returns the cardinality of the row space of this.
Definition bmat8_impl.hpp:316
BMat8 row_space_basis() const noexcept
Returns a canonical basis of the row space of this.
Definition bmat8_impl.hpp:238
static std::pair< bool, bool > row_space_included2(BMat8 a1, BMat8 b1, BMat8 a2, BMat8 b2)
Returns inclusion of row spaces.
Definition bmat8_impl.hpp:361
static void transpose2(BMat8 &, BMat8 &) noexcept
Transpose two matrices at once.
Definition bmat8_impl.hpp:189
uint64_t row_space_size_bitset() const noexcept
Returns the cardinality of the row space of this.
Definition bmat8_impl.hpp:291
static BMat8 row_permutation_matrix(Perm16 p) noexcept
Returns the matrix associated to the permutation p by rows.
Definition bmat8_impl.hpp:436
BMat8 mult_transpose(BMat8 const &that) const noexcept
Returns the matrix product of this and the transpose of that.
Definition bmat8_impl.hpp:209
BMat8 transpose_maskd() const noexcept
Returns the transpose of this.
Definition bmat8_impl.hpp:175
bool row_space_included_bitset(BMat8 other) const noexcept
Returns whether the row space of this is included in other's.
Definition bmat8_impl.hpp:332
BMat8 transpose() const noexcept
Returns the transpose of this.
Definition bmat8_impl.hpp:152
static BMat8 col_permutation_matrix(Perm16 p) noexcept
Returns the matrix associated to the permutation p by columns.
Definition bmat8_impl.hpp:440
epu8 row_space_mask(epu8 vects) const noexcept
Returns a mask for which vectors of a 16 rows epu8 are in the row space of this.
Definition bmat8_impl.hpp:351
BMat8 row_permuted(Perm16 p) const noexcept
Returns the matrix whose rows have been permuted according to p.
Definition bmat8_impl.hpp:424
BMat8() noexcept=default
A default constructor.
bool row_space_included(BMat8 other) const noexcept
Returns whether the row space of this is included in other's.
Definition bmat8_impl.hpp:340
std::ostream & write(std::ostream &os) const
Write this on os.
Definition bmat8_impl.hpp:485
void row_space_bitset(epu8 &res1, epu8 &res2) const noexcept
Returns the the row space of this as 256 bits.
Definition bmat8_impl.hpp:276
Perm16 right_perm_action_on_basis(BMat8) const noexcept
Give the permutation whose right multiplication change *this to other.
Definition bmat8_impl.hpp:475
std::bitset< 256 > row_space_bitset_ref() const
Returns the the row space of this.
Definition bmat8_impl.hpp:375
BMat8 col_permuted(Perm16 p) const noexcept
Returns the matrix whose columns have been permuted according to p.
Definition bmat8_impl.hpp:432
uint64_t row_space_size_ref() const
Returns the cardinality of the row space of this.
Definition bmat8_impl.hpp:403
BMat8 transpose_mask() const noexcept
Returns the transpose of this.
Definition bmat8_impl.hpp:163
std::vector< uint8_t > rows() const
Returns a std::vector for rows of this.
Definition bmat8_impl.hpp:407
size_t nr_rows() const noexcept
Returns the number of non-zero rows of this.
Definition bmat8_impl.hpp:416
void set(size_t i, size_t j, bool val) noexcept
Sets the (i, j)th position to val.
Definition bmat8_impl.hpp:110
static BMat8 random()
Returns a random BMat8.
Definition bmat8_impl.hpp:134
bool operator()(size_t i, size_t j) const noexcept
Returns the entry in the (i, j)th position.
Definition bmat8_impl.hpp:104
uint64_t row_space_size_incl1() const noexcept
Returns the cardinality of the row space of this.
Definition bmat8_impl.hpp:300
bool row_space_included_ref(BMat8 other) const noexcept
Returns whether the row space of this is included in other's.
Definition bmat8_impl.hpp:397
Perm16 right_perm_action_on_basis_ref(BMat8) const
Give the permutation whose right multiplication change *this to other.
Definition bmat8_impl.hpp:444
#define HPCOMBI_ASSERT(x)
Definition debug.hpp:28
const Transf16 a1
Definition image.cpp:52
std::array< std::tuple< uint16_t, uint16_t, std::array< uint16_t, gens.size()> >, 65536 > res
Definition image.cpp:66
void row_space_update_bitset(epu8 block, epu8 &set0, epu8 &set1) noexcept
Definition bmat8_impl.hpp:261
Definition bmat8.hpp:41
epu8 permuted(epu8 a, epu8 b) noexcept
Permuting a HPCombi::epu8.
Definition epu8.hpp:72
epu8 remove_dups(epu8 a, uint8_t repl=0) noexcept
Remove duplicates in a sorted HPCombi::epu8.
Definition epu8_impl.hpp:260
epu8 revsorted8(epu8 a) noexcept
Return a HPCombi::epu8 with the two half reverse sorted.
Definition epu8_impl.hpp:212
epu8 permutation_of(epu8 a, epu8 b) noexcept
Find if a vector is a permutation of one other.
Definition epu8_impl.hpp:303
bool equal(epu8 a, epu8 b) noexcept
Equality of HPCombi::epu8.
Definition epu8.hpp:63
epu8 sorted8(epu8 a) noexcept
Return a HPCombi::epu8 with the two half sorted.
Definition epu8_impl.hpp:206
uint64_t __attribute__((__vector_size__(16), __may_alias__)) epu64
Definition bmat8_impl.hpp:187
constexpr TPUBuild< epu8 > Epu8
Factory object acting as a class constructor for type HPCombi::epu8.
Definition epu8.hpp:53
uint8_t __attribute__((vector_size(16))) epu8
SIMD vector of 16 unsigned bytes.
Definition epu8.hpp:45
constexpr std::array< epu8, 4 > masks
Definition bmat8_impl.hpp:248
const T pow(const T x)
A generic compile time exponentiation function.
Definition power.hpp:83
Definition bmat8.hpp:364
std::ostream & operator<<(std::ostream &os, HPCombi::BMat8 const &bm)
Definition bmat8_impl.hpp:508
Permutations of .
Definition perm16.hpp:208
static constexpr Perm16 one()
The identity partial permutation.
Definition perm16.hpp:223