# Member functions¶

This page contains information about the member functions of the Sims1 class template.

inline iterator libsemigroups::Sims1::cbegin(size_type n) const

Returns a forward iterator pointing at the first congruence.

Returns a forward iterator pointing to the ActionDigraph representing the first congruence described by Sims1 object with at most n classes.

If incremented, the iterator will point to the next such congruence. The order which the congruences are returned in is implementation specific. Iterators of the type returned by this function are equal whenever they point to equal objects. The iterator is exhausted if and only if it points to an ActionDigraph with zero nodes.

The meaning of the ActionDigraph pointed at by Sims1 iterators depends on whether the input is a monoid presentation (i.e. Presentation::contains_empty_word() returns true) or a semigroup presentation. If the input is a monoid presentation for a monoid $$M$$, then the ActionDigraph pointed to by an iterator of this type has precisely n nodes, and the right action of $$M$$ on the nodes of the digraph is isomorphic to the action of $$M$$ on the classes of a right congruence.

If the input is a semigroup presentation for a semigroup $$S$$, then the ActionDigraph has n + 1 nodes, and the right action of $$S$$ on the nodes $$\{1, \ldots, n\}$$ of the ActionDigraph is isomorphic to the action of $$S$$ on the classes of a right congruence. It’d probably be better in this case if node $$0$$ was not included in the output ActionDigraph, but it is required in the implementation of the low-index congruence algorithm, and to avoid unnecessary copies, we’ve left it in for the time being.

Warning

Copying iterators of this type is expensive. As a consequence, prefix incrementing ++it the returned iterator it significantly cheaper than postfix incrementing it++.

Parameters

n – the maximum number of classes in a congruence.

Throws
Returns

An iterator it of type iterator pointing to an ActionDigraph with at most n nodes.

inline iterator libsemigroups::Sims1::cend(size_type n) const

Returns a forward iterator pointing one beyond the last congruence.

Returns a forward iterator pointing to the empty ActionDigraph. If incremented, the returned iterator remains valid and continues to point at the empty ActionDigraph.

Warning

Copying iterators of this type is expensive. As a consequence, prefix incrementing ++it the returned iterator it significantly cheaper than postfix incrementing it++.

Parameters

n – the maximum number of classes in a congruence.

Throws
Returns

An iterator it of type iterator pointing to an ActionDigraph with at most 0 nodes.

digraph_type libsemigroups::Sims1::find_if(size_type n, std::function<bool(digraph_type const&)> pred) const

Apply the function pred to every one-sided congruence with at most n classes, until it returns true.

This function is similar to std::find_if(begin(n), end(n), pred) and exists to:

• provide some feedback on the progress of the computation if it runs for more than 1 second.

• allow for the computation of std::find_if(begin(n), end(n), pred) to be performed using number_of_threads in parallel.

Parameters
• n – the maximum number of congruence classes.

• pred – the predicate applied to every congruence found.

Throws
Returns

The first congruence whose ActionDigraph for which pred returns true.

void libsemigroups::Sims1::for_each(size_type n, std::function<void(digraph_type const&)> pred) const

Apply the function pred to every one-sided congruence with at most n classes.

This function is similar to std::for_each(begin(n), end(n), pred) and exists to:

• provide some feedback on the progress of the computation if it runs for more than 1 second.

• allow for the computation of std::for_each(begin(n), end(n), pred) to be performed using number_of_threads in parallel.

Parameters
• n – the maximum number of congruence classes.

• pred – the predicate applied to every congruence found.

Throws
Returns

(None)

uint64_t libsemigroups::Sims1::number_of_congruences(size_type n) const

Returns the number of one-sided congruences with up to a given number of classes.

This function is similar to std::distance(begin(n), end(n)) and exists to:

• provide some feedback on the progress of the computation if it runs for more than 1 second.

• allow for the computation of std::distance(begin(n), end(n)) to be performed using number_of_threads in parallel.

Parameters

n – the maximum number of congruence classes.

Throws
Returns

A value of type uint64_t.