Skip to content

Instantly share code, notes, and snippets.

Avatar

James Mitchell james-d-mitchell

View GitHub Profile
@james-d-mitchell
james-d-mitchell / todd_coxeter.py
Last active Aug 9, 2021
An implementation of the Todd-Coxeter Algorithm for Semigroups and Monoids in python3
View todd_coxeter.py
#!/usr/bin/env python3
class ToddCoxeter:
def __init__(self):
self.nodes = [0]
self.edges = None
self.kappa = []
self.next_node = 1
self.R = []
@james-d-mitchell
james-d-mitchell / install-libsemigroups.sh
Created Oct 18, 2019
Installation script for libsemigroups
View install-libsemigroups.sh
#!/bin/bash
set -e
git clone https://github.com/libsemigroups/libsemigroups
cd libsemigroups/extern
curl -L -O https://github.com/fmtlib/fmt/releases/download/5.3.0/fmt-5.3.0.zip
tar -xzf fmt-5.3.0.zip && rm -f fmt-5.3.0.zip
curl -L -O https://github.com/hivert/HPCombi/archive/v0.0.3.zip
tar -xzf v0.0.3.zip && rm -f v0.0.3.zip && mv v0.0.3.zip HPCombi && cd ..
View homogeneous-rees-mat.g
# In GAP 4.9.1 or higher, with the Semigroups package 3.0.16 or higher
LoadPackage("semigroups");
# A function for finding all the subsemigroups of a semigroup
# (this will only work for extremely small semigroups, due it being a quick implementation, and due to the inherent complexity)
Subsemigroups := function(S)
local foo, M, N;
foo := function(M)
return Unique(Concatenation(List(M, MaximalSubsemigroups)));
View gaplint.vim
"============================================================================
"File: gaplint.vim
"Description: Syntax checking plugin for syntastic.vim
"Maintainer: jdm3@st-andrews.ac.uk
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"
@james-d-mitchell
james-d-mitchell / gist:a5912d15aedf8eddc0aadb52989bbf53
Created May 8, 2017
GAP code for computing the number of monogenic transformation semigroups of a given degree
View gist:a5912d15aedf8eddc0aadb52989bbf53
# Sieve of Eratosthenes based on code from
# https://en.wikipedia.org/wiki/Sieve_of_Eratosthenes#Pseudocode
MyPrimes := function(n)
local A, limit, j, i;
A := BlistList([1 .. n], [2 .. n]);
limit := Int(Sqrt(Float(n)));
for i in [1 .. limit] do
if A[i] then