BMat8 helpers
This page contains the documentation for various helper functions for
manipulating BMat8
objects. All these functions are contained in the
submodule libsemigroups_pybind11.bmat8
.
Contents
Find a basis for the column space of a |
|
Returns the size of the column space of a |
|
|
Returns the minimum dimension of a |
Returns the number of non-zero columns in a |
|
Returns the number of non-zero rows in a |
|
|
Returns the identity |
|
Construct a random |
Find a basis for the row space of a |
|
Returns the size of the row space of a |
|
|
Returns a list of the rows of a |
|
Returns the transpose of a |
Full API
This module contains the helper functions from libsemigroups_pybind11.bmat8
.
- bmat8.col_space_basis(x: BMat8) BMat8
Find a basis for the column space of a
BMat8
.This function returns a
BMat8
whose non-zero columns form a basis for the column space of x.>>> from libsemigroups_pybind11 import BMat8, bmat8 >>> x = BMat8([[1, 0, 1], [0, 1, 0], [0, 0, 0]]) >>> bmat8.col_space_basis(x) BMat8([[1, 0], [0, 1]])
- bmat8.col_space_size(x: BMat8) int
Returns the size of the column space of a
BMat8
.- Parameters:
x (BMat8) – the matrix.
- Returns:
The size of the column space of x.
- Return type:
- Complexity:
\(O(n)\) where \(n\) is the return value of this function.
See also
>>> from libsemigroups_pybind11 import BMat8, bmat8 >>> x = BMat8([[0, 1], [1, 0]]) >>> bmat8.col_space_size(x) 4
- bmat8.is_regular_element(x: BMat8) bool
Check whether x is a regular element of the full boolean matrix monoid of appropriate dimension.
- Parameters:
x (BMat8) – the matrix.
- Returns:
True
if there exists a boolean matrixy
such thatx * y * x = x
where x, andFalse
otherwise.- Return type:
- Complexity:
Constant.
>>> from libsemigroups_pybind11 import BMat8, bmat8 >>> x = BMat8([[0, 1], [1, 0]]) >>> bmat8.is_regular_element(x) True >>> sum(1 for x in range(100000) if bmat8.is_regular_element(BMat8(x))) 97996
- bmat8.minimum_dim(x: BMat8) int
Returns the minimum dimension of a
BMat8
.This function returns the maximal n such that row n or column n in the boolean matrix x contains a
1
. Equivalent to the maximum ofnumber_of_rows
andnumber_of_cols
.- Parameters:
x (BMat8) – the matrix.
- Returns:
The minimum dimension of x.
- Return type:
- Complexity:
Constant.
>>> from libsemigroups_pybind11 import BMat8, bmat8 >>> x = BMat8([[0, 1], [1, 0]]) >>> bmat8.minimum_dim(x) 2
- bmat8.number_of_cols(x: BMat8) int
Returns the number of non-zero columns in a
BMat8
.BMat8
objects 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 aBMat8
.- Parameters:
x (BMat8) – the matrix.
- Returns:
The number of non-zero columns.
- Return type:
- Complexity:
Constant.
See also
>>> from libsemigroups_pybind11 import BMat8, bmat8 >>> x = BMat8([[1, 0, 1], [0, 1, 0], [0, 0, 0]]) >>> bmat8.number_of_cols(x) 3
- bmat8.number_of_rows(x: BMat8) int
Returns the number of non-zero rows in a
BMat8
.BMat8
objects 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 aBMat8
.- Parameters:
x (BMat8) – the matrix.
- Returns:
The number of non-zero rows.
- Return type:
- Complexity:
Constant.
See also
>>> from libsemigroups_pybind11 import BMat8, bmat8 >>> x = BMat8([[1, 0, 1], [0, 1, 0], [0, 0, 0]]) >>> bmat8.number_of_rows(x) 2
- bmat8.one(dim: int) BMat8
Returns the identity
BMat8
of a given dimension.This function returns the
BMat8
with the first dim entries in the main diagonal equal to1
and every other value equal to0
.- Parameters:
dim (int) – the dimension of the identity (default:
8
)- Returns:
A
BMat8
.- Return type:
- Complexity:
Constant.
>>> from libsemigroups_pybind11 import bmat8 >>> bmat8.one(4) BMat8([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]])
- bmat8.random(dim: int) BMat8
Construct a random
BMat8
of dimension at most dim.This function returns a
BMat8
chosen at random, where only the top-left dim by dim entries can be non-zero.
- bmat8.row_space_basis(x: BMat8) BMat8
Find a basis for the row space of a
BMat8
.This function returns a
BMat8
whose non-zero rows form a basis for the row space of x.>>> from libsemigroups_pybind11 import BMat8, bmat8 >>> x = BMat8([[1, 0, 1], [0, 1, 0], [0, 0, 0]]) >>> bmat8.row_space_basis(x) BMat8([[1, 0, 1], [0, 1, 0], [0, 0, 0]])
- bmat8.row_space_size(x: BMat8) int
Returns the size of the row space of a
BMat8
.- Parameters:
x (BMat8) – the matrix.
- Returns:
The size of the row space of x.
- Return type:
- Complexity:
\(O(n)\) where \(n\) is the return value of this function.
See also
>>> from libsemigroups_pybind11 import BMat8, bmat8 >>> x = BMat8([[1, 0, 0], [0, 1, 1], [0, 1, 0]]) >>> bmat8.row_space_size(x) 6
- bmat8.rows(x: BMat8) list[list[bool]]
Returns a list of the rows of a
BMat8
.This function returns the rows of x. The returned list always has length 8, even if x was constructed with fewer rows.
- Parameters:
x (BMat8) – the matrix.
- Returns:
The list of rows of the boolean matrix x.
- Return type:
- Complexity:
Constant.
>>> from libsemigroups_pybind11 import BMat8, bmat8 >>> x = BMat8([[0, 1], [1, 0]]) >>> bmat8.rows(x) [[False, True, False, False, False, False, False, False], [True, False, False, False, False, False, False, False], [False, False, False, False, False, False, False, False], [False, False, False, False, False, False, False, False], [False, False, False, False, False, False, False, False], [False, False, False, False, False, False, False, False], [False, False, False, False, False, False, False, False], [False, False, False, False, False, False, False, False]]
- bmat8.transpose(x: BMat8) BMat8
Returns the transpose of a
BMat8
.This function returns the transpose of its argument x, which is computed using the technique found in [Knu09].
- Parameters:
x (BMat8) – the matrix to transpose.
- Returns:
A
BMat8
.- Return type:
- Complexity:
Constant.
>>> from libsemigroups_pybind11 import BMat8, bmat8 >>> x = BMat8([[1, 0, 1], [0, 1, 0], [0, 0, 0]]) >>> bmat8.transpose(x) BMat8([[1, 0, 0], [0, 1, 0], [1, 0, 0]])