HPCombi
High Performance Combinatorics in C++ using vector instructions v1.0.3
|
Class for fast boolean matrices of dimension up to 16 x 16. More...
#include <bmat16.hpp>
Public Member Functions | |
BMat16 () noexcept=default | |
A default constructor. | |
BMat16 (xpu64 mat) noexcept | |
A constructor. | |
BMat16 (uint64_t n0, uint64_t n1, uint64_t n2, uint64_t n3) noexcept | |
A constructor. | |
BMat16 (std::vector< std::vector< bool > > const &mat) noexcept | |
A constructor. | |
BMat16 (BMat16 const &) noexcept=default | |
A constructor. | |
BMat16 (BMat16 &&) noexcept=default | |
A constructor. | |
BMat16 & | operator= (BMat16 const &) noexcept=default |
A constructor. | |
BMat16 & | operator= (BMat16 &&) noexcept=default |
A constructor. | |
~BMat16 ()=default | |
A default destructor. | |
bool | operator== (BMat16 const &that) const noexcept |
Returns true if this equals that . | |
bool | operator!= (BMat16 const &that) const noexcept |
Returns true if this does not equal that . | |
bool | operator< (BMat16 const &that) const noexcept |
Returns true if this is less than that . | |
bool | operator> (BMat16 const &that) const noexcept |
Returns true if this is greater than that . | |
bool | operator() (size_t i, size_t j) const noexcept |
Returns the entry in the (i , j )th position. | |
void | set (size_t i, size_t j, bool val) noexcept |
Sets the (i , j )th position to val . | |
std::array< std::array< bool, 16 >, 16 > | to_array () const noexcept |
Returns the array representation of this . | |
BMat16 | operator| (BMat16 const &that) const noexcept |
Returns the bitwise or between this and that . | |
BMat16 | transpose_naive () const noexcept |
Returns the transpose of this . | |
BMat16 | transpose () const noexcept |
Returns the transpose of this . | |
BMat16 | mult_transpose (BMat16 const &that) const noexcept |
Returns the matrix product of this and the transpose of that . | |
BMat16 | mult_4bmat8 (BMat16 const &that) const noexcept |
Returns the matrix product of this and that . | |
BMat16 | operator* (BMat16 const &that) const noexcept |
Returns the matrix product of this and that . | |
BMat16 | mult_naive (BMat16 const &that) const noexcept |
Returns the matrix product of this and that . | |
BMat16 | mult_naive_array (BMat16 const &that) const noexcept |
Returns the matrix product of this and that . | |
size_t | nr_rows () const noexcept |
Returns the number of non-zero rows of this . | |
std::vector< uint16_t > | rows () const |
Returns a std::vector for rows of this . | |
void | swap (BMat16 &that) noexcept |
std::ostream & | write (std::ostream &os) const |
Write this on os . | |
Static Public Member Functions | |
static BMat16 | one (size_t dim=16) noexcept |
Returns the identity BMat16. | |
static BMat16 | random () |
Returns a random BMat16. | |
static BMat16 | random (size_t dim) |
Returns a random square BMat16 up to dimension dim . | |
Class for fast boolean matrices of dimension up to 16 x 16.
The methods for these small matrices over the boolean semiring are more optimised than the generic methods for boolean matrices. Note that all BMat16 are represented internally as an 16 x 16 matrix; any entries not defined by the user are taken to be 0. This does not affect the results of any calculations.
BMat16 is a trivial class.
|
defaultnoexcept |
A default constructor.
This constructor gives no guarantees on what the matrix will contain.
|
inlineexplicitnoexcept |
A constructor.
This constructor initializes a matrix with a 256-bit register The rows are equal to the 16 chunks, of 16 bits each, of the binary representation of the matrix.
|
inlineexplicitnoexcept |
A constructor.
This constructor initializes a matrix with 4 64 bits unsigned int Each uint represents one of the four quarter (8x8 matrix).
|
inlineexplicitnoexcept |
A constructor.
This constructor initializes a matrix where the rows of the matrix are the vectors in mat
.
|
defaultnoexcept |
A constructor.
This is the copy constructor.
|
defaultnoexcept |
A constructor.
This is the move constructor.
|
default |
A default destructor.
Returns the matrix product of this
and that
.
This method returns the standard matrix product (over the boolean semiring) of two BMat16 objects. It comes down to 8 products of 8x8 matrices, which make up a 16x16 when we cut it into 4.
Returns the matrix product of this
and that
.
This method returns the standard matrix product (over the boolean semiring) of two BMat16 objects. It performs the most naive approach by simply iterating through all entries using array conversion.
Returns the matrix product of this
and the transpose of that
.
This method returns the standard matrix product (over the boolean semiring) of two BMat16 objects. This is faster than transposing that and calling the product of this
with it. Implementation uses vector instructions.
|
inlinenoexcept |
Returns the number of non-zero rows of this
.
Vectorized version which doesn't work due to the absence of popcnt in simde
|
inlinestaticnoexcept |
|
inlinenoexcept |
Returns true
if this
does not equal that
.
This method checks the mathematical inequality of two BMat16 objects.
|
inlinenoexcept |
Returns the entry in the (i
, j
)th position.
This method returns the entry in the (i
, j
)th position. Note that since all matrices are internally represented as 16 x 16, it is possible to access entries that you might not believe exist.
Returns the matrix product of this
and that
.
This method returns the standard matrix product (over the boolean semiring) of two BMat16 objects. This is a fast implementation using transposition and vector instructions.
|
inlinenoexcept |
Returns true
if this
is less than that
.
This method checks whether a BMat16 objects is less than another.
A constructor.
This is the move assignment constructor.
A constructor.
This is the copy assignment constructor.
|
inlinenoexcept |
Returns true
if this
equals that
.
This method checks the mathematical equality of two BMat16 objects.
|
inlinenoexcept |
Returns true
if this
is greater than that
.
This method checks whether a BMat16 objects is greater than another.
Returns the bitwise or between this
and that
.
This method perform the bitwise operator on the matrices and returns the result as a BMat16.
|
inlinestatic |
|
inlinestatic |
|
inline |
Returns a std::vector
for rows of this
.
|
inlinenoexcept |
Sets the (i
, j
)th position to val
.
This method sets the (i
, j
)th entry of this
to val
. Uses the bit twiddle for setting bits found here.
|
inlinenoexcept |
|
inlinenoexcept |
Returns the array representation of this
.
Returns a two dimensional 16 x 16 array representing the matrix.
|
inlinenoexcept |
Returns the transpose of this
.
Returns the standard matrix transpose of a BMat16. Uses the technique found in Knuth AoCP Vol. 4 Fasc. 1a, p. 15.
|
inlinenoexcept |
Returns the transpose of this
.
Returns the standard matrix transpose of a BMat16. Uses a naive technique, by simply iterating through all entries.
|
inline |
Write this
on os
.