enumerate-balanced-ideals/dominant_weights.c

70 lines
1.6 KiB
C
Raw Normal View History

2019-01-03 19:15:36 +00:00
#include <stdio.h>
#include <string.h>
#include <malloc.h>
#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;
}