#include #include #include "coxeter.h" #include "queue.h" #include "thickenings.h" int main(int argc, const char *argv[]) { semisimple_type_t type; // heap stuff node_t *graph; int *left, *right; edgelist_t *edgelists; int *words; int rank, order; char string_buffer1[1000]; const char *alphabet = "abcdefghijklmnopqrstuvwxyz"; ERROR(argc < 2, "Too few arguments!\n"); type.n = argc - 1; type.factors = (simple_type_t*)malloc((argc-1)*sizeof(simple_type_t)); for(int i = 0; i < argc - 1; i++) { type.factors[i].series = argv[i+1][0]; type.factors[i].rank = argv[i+1][1] - '0'; ERROR(argv[i+1][0] < 'A' || argv[i+1][0] > 'I' || argv[i+1][1] < '1' || argv[i+1][1] > '9', "Arguments must be Xn with X out of A-I and n out of 0-9\n"); } rank = coxeter_rank(type); order = coxeter_order(type); ERROR(strlen(alphabet) < rank, "The alphabet has too few letters\n"); // initialize graph = (node_t*)malloc(order*sizeof(node_t)); left = (int*)malloc(order*rank*sizeof(int)); right = (int*)malloc(order*rank*sizeof(int)); for(int i = 0; i < order; i++) { graph[i].left = &left[rank*i]; graph[i].right = &right[rank*i]; } // generate graph prepare_graph(type, graph, &edgelists, &words); // print stuff int hyperplane_count = coxeter_hyperplanes(type); fprintf(stderr, "Rank: %d\t\tOrder: %d\t\tHyperplanes: %d\n", rank, order, hyperplane_count); fprintf(stderr, "\n"); fprintf(stderr, "Group elements: \n"); for(int i = 0, wl = 0; i < order; i++) { if(i == 0) { fprintf(stderr, "1"); } else if(graph[i].wordlength > wl) { fprintf(stderr, "\n%s ", alphabetize(graph[i].word, graph[i].wordlength, alphabet, string_buffer1)); wl = graph[i].wordlength; } else fprintf(stderr, "%s ", alphabetize(graph[i].word, graph[i].wordlength, alphabet, string_buffer1)); } fprintf(stderr, "\n\n"); // enumerate balanced thickenings fwrite(&type.n, sizeof(int), 1, stdout); fwrite(type.factors, sizeof(simple_type_t), type.n, stdout); long count = enumerate_balanced_thickenings(type, graph, alphabet, stdout); fprintf(stderr, "\n"); fprintf(stderr, "Found %ld balanced thickenings\n\n", count); free(graph); free(left); free(right); free(edgelists); free(words); free(type.factors); return 0; }