94 lines
3.0 KiB
C
94 lines
3.0 KiB
C
#include <string.h>
|
|
#include <stdio.h>
|
|
|
|
#include "coxeter.h"
|
|
#include "queue.h"
|
|
#include "thickenings.h"
|
|
|
|
int main(int argc, const char *argv[])
|
|
{
|
|
semisimple_type_t type;
|
|
unsigned long right_invariance, left_invariance;
|
|
int rank, order, hyperplanes, cosets;
|
|
|
|
node_t *graph;
|
|
|
|
char string_buffer1[1000];
|
|
const char *alphabet = "abcdefghijklmnopqrstuvwxyz";
|
|
|
|
// read arguments
|
|
|
|
ERROR(argc < 2, "Too few arguments!\n");
|
|
|
|
type.n = 0;
|
|
for(int i = 0; i < argc - 1; i++) {
|
|
if(argv[i+1][0] < 'A' || argv[i+1][0] > 'I')
|
|
break;
|
|
type.n++;
|
|
}
|
|
|
|
type.factors = (simple_type_t*)malloc(type.n*sizeof(simple_type_t));
|
|
for(int i = 0; i < type.n; 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");
|
|
}
|
|
|
|
left_invariance = right_invariance = 0;
|
|
|
|
if(argc - type.n >= 3) {
|
|
if(strcmp(argv[type.n + 1], "-") != 0)
|
|
for(int i = 0; i < strlen(argv[type.n + 1]); i++)
|
|
left_invariance |= (1 << (argv[type.n + 1][i] - 'a'));
|
|
if(strcmp(argv[type.n + 2], "-") != 0)
|
|
for(int i = 0; i < strlen(argv[type.n + 2]); i++)
|
|
right_invariance |= (1 << (argv[type.n + 2][i] - 'a'));
|
|
}
|
|
|
|
ERROR(strlen(alphabet) < rank, "The alphabet has too few letters\n");
|
|
|
|
// generate graph
|
|
|
|
graph = graph_alloc(type);
|
|
cosets = prepare_simplified_graph(type, left_invariance, right_invariance, graph);
|
|
|
|
ERROR(cosets < 0, "The left invariance is not preserved by the opposition involution: %d %d!\n", left_invariance, opposition_involution(type, left_invariance));
|
|
|
|
// print stuff
|
|
|
|
rank = coxeter_rank(type); // number of simple roots
|
|
order = coxeter_order(type); // number of Weyl group elements
|
|
hyperplanes = coxeter_hyperplanes(type); // number of positive roots
|
|
|
|
fprintf(stderr, "Rank: %d\tOrder: %d\tPositive Roots: %d\tCosets: %d\n", rank, order, hyperplanes, cosets);
|
|
fprintf(stderr, "\n");
|
|
fprintf(stderr, "Shortest coset representatives: \n");
|
|
for(int i = 0, wl = 0; i < cosets; 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);
|
|
fwrite(&left_invariance, sizeof(unsigned long), type.n, stdout);
|
|
fwrite(&right_invariance, sizeof(unsigned long), type.n, stdout);
|
|
|
|
long count = enumerate_balanced_thickenings(type, graph, cosets, alphabet, stdout);
|
|
|
|
fprintf(stderr, "\n");
|
|
fprintf(stderr, "Found %ld balanced thickenings\n\n", count);
|
|
|
|
graph_free(type, graph);
|
|
free(type.factors);
|
|
|
|
return 0;
|
|
}
|