New Weyl group algorithm
This commit is contained in:
@@ -5,10 +5,9 @@
|
||||
#include <memory.h>
|
||||
|
||||
#include "thickenings.h"
|
||||
#include "coxeter.h"
|
||||
#include "weyl.h"
|
||||
#include "queue.h"
|
||||
|
||||
|
||||
char *alphabetize(int *word, int len, const char *alphabet, char *buffer)
|
||||
{
|
||||
if(len == 0) {
|
||||
@@ -66,20 +65,20 @@ void prepare_graph(semisimple_type_t type, node_t *graph)
|
||||
int edgelist_count, hyperplane_count;
|
||||
int current;
|
||||
|
||||
int *graph_data;
|
||||
weylgroup_element_t *graph_data;
|
||||
node_t *graph_unsorted;
|
||||
int *ordering, *reverse_ordering, *seen;
|
||||
|
||||
// initialize
|
||||
|
||||
rank = coxeter_rank(type);
|
||||
order = coxeter_order(type);
|
||||
hyperplanes = coxeter_hyperplanes(type);
|
||||
rank = weyl_rank(type);
|
||||
order = weyl_order(type);
|
||||
hyperplanes = weyl_hyperplanes(type);
|
||||
|
||||
edgelists_higher = graph[0].bruhat_higher;
|
||||
edgelists_lower = &graph[0].bruhat_higher[order*hyperplanes/2];
|
||||
|
||||
graph_data = (int*)malloc(order*rank*sizeof(int));
|
||||
graph_data = weyl_alloc(type);
|
||||
graph_unsorted = (node_t*)malloc(order*sizeof(node_t));
|
||||
ordering = (int*)malloc(order*sizeof(int));
|
||||
reverse_ordering = (int*)malloc(order*sizeof(int));
|
||||
@@ -94,11 +93,15 @@ void prepare_graph(semisimple_type_t type, node_t *graph)
|
||||
|
||||
// get coxeter graph
|
||||
|
||||
generate_coxeter_graph(type, graph_data);
|
||||
weyl_generate(type, graph_data);
|
||||
|
||||
fprintf(stderr, "Weyl group generated.\n");
|
||||
|
||||
for(int i = 0; i < order; i++)
|
||||
for(int j = 0; j < rank; j++)
|
||||
graph_unsorted[i].left = &graph_data[i*rank];
|
||||
for(int j = 0; j < rank; j++) {
|
||||
graph_unsorted[i].left = graph_data[i].left;
|
||||
graph_unsorted[i].id = graph_data[i].id;
|
||||
}
|
||||
|
||||
// find wordlengths
|
||||
|
||||
@@ -115,6 +118,8 @@ void prepare_graph(semisimple_type_t type, node_t *graph)
|
||||
}
|
||||
}
|
||||
|
||||
fprintf(stderr, "Wordlengths calculated.\n");
|
||||
|
||||
// sort by wordlength
|
||||
|
||||
for(int i = 0; i < order; i++)
|
||||
@@ -123,12 +128,15 @@ void prepare_graph(semisimple_type_t type, node_t *graph)
|
||||
for(int i = 0; i < order; i++)
|
||||
reverse_ordering[ordering[i]] = i; // reverse_ordering is a map old index -> new index
|
||||
for(int i = 0; i < order; i++) {
|
||||
// we have only set left and wordlength so far, so just copy these
|
||||
// we have only set left, wordlength and id so far, so just copy these
|
||||
graph[i].wordlength = graph_unsorted[ordering[i]].wordlength;
|
||||
graph[i].id = graph_unsorted[ordering[i]].id;
|
||||
for(int j = 0; j < rank; j++)
|
||||
graph[i].left[j] = reverse_ordering[graph_unsorted[ordering[i]].left[j]]; // rewrite references
|
||||
}
|
||||
|
||||
fprintf(stderr, "Sorted by wordlength.\n");
|
||||
|
||||
// find words
|
||||
|
||||
for(int i = 0; i < order; i++)
|
||||
@@ -146,6 +154,8 @@ void prepare_graph(semisimple_type_t type, node_t *graph)
|
||||
}
|
||||
}
|
||||
|
||||
fprintf(stderr, "Shortest words found.\n");
|
||||
|
||||
// generate right edges
|
||||
|
||||
for(int i = 0; i < order; i++) {
|
||||
@@ -158,6 +168,8 @@ void prepare_graph(semisimple_type_t type, node_t *graph)
|
||||
}
|
||||
}
|
||||
|
||||
fprintf(stderr, "Right edges generated.\n");
|
||||
|
||||
// find opposites
|
||||
|
||||
node_t *longest = &graph[order-1];
|
||||
@@ -168,6 +180,8 @@ void prepare_graph(semisimple_type_t type, node_t *graph)
|
||||
graph[i].opposite = current;
|
||||
}
|
||||
|
||||
fprintf(stderr, "Opposites found.\n");
|
||||
|
||||
// enumerate hyperplanes
|
||||
|
||||
hyperplane_count = 0;
|
||||
@@ -189,6 +203,8 @@ void prepare_graph(semisimple_type_t type, node_t *graph)
|
||||
}
|
||||
}
|
||||
|
||||
fprintf(stderr, "Hyperplanes enumerated.\n");
|
||||
|
||||
// generate folding order
|
||||
|
||||
edgelist_count = 0;
|
||||
@@ -213,6 +229,8 @@ void prepare_graph(semisimple_type_t type, node_t *graph)
|
||||
}
|
||||
}
|
||||
|
||||
fprintf(stderr, "Bruhat order generated.\n");
|
||||
|
||||
// remove redundant edges
|
||||
|
||||
for(int i = 0; i < order; i++) {
|
||||
@@ -254,6 +272,8 @@ void prepare_graph(semisimple_type_t type, node_t *graph)
|
||||
}
|
||||
}
|
||||
|
||||
fprintf(stderr, "Redundant edges removed.\n");
|
||||
|
||||
// reverse folding order
|
||||
|
||||
edgelist_count = 0;
|
||||
@@ -268,6 +288,8 @@ void prepare_graph(semisimple_type_t type, node_t *graph)
|
||||
}
|
||||
}
|
||||
|
||||
fprintf(stderr, "Bruhat order reversed.\n");
|
||||
|
||||
// additional sorting step to force opposite property (opposite of j is at n - j - 1)
|
||||
|
||||
for(int i = 0; i < order; i++)
|
||||
@@ -295,7 +317,7 @@ void prepare_graph(semisimple_type_t type, node_t *graph)
|
||||
edge->to = reverse_ordering[edge->to];
|
||||
}
|
||||
|
||||
free(graph_data);
|
||||
weyl_free(graph_data);
|
||||
free(graph_unsorted);
|
||||
free(ordering);
|
||||
free(reverse_ordering);
|
||||
@@ -332,8 +354,16 @@ int prepare_simplified_graph(semisimple_type_t type, unsigned long left, unsigne
|
||||
queue_t queue;
|
||||
int ncosets;
|
||||
|
||||
if(opposition_involution(type, left) != left)
|
||||
return -1;
|
||||
rank = weyl_rank(type);
|
||||
order = weyl_order(type);
|
||||
hyperplanes = weyl_hyperplanes(type);
|
||||
|
||||
for(int i = 0; i < rank; i++) {
|
||||
int oppi = weyl_opposition(type, i);
|
||||
if(left & BIT(i) && !(left & BIT(oppi)) ||
|
||||
left & BIT(oppi) && !(left & BIT(i)))
|
||||
return -1;
|
||||
}
|
||||
|
||||
edgelist_t *edgelists_higher = &simplified_graph[0].bruhat_higher[0];
|
||||
edgelist_t *edgelists_lower = &simplified_graph[0].bruhat_higher[order*hyperplanes/2];
|
||||
@@ -343,11 +373,9 @@ int prepare_simplified_graph(semisimple_type_t type, unsigned long left, unsigne
|
||||
full_graph = graph_alloc(type);
|
||||
prepare_graph(type, full_graph);
|
||||
|
||||
// initialize stuff
|
||||
fprintf(stderr, "Full graph generated.\n");
|
||||
|
||||
rank = coxeter_rank(type);
|
||||
order = coxeter_order(type);
|
||||
hyperplanes = coxeter_hyperplanes(type);
|
||||
// initialize stuff
|
||||
|
||||
reduced = (int*)malloc(order*sizeof(int));
|
||||
group = (int*)malloc(order*sizeof(int));
|
||||
@@ -478,6 +506,7 @@ int prepare_simplified_graph(semisimple_type_t type, unsigned long left, unsigne
|
||||
}
|
||||
|
||||
// step 8: revert order
|
||||
edgelists_used = 0;
|
||||
for(int i = 0; i < ncosets; i++) {
|
||||
edge = simplified_graph[i].bruhat_lower;
|
||||
while(edge) {
|
||||
@@ -520,9 +549,9 @@ int prepare_simplified_graph(semisimple_type_t type, unsigned long left, unsigne
|
||||
|
||||
node_t *graph_alloc(semisimple_type_t type)
|
||||
{
|
||||
int rank = coxeter_rank(type);
|
||||
int order = coxeter_order(type);
|
||||
int hyperplanes = coxeter_hyperplanes(type);
|
||||
int rank = weyl_rank(type);
|
||||
int order = weyl_order(type);
|
||||
int hyperplanes = weyl_hyperplanes(type);
|
||||
|
||||
node_t *graph = (node_t*)malloc(order*sizeof(node_t));
|
||||
int *left = (int*)malloc(order*rank*sizeof(int));
|
||||
@@ -547,7 +576,7 @@ void graph_free(semisimple_type_t type, node_t *graph)
|
||||
free(graph[0].right);
|
||||
free(graph[0].word);
|
||||
|
||||
int order = coxeter_order(type);
|
||||
int order = weyl_order(type);
|
||||
|
||||
// find the head of all edgelists by just taking the one having the lowest address
|
||||
edgelist_t *edgelists = graph[0].bruhat_lower;
|
||||
@@ -582,6 +611,7 @@ typedef struct {
|
||||
- returns number of balanced ideals found
|
||||
|
||||
uses the bitvector functions bv_union, bv_copy, bv_set_range_except, bv_disjoint, bv_next_zero
|
||||
|
||||
*/
|
||||
|
||||
static long enumerate_tree(const enumeration_info_t *info, const bitvec_t *pos, const bitvec_t *neg, int next_neg, int already_known)
|
||||
@@ -698,6 +728,13 @@ long enumerate_balanced_thickenings(node_t *graph, int size, void (*callback) (c
|
||||
}
|
||||
free(principal);
|
||||
|
||||
/*
|
||||
for(int i = 0; i < info.size; i++) {
|
||||
fprintf(stderr, "%d: ", i);
|
||||
bv_print_nice(stderr, &info.principal_pos[i], &info.principal_neg[i], -1, info.size/2);
|
||||
fprintf(stderr, "\n");
|
||||
} */
|
||||
|
||||
// enumerate balanced ideals
|
||||
bitvec_t pos, neg;
|
||||
bv_clear(&pos);
|
||||
|
||||
Reference in New Issue
Block a user