Nice process, F4, test program to find representatives of classes of equivalence by generators
This commit is contained in:
parent
bb91e24b8a
commit
1f031db03e
2
Makefile
2
Makefile
@ -1,5 +1,5 @@
|
||||
HEADERS=coxeter.h thickenings.h queue.h
|
||||
OPTIONS=-O3 -g -std=gnu99
|
||||
OPTIONS=-O3 -std=gnu99
|
||||
|
||||
all: generate process test
|
||||
|
||||
|
@ -70,6 +70,14 @@ static void generate_schlaefli_matrix(semisimple_type_t type, gsl_matrix *mat)
|
||||
gsl_matrix_set(mat, offset + i, offset + j, 2.0);
|
||||
else if(i > 0 && j > 0 && (i - j == 1 || i - j == -1) || i == 0 && j == 2 || i == 2 && j == 0)
|
||||
gsl_matrix_set(mat, offset + i, offset + j, -1.0);
|
||||
} else if(type.factors[k].series == 'F') {
|
||||
ERROR(type.factors[k].rank != 4, "A Coxeter group of type %c%d does not exist or is not implemented!\n", type.factors[k].series, type.factors[k].rank);
|
||||
for(int i = 0; i < 4; i++)
|
||||
gsl_matrix_set(mat, offset + i, offset + i, 2.0);
|
||||
for(int i = 0; i < 3; i++) {
|
||||
gsl_matrix_set(mat, offset + i, offset + i + 1, i == 1 ? -sqrt(2.0) : -1.0);
|
||||
gsl_matrix_set(mat, offset + i + 1, offset + i, i == 1 ? -sqrt(2.0) : -1.0);
|
||||
}
|
||||
} else if(type.factors[k].series == 'G') {
|
||||
ERROR(type.factors[k].rank != 2, "A Coxeter group of type %c%d does not exist or is not implemented!\n", type.factors[k].series, type.factors[k].rank);
|
||||
gsl_matrix_set(mat, offset + 0, offset + 0, 2.0);
|
||||
|
49
process.c
49
process.c
@ -51,7 +51,8 @@ int main(int argc, const char *argv[])
|
||||
signed char *level;
|
||||
node_t *graph;
|
||||
int *left, *right;
|
||||
int *left_invariant, *right_invariant;
|
||||
int left_invariant, right_invariant;
|
||||
int left_invariant_wanted = 0, right_invariant_wanted = 0;
|
||||
edgelist_t *edgelists;
|
||||
int *words;
|
||||
|
||||
@ -59,7 +60,7 @@ int main(int argc, const char *argv[])
|
||||
int current;
|
||||
int *seen;
|
||||
int *generators;
|
||||
int ngens, nleft, nright;
|
||||
int ngens;
|
||||
|
||||
char string_buffer1[1000];
|
||||
const char *alphabet = "abcdefghijklmnopqrstuvwxyz";
|
||||
@ -68,9 +69,22 @@ int main(int argc, const char *argv[])
|
||||
|
||||
if(argc < 2)
|
||||
infile = stdin;
|
||||
else {
|
||||
if(strcmp(argv[1], "-") == 0)
|
||||
infile = stdin;
|
||||
else
|
||||
infile = fopen(argv[1], "rb");
|
||||
|
||||
if(argc >= 4) {
|
||||
if(strcmp(argv[2], "-") != 0)
|
||||
for(int i = 0; i < strlen(argv[2]); i++)
|
||||
left_invariant_wanted |= (1 << (argv[2][i] - 'a'));
|
||||
if(strcmp(argv[3], "-") != 0)
|
||||
for(int i = 0; i < strlen(argv[3]); i++)
|
||||
right_invariant_wanted |= (1 << (argv[3][i] - 'a'));
|
||||
}
|
||||
}
|
||||
|
||||
fread(&type.n, sizeof(int), 1, infile); // we completely trust the input data
|
||||
type.factors = malloc(type.n * sizeof(simple_type_t));
|
||||
fread(type.factors, sizeof(simple_type_t), type.n, infile);
|
||||
@ -83,8 +97,6 @@ int main(int argc, const char *argv[])
|
||||
graph = (node_t*)malloc(order*sizeof(node_t));
|
||||
left = (int*)malloc(order*rank*sizeof(int));
|
||||
right = (int*)malloc(order*rank*sizeof(int));
|
||||
left_invariant = (int*)malloc(rank*sizeof(int));
|
||||
right_invariant = (int*)malloc(rank*sizeof(int));
|
||||
seen = (int*)malloc(order*sizeof(int));
|
||||
generators = (int*)malloc(order*sizeof(int));
|
||||
level = (signed char*)malloc(order*sizeof(int));
|
||||
@ -106,29 +118,19 @@ int main(int argc, const char *argv[])
|
||||
continue;
|
||||
*/
|
||||
|
||||
for(int j = 0; j < rank; j++) {
|
||||
left_invariant[j] = 1;
|
||||
right_invariant[j] = 1;
|
||||
}
|
||||
left_invariant = right_invariant = -1; // all 1s
|
||||
for(int j = 0; j < order; j++) {
|
||||
for(int k = 0; k < rank; k++) {
|
||||
if(level[j] > 0 && level[graph[j].left[k]] < 0 || level[j] < 0 && level[graph[j].left[k]] > 0) {
|
||||
left_invariant[k] = 0;
|
||||
left_invariant &= ~(1 << k);
|
||||
}
|
||||
if(level[j] > 0 && level[graph[j].right[k]] < 0 || level[j] < 0 && level[graph[j].right[k]] > 0) {
|
||||
right_invariant[k] = 0;
|
||||
right_invariant &= ~(1 << k);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
nleft = nright = 0;
|
||||
for(int j = 0; j < rank; j ++) {
|
||||
if(left_invariant[j])
|
||||
nleft++;
|
||||
if(right_invariant[j])
|
||||
nright++;
|
||||
}
|
||||
|
||||
if((~left_invariant & left_invariant_wanted) == 0 && (~right_invariant & right_invariant_wanted) == 0) {
|
||||
ngens = 0;
|
||||
memset(generators, 0, order*sizeof(int));
|
||||
for(int j = 0; j < order; j++) {
|
||||
@ -140,9 +142,9 @@ int main(int argc, const char *argv[])
|
||||
if(generators[current] == 0) { // visit everyone only once
|
||||
generators[current] = ngens;
|
||||
for(int k = 0; k < rank; k++) {
|
||||
if(left_invariant[k])
|
||||
if(left_invariant & (1 << k))
|
||||
queue_put(&queue, graph[current].left[k]);
|
||||
if(right_invariant[k])
|
||||
if(right_invariant & (1 << k))
|
||||
queue_put(&queue, graph[current].right[k]);
|
||||
}
|
||||
}
|
||||
@ -150,13 +152,12 @@ int main(int argc, const char *argv[])
|
||||
}
|
||||
}
|
||||
|
||||
if(nleft >= 2 && nright >= 2) {
|
||||
printf("left: ");
|
||||
for(int j = 0; j < rank; j++)
|
||||
printf("%c", left_invariant[j] ? alphabet[j] : ' ');
|
||||
printf("%c", left_invariant & (1 << j) ? alphabet[j] : ' ');
|
||||
printf(" right: ");
|
||||
for(int j = 0; j < rank; j++)
|
||||
printf("%c", right_invariant[j] ? alphabet[j] : ' ');
|
||||
printf("%c", right_invariant & (1 << j) ? alphabet[j] : ' ');
|
||||
printf(" generators: ");
|
||||
|
||||
memset(seen, 0, order*sizeof(int));
|
||||
@ -190,8 +191,6 @@ int main(int argc, const char *argv[])
|
||||
free(graph);
|
||||
free(left);
|
||||
free(right);
|
||||
free(right_invariant);
|
||||
free(left_invariant);
|
||||
free(seen);
|
||||
free(generators);
|
||||
free(type.factors);
|
||||
|
29
test.c
29
test.c
@ -3,6 +3,28 @@
|
||||
#include "thickenings.h"
|
||||
#include "queue.h"
|
||||
|
||||
#define SWAP(t, a, b) do {t tmp = a; a = b; b = tmp;} while(0)
|
||||
|
||||
char *stringify_Sp2n_permutation(int *word, int wordlength, int rank, int len, char *str)
|
||||
{
|
||||
for(int i = 0; i < rank*2; i++)
|
||||
str[i] = '1' + i;
|
||||
str[2*rank] = 0;
|
||||
|
||||
for(int i = 0; i < wordlength; i++) {
|
||||
if(word[i] == 0)
|
||||
SWAP(char, str[rank-1], str[2*rank-1]);
|
||||
else {
|
||||
SWAP(char, str[rank-word[i]], str[rank-word[i]-1]);
|
||||
SWAP(char, str[2*rank-word[i]], str[2*rank-word[i]-1]);
|
||||
}
|
||||
}
|
||||
|
||||
str[len] = 0;
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
int main(int argc, const char *argv[])
|
||||
{
|
||||
semisimple_type_t type;
|
||||
@ -17,13 +39,13 @@ int main(int argc, const char *argv[])
|
||||
char alphabet[] = "abcdefghijklmnopqrstuvwxyz";
|
||||
char buffer[1024];
|
||||
|
||||
int left = ~0x01; // 1111 1110
|
||||
int right = ~0x01; // 1111 1101
|
||||
int left = ~(1 << (atoi(argv[1]) - atoi(argv[3])));
|
||||
int right = ~(1 << (atoi(argv[1]) - atoi(argv[2])));
|
||||
|
||||
type.n = 1;
|
||||
type.factors = (simple_type_t*)malloc(type.n*sizeof(simple_type_t));
|
||||
type.factors[0].series = 'B';
|
||||
type.factors[0].rank = 4;
|
||||
type.factors[0].rank = atoi(argv[1]);
|
||||
|
||||
rank = coxeter_rank(type);
|
||||
order = coxeter_order(type);
|
||||
@ -80,6 +102,7 @@ int main(int argc, const char *argv[])
|
||||
printf("1 ");
|
||||
else
|
||||
printf("%s ", alphabetize(graph[i].word, graph[i].wordlength, alphabet, buffer));
|
||||
// printf("%s ", stringify_Sp2n_permutation(graph[i].word, graph[i].wordlength, rank, atoi(argv[2]), buffer));
|
||||
}
|
||||
|
||||
printf("\n");
|
||||
|
@ -375,9 +375,9 @@ void enumerate_balanced_thickenings(semisimple_type_t type, node_t *graph, const
|
||||
|
||||
if(is_fat) {
|
||||
// ERROR(count >= MAX_THICKENINGS, "Too many balanced thickenings! Increase MAX_THICKENINGS\n");
|
||||
if(count % 10000000 == 0)
|
||||
print_thickening(rank, order, level, 0, 0, 0, alphabet, stderr);
|
||||
// fwrite(level, sizeof(signed char), order, outfile);
|
||||
//if(count % 10000000 == 0)
|
||||
//print_thickening(rank, order, level, 0, 0, 0, alphabet, stderr);
|
||||
fwrite(level, sizeof(signed char), order, outfile);
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user