draw bruhat graph
This commit is contained in:
parent
a12f845f05
commit
16125bd8a8
10
Makefile
10
Makefile
@ -6,7 +6,7 @@ SPECIAL_OPTIONS=-O3 -flto -funroll-loops -Winline
|
||||
|
||||
OPTIONS=-m64 -march=native -mtune=native -std=gnu99 -D_GNU_SOURCE $(SPECIAL_OPTIONS)
|
||||
|
||||
all: enumerate idealbounds
|
||||
all: enumerate idealbounds graph
|
||||
|
||||
enumerate: enumerate.o weyl.o thickenings.o
|
||||
gcc $(OPTIONS) -o enumerate enumerate.o thickenings.o weyl.o
|
||||
@ -14,6 +14,9 @@ enumerate: enumerate.o weyl.o thickenings.o
|
||||
idealbounds: idealbounds.o weyl.o
|
||||
gcc $(OPTIONS) -o idealbounds idealbounds.o weyl.o
|
||||
|
||||
graph: graph.o weyl.o
|
||||
gcc $(OPTIONS) -o graph graph.o weyl.o
|
||||
|
||||
enumerate.o: enumerate.c $(HEADERS)
|
||||
gcc $(OPTIONS) -c enumerate.c
|
||||
|
||||
@ -26,5 +29,8 @@ weyl.o: weyl.c $(HEADERS)
|
||||
idealbounds.o: idealbounds.c $(HEADERS)
|
||||
gcc $(OPTIONS) -c idealbounds.c
|
||||
|
||||
graph.o: graph.c $(HEADERS)
|
||||
gcc $(OPTIONS) -c graph.c
|
||||
|
||||
clean:
|
||||
rm -f enumerate idealbounds thickenings.o weyl.o enumerate.o idealbounds.o
|
||||
rm -f enumerate idealbounds graph thickenings.o weyl.o enumerate.o idealbounds.o graph.o
|
||||
|
72
graph.c
Normal file
72
graph.c
Normal file
@ -0,0 +1,72 @@
|
||||
#include "weyl.h"
|
||||
#include "queue.h"
|
||||
|
||||
#include <strings.h>
|
||||
#include <stdio.h>
|
||||
#include <memory.h>
|
||||
|
||||
static char* alphabetize(weylgroup_element_t *e, char *str)
|
||||
{
|
||||
if(e->wordlength == 0)
|
||||
sprintf(str, "1");
|
||||
else {
|
||||
for(int j = 0; j < e->wordlength; j++)
|
||||
str[j] = e->word[j] + 'a';
|
||||
str[e->wordlength] = 0;
|
||||
}
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
int main(int argc, const char *argv[])
|
||||
{
|
||||
semisimple_type_t type;
|
||||
unsigned long right_invariance, left_invariance;
|
||||
doublequotient_t *dq;
|
||||
const char *alphabet = "abcdefghijklmnopqrstuvwxyz";
|
||||
char stringbuffer[100];
|
||||
char stringbuffer2[100];
|
||||
|
||||
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] > 'G')
|
||||
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] > 'G' || argv[i+1][1] < '1' || argv[i+1][1] > '9', "Arguments must be Xn with X out of A-G and n out of 1-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'));
|
||||
}
|
||||
|
||||
// generate graph
|
||||
|
||||
dq = weyl_generate_bruhat(type, left_invariance, right_invariance);
|
||||
|
||||
fprintf(stdout, "digraph test123 {\n");
|
||||
for(int i = 0; i < dq->count; i++)
|
||||
for(doublecoset_list_t *current = dq->cosets[i].bruhat_lower; current; current = current->next)
|
||||
fprintf(stdout, "%s -> %s;\n",
|
||||
alphabetize(dq->cosets[i].min, stringbuffer),
|
||||
alphabetize(current->to->min, stringbuffer2));
|
||||
fprintf(stdout, "}\n\n");
|
||||
|
||||
// clean up
|
||||
weyl_destroy_bruhat(dq);
|
||||
free(type.factors);
|
||||
}
|
Loading…
Reference in New Issue
Block a user