![]() |
libsemigroups
v3.0.0
C++ library for semigroups and monoids
|
Defined in bipart.hpp
.
It is possible to associate to every Bipartition a pair of blocks, Bipartition::left_blocks() and Bipartition::right_blocks(), which determine the Green's \(\mathscr{L}\)- and \(\mathscr{R}\)-classes of the Bipartition in the monoid of all bipartitions. This is the purpose of this class.
The Blocks class is not currently used widely in libsemigroups
but is used extensively in the Semigroups package for GAP (see [45]).
Public Types | |
using | const_iterator = typename std::vector<uint32_t>::const_iterator |
Type for const iterators pointing to the index of the block. | |
using | iterator = typename std::vector<uint32_t>::iterator |
Type for iterators pointing to the index of the block. | |
using | lookup_const_iterator = std::vector<bool>::const_iterator |
Type for const iterators pointing to the transverse block lookup. | |
Public Member Functions | |
Blocks () noexcept=default | |
Constructs a blocks object of size 0. | |
Blocks (Blocks &©)=default | |
Default move constructor. | |
Blocks (Blocks const ©)=default | |
Default copy constructor. | |
Blocks (const_iterator first, const_iterator last) | |
Construct a blocks object from iterators. | |
Blocks (size_t degree) | |
Constructs a blocks object of given degree. | |
Blocks (std::vector< std::vector< int32_t > > const &blocks) | |
Constructs a Blocks object from a vector of vectors of integers. | |
uint32_t const & | at (size_t i) const |
Return a const reference to the index of the block containing a point. | |
Blocks & | block (size_t i, uint32_t val) |
Set the block that a point belongs to. | |
Blocks & | block_no_checks (size_t i, uint32_t val) |
Set the block that a point belongs to. | |
const_iterator | cbegin () const noexcept |
Return a const iterator pointing to the index of the first block. | |
lookup_const_iterator | cbegin_lookup () const noexcept |
Return a const iterator pointing to the first transverse block lookup. | |
const_iterator | cend () const noexcept |
Return a const iterator pointing one past-the-end of the last block. | |
lookup_const_iterator | cend_lookup () const noexcept |
Return a const iterator pointing to the first transverse block lookup. | |
uint32_t | degree () const noexcept |
Return the degree of a blocks object. | |
size_t | hash_value () const noexcept |
Return a hash value for a Blocks instance. | |
Blocks & | is_transverse_block (size_t i, bool val) |
Set whether or not the block containing a point is transverse. | |
bool | is_transverse_block (size_t index) const |
Check if a block is a transverse block. | |
Blocks & | is_transverse_block_no_checks (size_t i, bool val) |
Set whether or not the block containing a point is transverse. | |
bool | is_transverse_block_no_checks (size_t index) const |
Check if a block is a transverse block. | |
std::vector< bool > const & | lookup () const noexcept |
Return a const reference to the transverse blocks lookup. | |
uint32_t | number_of_blocks () const noexcept |
Return the number of blocks in a Blocks object. | |
bool | operator!= (Blocks const &that) const |
Compare two blocks objects for inequality. | |
bool | operator< (Blocks const &that) const |
Compare two blocks objects for less. | |
Blocks & | operator= (Blocks &&)=default |
Default move assignment operator. | |
Blocks & | operator= (Blocks const &)=default |
Default copy assignment operator. | |
bool | operator== (Blocks const &that) const |
Compare two blocks objects for equality. | |
uint32_t const & | operator[] (size_t i) const |
Return a const reference to the index of the block containing a point. | |
uint32_t | rank () const |
Return the number of transverse blocks. | |
using const_iterator = typename std::vector<uint32_t>::const_iterator |
Type for const iterators pointing to the index of the block.
using iterator = typename std::vector<uint32_t>::iterator |
Type for iterators pointing to the index of the block.
using lookup_const_iterator = std::vector<bool>::const_iterator |
Type for const iterators pointing to the transverse block lookup.
|
defaultnoexcept |
Default construct an empty Blocks object.
noexcept
and is guaranteed never to throw.Blocks | ( | const_iterator | first, |
const_iterator | last ) |
The degree of the blocks object constructed is last - first / 2
.
first | iterator pointing to the index of the block containing the first point. |
last | iterator pointing one past the index of the block containing the last point. |
last - first
.
|
inlineexplicit |
degree | the degree of the blocks object to construct. |
degree
.
|
explicit |
This function constructs a Blocks object from a vector of vectors of (signed) integers, so that the blocks consisting of negative values are transverse and those consisting of positive values are not.
blocks | the blocks. |
LibsemigroupsException | if the set consisting of the absolute values of the entries in blocks is not \({1, \ldots, n\}\) where \(n\) is the maximum such value. |
LibsemigroupsException | if 0 is an item in any block. |
LibsemigroupsException | if any block is empty. |
LibsemigroupsException | if any block contains both negative and positive values. |
LibsemigroupsException | if the constructed Blocks object is not valid. |
blocks
.
|
inlinenodiscard |
i | the point. |
uint32_t
.std::out_of_range | if i is out of range. |
Blocks & block | ( | size_t | i, |
uint32_t | val ) |
This function can be used to set the block containing the point i
(to equal val
).
i | the point. |
val | the block that i should belong to. |
LibsemigroupsException | if i is not in the range \([0, n)\) where \(n\) is the return value of number_of_blocks. |
degree()
. Blocks & block_no_checks | ( | size_t | i, |
uint32_t | val ) |
This function can be used to set the block containing the point i
(to equal val
).
i | the point. |
val | the block that i should belong to. |
degree()
.
|
inlinenodiscardnoexcept |
noexcept
and is guaranteed never to throw.
|
inlinenodiscardnoexcept |
The value pointed to is true
if the i
th block of this
is a transverse block; and false
otherwise.
noexcept
and is guaranteed never to throw.
|
inlinenodiscardnoexcept |
noexcept
and is guaranteed never to throw.
|
inlinenodiscardnoexcept |
|
inlinenodiscardnoexcept |
The degree of a Blocks object is the size of the set of which it is a partition, or the size of the blocks
parameter to Blocks::Blocks.
noexcept
and is guaranteed never to throw.
|
nodiscardnoexcept |
This value is recomputed every time this function is called.
this
.noexcept
and is guaranteed never to throw.degree()
.
|
inline |
This function can be used to set whether or not the block containing i
is transverse.
i | the point. |
val | whether or not the block containing i is transverse. |
LibsemigroupsException | if i is not in the range \([0, n)\) where \(n\) is the return value of number_of_blocks. |
|
inlinenodiscard |
This function returns true
if the block with index index
is a transverse (or signed) block and it returns false
if it is not transverse (or unsigned).
index | the index of a block. |
LibsemigroupsException | if i is not in the range \([0, n)\) where \(n\) is the return value of number_of_blocks. |
|
inline |
This function can be used to set whether or not the block containing i
is transverse.
i | the point. |
val | whether or not the block containing i is transverse. |
|
inlinenodiscard |
This function returns true
if the block with index index
is a transverse (or signed) block and it returns false
if it is not transverse (or unsigned).
index | the index of a block. |
|
inlinenodiscardnoexcept |
The value in position i
of the returned vector is true
if the block with index i
is transverse and false
if it is not transverse.
std::vector<bool>
.noexcept
and is guaranteed never to throw.
|
inlinenodiscardnoexcept |
This function returns the number of parts in the partition that instances of this class represent.
noexcept
and is guaranteed never to throw.
|
inlinenodiscard |
Two Blocks objects are equal if and only if their underlying signed partitions are equal. It is ok to compare blocks of different degree with this operator.
that | the Blocks instance for comparison. |
*this
and that
are not equal.degree()
.
|
nodiscard |
This operator defines a total order on the set of all Blocks objects (including those of different degree).
that | the Blocks instance for comparison. |
*this
is less than that
.degree()
.
|
inlinenodiscard |
Two Blocks objects are equal if and only if their underlying signed partitions are equal. It is ok to compare blocks of different degree with this operator.
that | the Blocks instance for comparison. |
*this
equals that
.degree()
.
|
inlinenodiscard |
i | the point. |
uint32_t
.
|
nodiscard |
This function returns the number of true
values in lookup().
this
.