The to function

This page contains links to the documentation of the uses of the function to for converting from one type of object in libsemigroups_pybind11 to another type. These mostly only apply to the types implementing the main algorithms in libsemigroups_pybind11.

For example, to convert a ToddCoxeter object tc to a FroidurePin object, you can simply do to(tc, rtype=(FroidurePin,)).

A summary of the possible conversions available in libsemigroups_pybind11 of to(FromType, rtype=(ToType,)) are given below, where the rows correspond to ToType and the columns to FromType:

A table containing the possible conversions of libsemigroups_pybind11 types.

A tick indicates that this conversion is implemented, and a cross that it is not yet implemented.

Full API

to(*args, rtype)

Convert from one type of libsemigroups object to another

This function converts the the arguments specified in args to object of type rtype.

Parameters:
  • args – the objects to convert.

  • rtype – the type of object to convert to.

Returns:

an object of type rtype.

See also

See the following pages for a detailed description of the various use cases of this function:

>>> from libsemigroups_pybind11 import (
...     congruence_kind,
...     FroidurePin,
...     KnuthBendix,
...     Presentation,
...     presentation,
...     to,
... )

>>> p = Presentation([0, 1])
>>> presentation.add_rule(p, [0, 1], [1, 0])
>>> presentation.add_rule(p, [0, 0], [0])
>>> presentation.add_rule(p, [1, 1], [1])
>>> kb = KnuthBendix(congruence_kind.twosided, p)
>>> fp = to(kb, rtype=(FroidurePin,))
>>> fp
<partially enumerated FroidurePin with 2 generators, 2 elements,
 Cayley graph ⌀ 1, & 0 rules>

>>> fp.run()
>>> fp
<fully enumerated FroidurePin with 2 generators, 3 elements, Cayley graph ⌀ 2, & 3 rules>