libsemigroups
Public Member Functions | List of all members
libsemigroups::Blocks Class Reference

Class for signed partitions of the set \(\{0, \ldots, n - 1\}\). More...

#include <blocks.h>

Public Member Functions

 Blocks ()
 A constructor. More...
 
 Blocks (std::vector< u_int32_t > *blocks, std::vector< bool > *lookup)
 A constructor. More...
 
 Blocks (std::vector< u_int32_t > *blocks, std::vector< bool > *lookup, u_int32_t nr_blocks)
 A constructor. More...
 
 Blocks (Blocks const &copy)
 Copy constructor. More...
 
 ~Blocks ()
 Default destructor. More...
 
u_int32_t block (size_t pos) const
 Returns the index of the block containing pos. More...
 
std::vector< u_int32_t >::const_iterator cbegin () const
 Returns a const_iterator pointing to the index of the first block. More...
 
std::vector< u_int32_t >::const_iterator cend () const
 Returns a const_iterator referring to past-the-end of the last block. More...
 
u_int32_t degree () const
 Returns the degree of a Blocks object. More...
 
size_t hash_value () const
 Returns a hash value for a this. More...
 
bool is_transverse_block (size_t index) const
 Returns true if the block with index index is transverse. More...
 
std::vector< bool > const * lookup () const
 Returns a pointer to the lookup table for block indices. More...
 
u_int32_t nr_blocks () const
 Returns the number of blocks in the Blocks object. More...
 
bool operator< (const Blocks &that) const
 Returns true if this is less than that. More...
 
Blocksoperator= (Blocks const &copy)=delete
 The assignment operator is deleted for Blocks to avoid unintended copying. More...
 
bool operator== (const Blocks &that) const
 Returns true if this equals that. More...
 
u_int32_t rank ()
 Returns the number of signed (transverse) blocks in this. More...
 

Detailed Description

Class for signed partitions of the set \(\{0, \ldots, n - 1\}\).

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 by any of the methods for the Semigroup class but the extra methods are used in the GAP package Semigroups package for GAP.

Constructor & Destructor Documentation

§ Blocks() [1/4]

libsemigroups::Blocks::Blocks ( )
inline

A constructor.

Constructs a blocks object of size 0.

§ Blocks() [2/4]

libsemigroups::Blocks::Blocks ( std::vector< u_int32_t > *  blocks,
std::vector< bool > *  lookup 
)
inline

A constructor.

The parameter blocks must be non-empty, consist of non-negative integers, and have the property that if some positive \(i\) occurs in blocks, then \(i - 1\) occurs earlier in blocks. None of this is checked. The parameter blocks is not copied, and is deleted by the destructor Blocks::~Blocks.

The parameter lookup must have length equal to the number of different values in blocks (or one more than the maximum value in the list); this is equal to the number of blocks in the partition. A value true in position \(i\) indicates that the \(i\)th block is signed (transverse) and false that it is unsigned.

§ Blocks() [3/4]

libsemigroups::Blocks::Blocks ( std::vector< u_int32_t > *  blocks,
std::vector< bool > *  lookup,
u_int32_t  nr_blocks 
)
inline

A constructor.

The parameter blocks must have length \(n\) for some integer \(n > 0\), consist of non-negative integers, and have the property that if \(i\), \(i > 0\) occurs in blocks, then \(i - 1\) occurs earlier in blocks. None of this is checked. The parameter blocks is not copied, and is deleted by the destructor Blocks::~Blocks.

The parameter lookup must have length equal to the number of different values in blocks (or one more than the maximum value in the list); this is equal to the number of blocks in the partition. A value true in position \(i\) indicates that the \(i\)th block is signed (transverse) and false that it is unsigned.

The parameter nr_blocks must be the number of blocks (i.e. one more than the maximum value in blocks).

This constructor is provided for the situation where the number of blocks in blocks is known a priori and so does not need to be calculated in the constructor.

§ Blocks() [4/4]

libsemigroups::Blocks::Blocks ( Blocks const &  copy)

Copy constructor.

Copies all the information in copy and returns a new instance of Blocks.

§ ~Blocks()

libsemigroups::Blocks::~Blocks ( )
inline

Default destructor.

Deletes the blocks and lookup provided at construction time.

Member Function Documentation

§ block()

u_int32_t libsemigroups::Blocks::block ( size_t  pos) const
inline

Returns the index of the block containing pos.

This method asserts that pos is valid, i.e. that it is less than the degree of this.

§ cbegin()

std::vector<u_int32_t>::const_iterator libsemigroups::Blocks::cbegin ( ) const
inline

Returns a const_iterator pointing to the index of the first block.

This method asserts that degree is not 0.

§ cend()

std::vector<u_int32_t>::const_iterator libsemigroups::Blocks::cend ( ) const
inline

Returns a const_iterator referring to past-the-end of the last block.

This method asserts that degree is not 0.

§ degree()

u_int32_t libsemigroups::Blocks::degree ( ) const
inline

Returns the degree of a Blocks object.

The degree of a Blocks object is the size of the set of which it is a partition.

§ hash_value()

size_t libsemigroups::Blocks::hash_value ( ) const

Returns a hash value for a this.

This method returns a hash value for an instance of Blocks. This value is recomputed every time this method is called.

§ is_transverse_block()

bool libsemigroups::Blocks::is_transverse_block ( size_t  index) const
inline

Returns true if the block with index index is transverse.

This method 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). This method asserts that the parameter index is valid, i.e. that it is less than the degree of this.

§ lookup()

std::vector<bool> const* libsemigroups::Blocks::lookup ( ) const
inline

Returns a pointer to the lookup table for block indices.

The vector pointed to by the return value of this method has value true in position i if the i th block of this is a transverse block; the entry in position i is false otherwise.

§ nr_blocks()

u_int32_t libsemigroups::Blocks::nr_blocks ( ) const
inline

Returns the number of blocks in the Blocks object.

This method returns the number of parts in the partition that instances of this class represent.

§ operator<()

bool libsemigroups::Blocks::operator< ( const Blocks that) const

Returns true if this is less than that.

This operator defines a total order on the set of all Blocks objects (including those of different degree).

§ operator=()

Blocks& libsemigroups::Blocks::operator= ( Blocks const &  copy)
delete

The assignment operator is deleted for Blocks to avoid unintended copying.

§ operator==()

bool libsemigroups::Blocks::operator== ( const Blocks that) const

Returns true if this equals that.

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.

§ rank()

u_int32_t libsemigroups::Blocks::rank ( )

Returns the number of signed (transverse) blocks in this.

Equivalently, this method returns the number of true values in Blocks::lookup().


The documentation for this class was generated from the following files: