libsemigroups  v3.0.0
C++ library for semigroups and monoids
Loading...
Searching...
No Matches
libsemigroups::bmat8 Namespace Reference

Defined in bmat8.hpp.

This namespace contains various helper functions for the class BMat8. These functions could be functions of BMat8 but they only use public member functions of BMat8, and so they are declared as free functions instead.

Functions

BMat8 col_space_basis (BMat8 const &x) noexcept
 Find a basis for the column space of a BMat8.
 
size_t col_space_size (BMat8 const &x)
 Returns the size of the column space of a BMat8.
 
bool is_regular_element (BMat8 const &x) noexcept
 Checks whether a BMat8 is regular in the monoid of all BMat8 objects.
 
size_t minimum_dim (BMat8 const &x) noexcept
 Returns the minimum dimension of a BMat8.
 
constexpr size_t number_of_cols (BMat8 const &x) noexcept
 Returns the number of non-zero columns in a BMat8.
 
constexpr size_t number_of_rows (BMat8 const &x) noexcept
 Returns the number of non-zero rows in a BMat8.
 
template<typename T>
constexpr T one (size_t dim=8) noexcept
 Returns the identity boolean matrix of a given dimension.
 
constexpr BMat8 one (size_t dim=8) noexcept
 Returns the identity BMat8 of a given dimension.
 
template<typename Container>
void push_back_rows (Container &rows, BMat8 const &x)
 Push the rows of a BMat8 into the back of a container.
 
BMat8 random ()
 Construct a random BMat8.
 
BMat8 random (size_t dim)
 Construct a random BMat8 of dimension at most dim.
 
BMat8 row_space_basis (BMat8 const &x) noexcept
 Find a basis for the row space of a BMat8.
 
size_t row_space_size (BMat8 const &x)
 Returns the size of the row space of a BMat8.
 
std::vector< uint8_t > rows (BMat8 const &x)
 Returns a vector of the rows of a BMat8.
 
std::vector< bool > to_vector (uint8_t row)
 Convert a uint8_t to a vector.
 
constexpr BMat8 transpose (BMat8 const &x) noexcept
 Returns the transpose of a BMat8.
 

Function Documentation

◆ col_space_basis()

BMat8 col_space_basis ( BMat8 const & x)
inlinenodiscardnoexcept

This function returns a BMat8 whose non-zero columns form a basis for the column space of x.

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

◆ col_space_size()

size_t col_space_size ( BMat8 const & x)
inlinenodiscard
Parameters
xthe matrix.
Returns
The size of the column space of x.
Exceptions
This function guarantees not to throw a LibsemigroupsException.
Complexity
\(O(n)\) where \(n\) is the return value of this function.
See also
row_space_size.

◆ is_regular_element()

bool is_regular_element ( BMat8 const & x)
nodiscardnoexcept

Check whether x is a regular element of the full boolean matrix monoid of appropriate dimension.

Parameters
xthe matrix.
Returns
A true if there exists a boolean matrix y such that x * y * x = x where x, and false otherwise.
Exceptions
This function is noexcept and is guaranteed never to throw.
Complexity
Constant.

◆ minimum_dim()

size_t minimum_dim ( BMat8 const & x)
nodiscardnoexcept

This function returns the maximal n such that row n or column n contains a 1. Equivalent to the maximum of number_of_rows and number_of_cols.

Parameters
xthe matrix.
Returns
The minimum dimension of x.
Exceptions
This function is noexcept and is guaranteed never to throw.
Complexity
Constant.

◆ number_of_cols()

size_t number_of_cols ( BMat8 const & x)
nodiscardconstexprnoexcept

BMat8s do not know their "dimension" - in effect they are all of dimension 8. However, this function can be used to obtain the number of non-zero rows of a BMat8.

Parameters
xthe matrix.
Returns
The number of non-zero columns.
Exceptions
This function is noexcept and is guaranteed never to throw.
Complexity
Constant.
See also
number_of_rows and minimum_dim.

◆ number_of_rows()

size_t number_of_rows ( BMat8 const & x)
nodiscardconstexprnoexcept

BMat8s do not know their "dimension" - in effect they are all of dimension 8. However, this function can be used to obtain the number of non-zero rows of a BMat8.

Parameters
xthe matrix.
Returns
The number of non-zero rows.
Exceptions
This function is noexcept and is guaranteed never to throw.
Complexity
Constant.
See also
number_of_cols and minimum_dim.

◆ one() [1/2]

template<typename T>
T one ( size_t dim = 8)
nodiscardconstexprnoexcept

Returns the identity boolean matrix of a given dimension.

Template Parameters
Tthe type of the boolean matrix being constructed, should be BMat8 or HPCombi::BMat8.
Parameters
dimthe dimension of the identity matrix, must be at most 8.
Returns
A value of type T with the first dim values on the main diagonal equal to 1 and every other entry equal to 0.
Exceptions
This function is noexcept and is guaranteed never to throw.
Complexity
Constant.
See also
one

◆ one() [2/2]

BMat8 one ( size_t dim = 8)
nodiscardconstexprnoexcept

This function returns the BMat8 with the first dim entries in the main diagonal equal to 1 and every other value equal to 0.

Parameters
dimthe dimension of the identity (default: 8).
Returns
A BMat8.
Exceptions
This function is noexcept and is guaranteed never to throw.
Complexity
Constant.

◆ push_back_rows()

template<typename Container>
void push_back_rows ( Container & rows,
BMat8 const & x )

This function adds the uint8_t values representing the rows of x to the container rows using its push_back member function.

Template Parameters
Containerthe type of the container. Must support push_back and have Container::value_type equal to uint8_t.
Parameters
rowsthe container.
xthe matrix.
Exceptions
This function guarantees not to throw a LibsemigroupsException.
Complexity
Constant.

◆ random() [1/2]

BMat8 random ( )
nodiscard

This function returns a BMat8 chosen at random.

Returns
A BMat8.
Exceptions
This function guarantees not to throw a LibsemigroupsException.

◆ random() [2/2]

BMat8 random ( size_t dim)
nodiscard

This function returns a BMat8 chosen at random, where only the top-left dim x dim entries can be non-zero.

Parameters
dimthe dimension.
Returns
A BMat8.
Exceptions
This function guarantees not to throw a LibsemigroupsException.

◆ row_space_basis()

BMat8 row_space_basis ( BMat8 const & x)
nodiscardnoexcept

This function returns a BMat8 whose non-zero rows form a basis for the row space of x.

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

◆ row_space_size()

size_t row_space_size ( BMat8 const & x)
nodiscard
Parameters
xthe matrix.
Returns
The size of the row space of x.
Exceptions
This function guarantees not to throw a LibsemigroupsException.
Complexity
\(O(n)\) where \(n\) is the return value of this function.
See also
col_space_size.

◆ rows()

std::vector< uint8_t > rows ( BMat8 const & x)
nodiscard

This function returns a std::vector of uint8_t representing the rows of x. The returned vector always has length 8, even if x was constructed with fewer rows.

Parameters
xthe matrix.
Returns
A std::vector<uint8_t>.
Exceptions
This function guarantees not to throw a LibsemigroupsException.
Complexity
Constant.

◆ to_vector()

std::vector< bool > to_vector ( uint8_t row)

This function converts its argument row to a std::vector<bool> such that the item with index i is true if the bit with index i in row is 1, and false if the corresponding bit is 0.

Parameters
rowthe matrix.
Returns
The row represented as a boolean vector.
Complexity
Constant.

◆ transpose()

BMat8 transpose ( BMat8 const & x)
nodiscardconstexprnoexcept

This function returns the transpose of its argument x, which is computed using the technique found in [39].

Parameters
xthe matrix to transpose.
Returns
A BMat8.
Exceptions
This function is noexcept and is guaranteed never to throw.
Complexity
Constant.