From 69d975bac9c15720ef914000d72690613e280a5c Mon Sep 17 00:00:00 2001 From: Florian Stecker Date: Thu, 3 Jan 2019 20:15:36 +0100 Subject: [PATCH] dominant weights --- Makefile | 10 +++++-- dominant_weights.c | 69 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 77 insertions(+), 2 deletions(-) create mode 100644 dominant_weights.c diff --git a/Makefile b/Makefile index f31c3c8..53912fa 100644 --- a/Makefile +++ b/Makefile @@ -7,7 +7,7 @@ SPECIAL_OPTIONS=-O3 -flto -funroll-loops -Winline OPTIONS=-m64 -march=native -mtune=native -std=gnu99 -D_GNU_SOURCE $(SPECIAL_OPTIONS) NAME=enumerate-balanced-ideals -all: enumerate graph D2n +all: enumerate graph D2n dominant_weights $(NAME).tar.bz2: $(NAME) $(HEADERS) enumerate.c weyl.c thickenings.c tar cjhf $(NAME).tar.bz2 $(NAME)/enumerate.c $(NAME)/weyl.c $(NAME)/thickenings.c $(NAME)/weyl.h $(NAME)/thickenings.h $(NAME)/queue.h $(NAME)/bitvec.h $(NAME)/Makefile $(NAME)/graph.c @@ -24,6 +24,9 @@ graph: graph.o weyl.o D2n: D2n.o weyl.o thickenings.o gcc $(OPTIONS) -o D2n D2n.o weyl.o thickenings.o +dominant_weights: dominant_weights.o weyl.o + gcc $(OPTIONS) -o dominant_weights dominant_weights.o weyl.o + enumerate.o: enumerate.c $(HEADERS) gcc $(OPTIONS) -c enumerate.c @@ -39,5 +42,8 @@ weyl.o: weyl.c $(HEADERS) graph.o: graph.c $(HEADERS) gcc $(OPTIONS) -c graph.c +dominant_weights.o: dominant_weights.c $(HEADERS) + gcc $(OPTIONS) -c dominant_weights.c + clean: - rm -f enumerate graph D2n thickenings.o weyl.o enumerate.o graph.o D2n.o $(NAME) $(NAME).tar.bz2 + rm -f enumerate graph D2n dominant_weights thickenings.o weyl.o enumerate.o graph.o D2n.o dominant_weights.o $(NAME) $(NAME).tar.bz2 diff --git a/dominant_weights.c b/dominant_weights.c new file mode 100644 index 0000000..f94ee46 --- /dev/null +++ b/dominant_weights.c @@ -0,0 +1,69 @@ +#include +#include +#include + +#include "weyl.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; +} + +static int apply_reflection(double *in, double *out, int rank, int reflection) +{ + memcpy(out, in, rank*sizeof(double)); + out[reflection] *= -1; + if(reflection != 0) + out[reflection-1] += in[reflection]; + if(reflection != rank-1) + out[reflection+1] += in[reflection]; +} + +int main(int argc, char *argv[]) +{ + semisimple_type_t type; + simple_type_t simple; + doublequotient_t *dq; + double *vector; + char buf[1000]; + + type.n = 1; + type.factors = &simple; + simple.series = 'A'; + simple.rank = 3; + + dq = weyl_generate_bruhat(type, 0, 0); + + int order = weyl_order(type); + int rank = weyl_rank(type); + weylgroup_element_t *group = dq->group; + vector = malloc(weyl_order(type)*weyl_rank(type)*sizeof(double)); + + for(int i = 0; i < rank; i++) { + vector[i] = 1.0; + } + + for(int i = 0; i < order; i++) { + printf("%s %.2f %.2f %.2f\n", alphabetize(&group[i], buf), + 1.0/4.0*(3*vector[3*i] + 2*vector[3*i+1] + 1*vector[3*i+2]), + 1.0/4.0*(2*vector[3*i] + 4*vector[3*i+1] + 2*vector[3*i+2]), + 1.0/4.0*(1*vector[3*i] + 2*vector[3*i+1] + 3*vector[3*i+2])); + + for(int j = 0; j < rank; j++) + if(group[i].left[j]->wordlength > group[i].wordlength) + apply_reflection(&vector[3*i], &vector[3*group[i].left[j]->index], rank, j); + } + + weyl_destroy_bruhat(dq); + free(vector); + + return 0; +}