![]() |
libsemigroups
v3.0.0
C++ library for semigroups and monoids
|
Defined in bipart.hpp
.
A bipartition is a partition of the set \(\{0, ..., 2n - 1\}\) for some non-negative integer \(n\); see the Semigroups package for GAP documentation for more details. The Bipartition class is more complex (i.e. has more member functions) than are used in libsemigroups
because they are used in the Semigroups package for GAP (see [45]).
Public Types | |
using | const_iterator = std::vector<uint32_t>::const_iterator |
Type of const iterators pointing to block lookup. | |
using | iterator = std::vector<uint32_t>::iterator |
Type of iterators pointing to block lookup. | |
using | lookup_const_iterator = typename std::vector<bool>::const_iterator |
Type of const iterators pointing to transverse blocks lookup. | |
Public Member Functions | |
Bipartition () | |
Construct an uninitialised bipartition of degree 0 . | |
Bipartition (Bipartition &&) | |
Default move constructor. | |
Bipartition (Bipartition const &) | |
Default copy constructor. | |
Bipartition (size_t N) | |
Construct an uninitialised bipartition of given degree. | |
Bipartition (std::initializer_list< std::vector< int32_t > > const &blocks) | |
Construct a bipartition from a partition. | |
Bipartition (std::initializer_list< uint32_t > const &blocks) | |
Construct a bipartition from an initializer list blocks lookup. | |
Bipartition (std::vector< std::vector< int32_t > > const &blocks) | |
Construct a bipartition from a partition. | |
Bipartition (std::vector< uint32_t > &&blocks) | |
Construct a bipartition from an rvalue reference to blocks lookup. | |
Bipartition (std::vector< uint32_t > const &blocks) | |
Construct a bipartition from a const reference to blocks lookup. | |
uint32_t & | at (size_t i) |
Return a reference to the index of the block containing a value. | |
uint32_t const & | at (size_t i) const |
Return a const reference to the index of the block containing a value. | |
const_iterator | cbegin () const noexcept |
Return a const iterator pointing to the index of the first block. | |
const_iterator | cbegin_left_blocks () const noexcept |
Const iterator pointing to the index of the first left block. | |
lookup_const_iterator | cbegin_lookup () const noexcept |
Return a const iterator pointing to the first transverse block lookup. | |
const_iterator | cbegin_right_blocks () const noexcept |
Const iterator pointing to the index of the first right block. | |
const_iterator | cend () const noexcept |
Return a const iterator pointing one beyond the last index of the last block. | |
const_iterator | cend_left_blocks () const noexcept |
Const iterator pointing one beyond the last index of the last left block. | |
lookup_const_iterator | cend_lookup () const noexcept |
Return a const iterator pointing to the first transverse block lookup. | |
const_iterator | cend_right_blocks () const noexcept |
Const iterator pointing one beyond the last index of the last right block. | |
size_t | degree () const noexcept |
Return the degree of the bipartition. | |
size_t | hash_value () const |
Return a hash value. | |
bool | is_transverse_block (size_t index) const |
Check if a block is a transverse block. | |
bool | is_transverse_block_no_checks (size_t index) const |
Check if a block is a transverse block. | |
Blocks * | left_blocks () const |
Return a pointer to the left blocks of a bipartition. | |
Blocks * | left_blocks_no_checks () const |
Return a pointer to the left blocks of a bipartition. | |
std::vector< bool > const & | lookup () const noexcept |
Return a const reference to the transverse blocks lookup. | |
uint32_t | number_of_blocks () const |
Return the number of blocks in a Bipartition. | |
uint32_t | number_of_left_blocks () const |
Return the number of blocks containing a positive integer. | |
uint32_t | number_of_right_blocks () const |
Return the number of blocks containing a negative integer. | |
bool | operator< (Bipartition const &that) const |
Compare bipartitions for less. | |
Bipartition & | operator= (Bipartition &&) |
Default move assignment operator. | |
Bipartition & | operator= (Bipartition const &) |
Default copy assignment operator. | |
bool | operator== (Bipartition const &that) const |
Compare bipartitions for equality. | |
uint32_t & | operator[] (size_t i) |
Return the index of the block containing a value. | |
uint32_t const & | operator[] (size_t i) const |
Return the index of the block containing a value. | |
void | product_inplace_no_checks (Bipartition const &x, Bipartition const &y, size_t thread_id=0) |
Modify the current bipartition in-place to contain the product of two bipartitions. | |
size_t | rank () const |
Return the number of transverse blocks. | |
Blocks * | right_blocks () const |
Return a pointer to the right blocks of a bipartition. | |
Blocks * | right_blocks_no_checks () const |
Return a pointer to the right blocks of a bipartition. | |
void | set_number_of_blocks (size_t n) noexcept |
Set the number of blocks. | |
void | set_number_of_left_blocks (size_t n) noexcept |
Set the number of left blocks. | |
void | set_rank (size_t n) noexcept |
Set the rank. | |
Static Public Member Functions | |
static Bipartition | one (size_t n) |
Return an identity bipartition of given degree. | |
using const_iterator = std::vector<uint32_t>::const_iterator |
Type for const iterators pointing to the lookup for the blocks of a bipartition.
using iterator = std::vector<uint32_t>::iterator |
Type for iterators pointing to the lookup for the blocks of a bipartition.
using lookup_const_iterator = typename std::vector<bool>::const_iterator |
Type for iterators pointing to the lookup for transverse blocks of a bipartition.
Bipartition | ( | ) |
Constructs an uninitialised bipartition of degree 0
.
|
explicit |
Constructs a bipartition of degree N
that is uninitialised.
N | the degree of the bipartition. |
|
explicit |
The parameter blocks:
blocks
, then \(i - 1\) occurs earlier in blocks
. The value of blocks[i]
should represent the index of the block containing i
.None of these conditions are verified.
For example, if blocks
is {0, 1, 1, 2, 1, 1, 3, 1, 1, 4, 5, 6}
, then the above conditions are satisfied, but if blocks
is {1, 0, 1, 10}
then they are not.
blocks | a lookup for the blocks of the bipartition being constructed. |
|
explicit |
blocks | a lookup for the blocks of the bipartition being constructed. |
Bipartition | ( | std::initializer_list< uint32_t > const & | blocks | ) |
blocks | a lookup for the blocks of the bipartition being constructed. |
Bipartition | ( | std::initializer_list< std::vector< int32_t > > const & | blocks | ) |
The items in blocks
should be:
blocks | the partition. |
|
explicit |
The items in blocks
should be:
blocks | the partition. |
Bipartition | ( | Bipartition const & | ) |
Default copy constructor.
Bipartition | ( | Bipartition && | ) |
Default move constructor.
|
inlinenodiscard |
Returns a reference to the index of the block containing a value.
i | an integer. |
i
.std::out_of_range | if the parameter i is out of range. |
|
inlinenodiscard |
Returns a const reference to the index of the block containing a value.
i | an integer. |
i
.std::out_of_range | if the parameter i is out of range. |
|
inlinenodiscardnoexcept |
Returns a const iterator pointing to the index of the first block.
noexcept
and is guaranteed never to throw.
|
inlinenodiscardnoexcept |
Returns a const iterator pointing to the index of the first left block.
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 |
Returns a const iterator pointing to the index of the first right block.
noexcept
and is guaranteed never to throw.
|
inlinenodiscardnoexcept |
Returns a const iterator pointing one beyond the last index of the last block.
noexcept
and is guaranteed never to throw.
|
inlinenodiscardnoexcept |
Returns a const iterator pointing one beyond the last index of the last left block.
noexcept
and is guaranteed never to throw.
|
inlinenodiscardnoexcept |
|
inlinenodiscardnoexcept |
Returns a const iterator pointing one beyond the last index of the last right block.
noexcept
and is guaranteed never to throw.
|
nodiscardnoexcept |
Returns the degree of the bipartition.
A bipartition is of degree \(n\) if it is a partition of \(\{0, \ldots, 2n - 1\}\).
size_t
.noexcept
and is guaranteed never to throw.
|
inlinenodiscard |
Returns a hash value for a Bipartition object.
size_t
.
|
nodiscard |
A block of a biparition is transverse if it contains integers less than and greater than \(n\), which is the degree of the bipartition.
index | the index of a block. |
LibsemigroupsException | if index is not in the range from 0 to number_of_left_blocks. |
|
nodiscard |
A block of a biparition is transverse if it contains integers less than and greater than \(n\), which is the degree of the bipartition.
index | the index of a block. |
|
nodiscard |
The left blocks of a bipartition is the partition of \(\{0, \ldots, n - 1\}\) induced by the bipartition. This member function returns a Blocks object representing this partition.
LibsemigroupsException | if this is not valid. |
|
nodiscard |
The left blocks of a bipartition is the partition of \(\{0, \ldots, n - 1\}\) induced by the bipartition. This member function returns a Blocks object representing this partition.
|
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.
|
nodiscard |
This function returns the number of parts in the partition that instances of this class represent.
|
nodiscard |
The left blocks of a bipartition is the partition of \(\{0, \ldots, n - 1\}\) induced by the bipartition. This member function returns the number of blocks in this partition.
uint32_t
.
|
nodiscard |
The right blocks of a bipartition is the partition of \(\{n, \ldots, 2n - 1\}\) induced by the bipartition. This member function returns the number of blocks in this partition.
uint32_t
.
|
staticnodiscard |
Returns an identity bipartition of degree n
.
The identity bipartition of degree \(n\) has blocks \(\{i, -i\}\) for all \(i\in \{0, \ldots, n - 1\}\). This member function returns a new identity bipartition of degree equal to n
.
n | the degree of the identity to be returned. |
|
inlinenodiscard |
This operator defines a total order on Bipartition objects. It is ok to compare Bipartition objects of different degrees.
that | the Bipartition for comparison. |
*this
is less than that
.Bipartition & operator= | ( | Bipartition && | ) |
Default move assignment operator.
Bipartition & operator= | ( | Bipartition const & | ) |
Default copy assignment operator.
|
inlinenodiscard |
that | the Bipartition for comparison. |
*this
equals that
.
|
inlinenodiscard |
Returns the index of the block containing a value. No bound checks are performed on the parameter i
.
i | an integer. |
i
.
|
inlinenodiscard |
Returns the index of the block containing a value.
No bound checks are performed on the parameter i
.
i | an integer. |
i
.void product_inplace_no_checks | ( | Bipartition const & | x, |
Bipartition const & | y, | ||
size_t | thread_id = 0 ) |
The parameter thread_id
can be used some temporary storage is required to find the product of x
and y
.
x | the first bipartition to multiply. |
y | the second bipartition to multiply. |
thread_id | the index of the calling thread (defaults to 0 ). |
x.degree()
.thread_id
, then bad things will happen.
|
nodiscard |
The rank of a bipartition is the number of blocks containing both positive and negative values, which are referred to as the transverse blocks.
|
nodiscard |
The right blocks of a bipartition is the partition of \(\{n, \ldots, 2n - 1\}\) induced by the bipartition.
LibsemigroupsException | if this is not valid. |
|
nodiscard |
The right blocks of a bipartition is the partition of \(\{n, \ldots, 2n - 1\}\) induced by the bipartition.
|
noexcept |
This function sets the number of blocks of this
to n
. No checks are performed.
n | the number of blocks. |
noexcept
and is guaranteed never to throw.
|
noexcept |
This function sets the number of left blocks of this
to n
. No checks are performed.
n | the number of blocks. |
noexcept
and is guaranteed never to throw.
|
noexcept |
This function sets the rank
of this
to n
. No checks are performed.
n | the rank. |
noexcept
and is guaranteed never to throw.