25#ifndef HPCOMBI_BMAT8_HPP_
26#define HPCOMBI_BMAT8_HPP_
66 explicit
BMat8(uint64_t mat) noexcept : _data(mat) {}
73 explicit BMat8(std::vector<std::vector<bool>>
const &mat);
101 bool operator==(
BMat8 const &that) const noexcept {
102 return _data == that._data;
109 return _data != that._data;
117 return _data < that._data;
125 return _data > that._data;
133 bool operator()(
size_t i,
size_t j)
const noexcept;
140 void set(
size_t i,
size_t j,
bool val)
noexcept;
147 uint64_t
to_int() const noexcept {
return _data; }
207 size_t nr_rows() const noexcept;
211 std::vector<uint8_t>
rows() const;
326 static std::array<uint64_t, 9>
const ones = {
327 0x0000000000000000, 0x8000000000000000, 0x8040000000000000,
328 0x8040200000000000, 0x8040201000000000, 0x8040201008000000,
329 0x8040201008040000, 0x8040201008040200, 0x8040201008040201};
330 return BMat8(ones[dim]);
346 void swap(
BMat8 &that)
noexcept { std::swap(this->_data, that._data); }
350 std::ostream &
write(std::ostream &os)
const;
352#ifdef HPCOMBI_HAVE_DENSEHASHMAP
354 BMat8 empty_key() const noexcept {
return BMat8(0xFF7FBFDFEFF7FBFE); }
360 epu8 row_space_basis_internal() const noexcept;
365#include "bmat8_impl.hpp"
370 return hash<uint64_t>()(bm.
to_int());
Boolean matrices of dimension up to 8×8, stored as a single uint64; isomorph to binary relations with...
Definition bmat8.hpp:55
uint64_t row_space_size_incl() const noexcept
Returns the cardinality of the row space of this.
Definition bmat8_impl.hpp:317
BMat8 row_space_basis() const noexcept
Returns a canonical basis of the row space of this.
Definition bmat8_impl.hpp:239
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:362
static void transpose2(BMat8 &, BMat8 &) noexcept
Transpose two matrices at once.
Definition bmat8_impl.hpp:190
uint64_t row_space_size_bitset() const noexcept
Returns the cardinality of the row space of this.
Definition bmat8_impl.hpp:292
static BMat8 row_permutation_matrix(Perm16 p) noexcept
Returns the matrix associated to the permutation p by rows.
Definition bmat8_impl.hpp:437
BMat8 mult_transpose(BMat8 const &that) const noexcept
Returns the matrix product of this and the transpose of that.
Definition bmat8_impl.hpp:210
BMat8(BMat8 const &) noexcept=default
A constructor.
BMat8 transpose_maskd() const noexcept
Returns the transpose of this.
Definition bmat8_impl.hpp:176
BMat8(BMat8 &&) noexcept=default
A constructor.
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:333
bool operator>(BMat8 const &that) const noexcept
Returns true if this is greater than that.
Definition bmat8.hpp:124
BMat8 transpose() const noexcept
Returns the transpose of this.
Definition bmat8_impl.hpp:153
static BMat8 col_permutation_matrix(Perm16 p) noexcept
Returns the matrix associated to the permutation p by columns.
Definition bmat8_impl.hpp:441
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:352
BMat8 row_permuted(Perm16 p) const noexcept
Returns the matrix whose rows have been permuted according to p.
Definition bmat8_impl.hpp:425
BMat8() noexcept=default
A default constructor.
BMat8 col_space_basis() const noexcept
Returns a canonical basis of the col space of this.
Definition bmat8.hpp:202
bool row_space_included(BMat8 other) const noexcept
Returns whether the row space of this is included in other's.
Definition bmat8_impl.hpp:341
std::ostream & write(std::ostream &os) const
Write this on os.
Definition bmat8_impl.hpp:486
void row_space_bitset(epu8 &res1, epu8 &res2) const noexcept
Returns the the row space of this as 256 bits.
Definition bmat8_impl.hpp:277
Perm16 right_perm_action_on_basis(BMat8) const noexcept
Give the permutation whose right multiplication change *this to other.
Definition bmat8_impl.hpp:476
std::bitset< 256 > row_space_bitset_ref() const
Returns the the row space of this.
Definition bmat8_impl.hpp:376
bool operator!=(BMat8 const &that) const noexcept
Returns true if this does not equal that.
Definition bmat8.hpp:108
BMat8 col_permuted(Perm16 p) const noexcept
Returns the matrix whose columns have been permuted according to p.
Definition bmat8_impl.hpp:433
uint64_t to_int() const noexcept
Returns the integer representation of this.
Definition bmat8.hpp:147
uint64_t row_space_size_ref() const
Returns the cardinality of the row space of this.
Definition bmat8_impl.hpp:404
uint64_t row_space_size() const noexcept
Returns the cardinality of the row space of this.
Definition bmat8.hpp:252
BMat8 transpose_mask() const noexcept
Returns the transpose of this.
Definition bmat8_impl.hpp:164
void swap(BMat8 &that) noexcept
Definition bmat8.hpp:346
static BMat8 one(size_t dim=8) noexcept
Returns the identity BMat8.
Definition bmat8.hpp:324
std::vector< uint8_t > rows() const
Returns a std::vector for rows of this.
Definition bmat8_impl.hpp:408
size_t nr_rows() const noexcept
Returns the number of non-zero rows of this.
Definition bmat8_impl.hpp:417
void set(size_t i, size_t j, bool val) noexcept
Sets the (i, j)th position to val.
Definition bmat8_impl.hpp:111
static BMat8 random()
Returns a random BMat8.
Definition bmat8_impl.hpp:135
bool operator()(size_t i, size_t j) const noexcept
Returns the entry in the (i, j)th position.
Definition bmat8_impl.hpp:105
bool operator<(BMat8 const &that) const noexcept
Returns true if this is less than that.
Definition bmat8.hpp:116
uint64_t row_space_size_incl1() const noexcept
Returns the cardinality of the row space of this.
Definition bmat8_impl.hpp:301
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:398
Perm16 right_perm_action_on_basis_ref(BMat8) const
Give the permutation whose right multiplication change *this to other.
Definition bmat8_impl.hpp:445
defines the macro HPCOMBI_ASSERT
#define HPCOMBI_ASSERT(x)
Definition debug.hpp:31
declaration of HPCombi::epu8.
const Transf16 a1
Definition image.cpp:52
const Transf16 a2
Definition image.cpp:53
uint8_t __attribute__((vector_size(16))) epu8
epu8 stands for Extended Packed Unsigned, grouped by 8 bits; this is the low level type chosen by Int...
Definition epu8.hpp:66
declaration of PTransf16, Transf16, PPerm16 and Perm16
Permutations of : A permutation is a bijective mapping of a set of n elements onto itself.
Definition perm16.hpp:230
size_t operator()(HPCombi::BMat8 const &bm) const
Definition bmat8.hpp:369