A demo of interactive use of libsemigroups

Preconfiguration (only needed if libsemigroups has been installed by conda)

The following hack is currently needed to make sure that dynamic libraries installed in the conda environment are in the library search path.


In [1]:
!echo "#pragma cling add_library_path(\"${CONDA_PREFIX-$CONDA_DIR}/lib\")" > /tmp/conda_library_path

In [2]:
#include "/tmp/conda_library_path"

Loading the libsemigroups library

Now we can include and load the semigroup library as usual:


In [3]:
#pragma cling load("libsemigroups")
#include "libsemigroups/semigroups.h"
using namespace libsemigroups;

Sample computations


In [4]:
std::vector<Element*> gens = {
    new Transformation<u_int16_t>({0, 1, 0}),
    new Transformation<u_int16_t>({0, 1, 2})};

In [5]:
Semigroup S = Semigroup(gens);

In [6]:
S.size()


Out[6]:
2

In [7]:
std::vector<Element*> gensT = {
    new Transformation<u_int16_t>({1, 0, 2, 3, 4, 5}),
    new Transformation<u_int16_t>({1, 2, 3, 4, 5, 0}),
    new Transformation<u_int16_t>({0, 0, 2, 3, 4, 5})};
Semigroup T = Semigroup(gensT);

In [8]:
T.size()


Out[8]:
46656

In [ ]: