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

This namespace contains helper functions for the Blocks class.

Functions

void throw_if_invalid (Blocks const &x)
 Check a Blocks object.
 
std::vector< std::vector< int32_t > > underlying_partition (Blocks const &x)
 Return the underlying partition of a Blocks object.
 

Function Documentation

◆ throw_if_invalid()

void throw_if_invalid ( Blocks const & x)

This function checks a Blocks object, and throws an exception if the object does not:

  • consist of non-negative integers; and
  • have the property that if \(i\), \(i > 0\) occurs in x, then \(i - 1\) occurs earlier in x.

The value of x[i] should represent the index of the block containing i.

For example, if x is {0, 1, 1, 2, 1, 1, 3, 1, 1, 4, 5, 6}, then the above conditions are satisfied, but if x is {1, 0, 1, 10} then they are not.

Parameters
xthe blocks object to check.
Exceptions
LibsemigroupsExceptionif x is invalid.

◆ underlying_partition()

std::vector< std::vector< int32_t > > underlying_partition ( Blocks const & x)
nodiscard

The underlying partition of a Blocks object x is the partition of a subset \(P\) of \(\{-n, \ldots, -1\}\cup \{1, \ldots, n\}\) such that:

  • \(\{|x|\mid x\in P\} = \{1, \ldots, n\}\);
  • a block of the partition consists of negative numbers if and only if the corresponding block of x is a transverse block.
Parameters
xthe Blocks object.
Returns
A vector of vectors of integers.
Exceptions
This function guarantees not to throw a LibsemigroupsException.
Complexity
\(O(n)\) where \(n\) is the degree().