libsemigroups  v3.0.0
C++ library for semigroups and monoids
Loading...
Searching...
No Matches

Defined in bmat8.hpp.

This class represents 8 x 8 matrices over the boolean semiring. The functions for these small matrices over the boolean semiring are more optimised than the generic functions for boolean matrices. Note that all BMat8 are represented internally as an 8 x 8 matrix; any entries not defined by the user are taken to be 0. This does not affect the results of any calculations.

Public Member Functions

 BMat8 () noexcept=default
 Default constructor.
 
constexpr BMat8 (BMat8 &&) noexcept=default
 Default move constructor.
 
constexpr BMat8 (BMat8 const &) noexcept=default
 Default copy constructor.
 
 BMat8 (std::vector< std::vector< bool > > const &mat)
 A constructor.
 
constexpr BMat8 (uint64_t mat) noexcept
 Construct from an integer.
 
uint8_t at (size_t r) const
 Access a row of a BMat8 (with bound checks).
 
BitRef at (size_t r, size_t c)
 Access entries in a matrix (with bound checks).
 
bool at (size_t r, size_t c) const
 Access entries in a matrix (with bound checks).
 
constexpr bool operator!= (BMat8 const &that) const noexcept
 Inequality operator.
 
constexpr uint8_t operator() (size_t r) const noexcept
 Access a row of a BMat8 (no bound checks).
 
constexpr BitRef operator() (size_t r, size_t c)
 Access entries in a matrix (no bound checks).
 
constexpr bool operator() (size_t r, size_t c) const noexcept
 Access entries in a matrix (no bound checks).
 
BMat8 operator* (BMat8 const &that) const noexcept
 Returns the matrix product of this and that.
 
constexpr BMat8 operator* (bool scalar) const noexcept
 Multiply a BMat8 by a scalar.
 
BMat8operator*= (BMat8 const &that) noexcept
 Multiply this by that in-place.
 
constexpr BMat8operator*= (bool scalar) noexcept
 Multiply a BMat8 by a scalar (in-place).
 
constexpr BMat8 operator+ (BMat8 const &that) const noexcept
 Sum BMat8 objects.
 
constexpr BMat8operator+= (BMat8 const &that) noexcept
 Sum BMat8 objects (in-place).
 
constexpr bool operator< (BMat8 const &that) const noexcept
 Less than operator.
 
constexpr bool operator<= (BMat8 const &that) const noexcept
 Less than or equal operator.
 
constexpr BMat8operator= (BMat8 &&) noexcept=default
 Default move assignment operator.
 
constexpr BMat8operator= (BMat8 const &) noexcept=default
 Default copy assignment operator.
 
constexpr bool operator== (BMat8 const &that) const noexcept
 Equality operator.
 
constexpr bool operator> (BMat8 const &that) const noexcept
 Greater than operator.
 
constexpr bool operator>= (BMat8 const &that) const noexcept
 Greater than or equal operator.
 
void swap (BMat8 &that) noexcept
 Swaps this with that.
 
constexpr uint64_t to_int () const noexcept
 Returns the integer representation of this.
 

Constructor & Destructor Documentation

◆ BMat8() [1/5]

BMat8 ( )
defaultnoexcept

There is no guarantee about the contents of the matrix constructed.

Exceptions
This function is noexcept and is guaranteed never to throw.
Complexity
Constant.

◆ BMat8() [2/5]

BMat8 ( uint64_t mat)
inlineexplicitconstexprnoexcept

This constructor initializes a BMat8 to have rows equal to the 8 chunks, of 8 bits each, of the binary representation of mat.

Parameters
matthe integer representation of the matrix being constructed.
Exceptions
This function is noexcept and is guaranteed never to throw.
Complexity
Constant.

◆ BMat8() [3/5]

BMat8 ( std::vector< std::vector< bool > > const & mat)
explicit

This constructor initializes a matrix where the rows of the matrix are the vectors in mat.

Parameters
matthe vector of vectors representation of the matrix being constructed.
Exceptions
LibsemigroupsExceptionif mat has 0 rows.
LibsemigroupsExceptionif mat has more than 8 rows.
LibsemigroupsExceptionif the rows of mat are not all of the same length.
Complexity
Constant.

◆ BMat8() [4/5]

BMat8 ( BMat8 const & )
constexprdefaultnoexcept
Exceptions
This function is noexcept and is guaranteed never to throw.
Complexity
Constant.

◆ BMat8() [5/5]

BMat8 ( BMat8 && )
constexprdefaultnoexcept
Exceptions
This function is noexcept and is guaranteed never to throw.
Complexity
Constant.

Member Function Documentation

◆ at() [1/3]

uint8_t at ( size_t r) const
nodiscard

Returns the row with index r in the matrix represented as a uint8_t.

Parameters
rthe index of the row.
Returns
A row of the matrix.
Exceptions
LibsemigroupsExceptionif r is out of bounds (i.e. \(>= 8\)).
Complexity
Constant.
Note
Note that since all matrices are internally represented as 8 x 8, it is possible to access entries that you might not believe exist.
See also
operator()(size_t) const rows, and to_vector.

◆ at() [2/3]

BitRef at ( size_t r,
size_t c )
nodiscard

Returns a reference to the entry in the row r and column c.

Parameters
rthe row.
cthe column.
Exceptions
LibsemigroupsExceptionif r or c is out of bounds.
Complexity
Constant.
See also
operator()()

◆ at() [3/3]

bool at ( size_t r,
size_t c ) const
nodiscard

Returns the value of the entry in the row r and column c.

Parameters
rthe row.
cthe column.
Exceptions
LibsemigroupsExceptionif r or c is out of bounds.
Complexity
Constant.
See also
operator()()

◆ operator!=()

bool operator!= ( BMat8 const & that) const
inlinenodiscardconstexprnoexcept

Returns true if this does not equal that

This function checks the mathematical inequality of two BMat8 objects.

Parameters
thatthe BMat8 for comparison.
Exceptions
This function is noexcept and is guaranteed never to throw.
Complexity
Constant.

◆ operator()() [1/3]

uint8_t operator() ( size_t r) const
inlinenodiscardconstexprnoexcept

Returns the row with index r in the matrix represented as a uint8_t.

Parameters
rthe index of the row.
Returns
A row of the matrix.
Exceptions
This function is noexcept and is guaranteed never to throw.
Complexity
Constant.
Note
Note that since all matrices are internally represented as 8 x 8, it is possible to access entries that you might not believe exist.
Warning
No checks on the parameter r are performed.
See also
at, rows, and to_vector.

◆ operator()() [2/3]

BitRef operator() ( size_t r,
size_t c )
inlinenodiscardconstexpr

Returns a reference to the entry in the matrix in row r and column c.

Parameters
rthe index of the row.
cthe index of the column.
Returns
A reference to the entry.
Exceptions
This function is noexcept and is guaranteed never to throw.
Complexity
Constant.
Note
Note that since all matrices are internally represented as 8 x 8, it is possible to access entries that you might not believe exist.
Warning
No checks on the parameters r and c are performed, if r or c is greater than 7, then bad things will happen.
See also
at

◆ operator()() [3/3]

bool operator() ( size_t r,
size_t c ) const
inlinenodiscardconstexprnoexcept

Returns the entry in the matrix in row r and column c.

Parameters
rthe index of the row.
cthe index of the column.
Returns
A bool.
Exceptions
This function is noexcept and is guaranteed never to throw.
Complexity
Constant.
Note
Note that since all matrices are internally represented as 8 x 8, it is possible to access entries that you might not believe exist.
Warning
No checks on the parameters r and c are performed, if r or c is greater than 7, then bad things will happen.
See also
at

◆ operator*() [1/2]

BMat8 operator* ( BMat8 const & that) const
nodiscardnoexcept

This function returns the standard matrix product (over the boolean semiring) of two BMat8 objects. Uses the technique given here.

Parameters
thatthe matrix we want to multiply by this.
Returns
A BMat8.
Exceptions
This function is noexcept and is guaranteed never to throw.
Complexity
Constant.

◆ operator*() [2/2]

BMat8 operator* ( bool scalar) const
inlinenodiscardconstexprnoexcept

This function returns the product of a BMat8 object and the boolean scalar value scalar.

Parameters
scalarthe scalar.
Returns
A BMat8.
Exceptions
This function is noexcept and is guaranteed never to throw.
Complexity
Constant.

◆ operator*=() [1/2]

BMat8 & operator*= ( BMat8 const & that)
noexcept

This function replaces the value of this by the standard matrix product (over the boolean semiring) of this and that.

Parameters
thatthe matrix we want to multiply by this.
Returns
A reference to *this.
Exceptions
This function is noexcept and is guaranteed never to throw.
Complexity
Constant.

◆ operator*=() [2/2]

BMat8 & operator*= ( bool scalar)
inlineconstexprnoexcept

This function returns the product of a BMat8 object and the boolean scalar value scalar.

Parameters
scalarthe scalar.
Returns
A reference to this.
Exceptions
This function is noexcept and is guaranteed never to throw.
Complexity
Constant.

◆ operator+()

BMat8 operator+ ( BMat8 const & that) const
inlinenodiscardconstexprnoexcept

This function returns the sum of two BMat8 objects.

Parameters
thatthe BMat8 to add.
Returns
The sum of *this and that.
Exceptions
This function is noexcept and is guaranteed never to throw.
Complexity
Constant.

◆ operator+=()

BMat8 & operator+= ( BMat8 const & that)
inlineconstexprnoexcept

This function adds that to *this in-place.

Parameters
thatthe BMat8 to add.
Returns
A reference to *this.
Exceptions
This function is noexcept and is guaranteed never to throw.
Complexity
Constant.

◆ operator<()

bool operator< ( BMat8 const & that) const
inlinenodiscardconstexprnoexcept

Returns true if this is less than that.

This function checks whether a BMat8 objects is less than another; where the order is defined by to_int.

Parameters
thatthe BMat8 for comparison.
Exceptions
This function is noexcept and is guaranteed never to throw.
Complexity
Constant.

◆ operator<=()

bool operator<= ( BMat8 const & that) const
inlinenodiscardconstexprnoexcept

Returns true if this is less than or equal to that.

This function checks whether a BMat8 objects is less or equal than another; where the order is defined by to_int.

Parameters
thatthe BMat8 for comparison.
Exceptions
This function is noexcept and is guaranteed never to throw.
Complexity
Constant.

◆ operator=() [1/2]

BMat8 & operator= ( BMat8 && )
constexprdefaultnoexcept
Exceptions
This function is noexcept and is guaranteed never to throw.
Complexity
Constant.

◆ operator=() [2/2]

BMat8 & operator= ( BMat8 const & )
constexprdefaultnoexcept
Exceptions
This function is noexcept and is guaranteed never to throw.
Complexity
Constant.

◆ operator==()

bool operator== ( BMat8 const & that) const
inlinenodiscardconstexprnoexcept

Returns true if this equals that.

This function checks the mathematical equality of two BMat8 objects.

Parameters
thatthe BMat8 for comparison.
Exceptions
This function is noexcept and is guaranteed never to throw.
Complexity
Constant.

◆ operator>()

bool operator> ( BMat8 const & that) const
inlinenodiscardconstexprnoexcept

Returns true if this is greater than that.

This function checks whether a BMat8 objects is greater than another; where the order is defined by to_int.

Parameters
thatthe BMat8 for comparison.
Exceptions
This function is noexcept and is guaranteed never to throw.
Complexity
Constant.

◆ operator>=()

bool operator>= ( BMat8 const & that) const
inlinenodiscardconstexprnoexcept

Returns true if this is greater than or equal to that.

This function checks whether a BMat8 objects is greater or equal than another; where the order is defined by to_int.

Parameters
thatthe BMat8 for comparison.
Exceptions
This function is noexcept and is guaranteed never to throw.
Complexity
Constant.

◆ swap()

void swap ( BMat8 & that)
inlinenoexcept

This function swaps the values of this and that.

Parameters
thatthe BMat8 to swap this with.
Exceptions
This function is noexcept and is guaranteed never to throw.
Complexity
Constant.

◆ to_int()

uint64_t to_int ( ) const
inlinenodiscardconstexprnoexcept

Returns an unsigned integer obtained by interpreting an 8 x 8 BMat8 as a sequence of 64 bits (reading rows left to right, from top to bottom) and then realising this sequence as an unsigned int.

Returns
A uint64_t.
Exceptions
This function is noexcept and is guaranteed never to throw.
Complexity
Constant.

The documentation for this class was generated from the following file: