generators output
This commit is contained in:
parent
7dff4f8365
commit
161d850294
8
bitvec.h
8
bitvec.h
@ -176,7 +176,7 @@ static inline int bv_next_zero(const bitvec_t *x, int start)
|
|||||||
return i*BLOCKSIZE + position - 1;
|
return i*BLOCKSIZE + position - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return BV_QWORD_RANK; // found nothing
|
return BV_QWORD_RANK*BLOCKSIZE; // found nothing
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void bv_copy(const bitvec_t *from, bitvec_t *to)
|
static inline void bv_copy(const bitvec_t *from, bitvec_t *to)
|
||||||
@ -185,4 +185,10 @@ static inline void bv_copy(const bitvec_t *from, bitvec_t *to)
|
|||||||
to->v[i] = from->v[i];
|
to->v[i] = from->v[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline void bv_negate(const bitvec_t *from, bitvec_t *to)
|
||||||
|
{
|
||||||
|
for(int i = 0; i < BV_QWORD_RANK; i++)
|
||||||
|
to->v[i] = ~from->v[i];
|
||||||
|
}
|
||||||
|
|
||||||
#endif /* __BITVEC_H__ */
|
#endif /* __BITVEC_H__ */
|
||||||
|
49
enumerate.c
49
enumerate.c
@ -52,12 +52,12 @@ int shorten(int i, unsigned long left, unsigned long right, doublequotient_t *dq
|
|||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void balanced_thickening_callback(const bitvec_t *pos, int size, void *data)
|
void balanced_thickening_callback(const bitvec_t *pos, int size, const enumeration_info_t *ei)
|
||||||
{
|
{
|
||||||
static long totcount = 0;
|
static long totcount = 0;
|
||||||
|
|
||||||
if(data) {
|
if(ei->callback_data) {
|
||||||
info_t *info = (info_t*)data;
|
info_t *info = (info_t*)ei->callback_data;
|
||||||
|
|
||||||
unsigned long right_invariance = FIRSTBITS(info->rank);
|
unsigned long right_invariance = FIRSTBITS(info->rank);
|
||||||
unsigned long left_invariance = FIRSTBITS(info->rank);
|
unsigned long left_invariance = FIRSTBITS(info->rank);
|
||||||
@ -86,8 +86,36 @@ void balanced_thickening_callback(const bitvec_t *pos, int size, void *data)
|
|||||||
printf("%c", right_invariance & (1 << j) ? j + 'a' : ' ');
|
printf("%c", right_invariance & (1 << j) ? j + 'a' : ' ');
|
||||||
|
|
||||||
if(info->buffer) {
|
if(info->buffer) {
|
||||||
printf(" set: ");
|
bitvec_t low, high;
|
||||||
bv_print(stdout, pos, size/2);
|
bv_copy(pos, &low);
|
||||||
|
bv_negate(pos, &high);
|
||||||
|
|
||||||
|
// printf(" set: ");
|
||||||
|
// bv_print(stdout, &low, size/2);
|
||||||
|
// printf(" ");
|
||||||
|
// bv_print(stdout, &high, size/2);
|
||||||
|
|
||||||
|
printf(" gen: ");
|
||||||
|
|
||||||
|
|
||||||
|
for(int i = 0; i < size/2; i++) {
|
||||||
|
if(!bv_get_bit(&high, i))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
printf("%s ", alphabetize(info->dq->cosets[size-1-i].min, stringbuffer));
|
||||||
|
|
||||||
|
bv_difference(&high, &ei->principal_neg[size-1-i], &high);
|
||||||
|
bv_difference(&low, &ei->principal_pos[size-1-i], &low);
|
||||||
|
}
|
||||||
|
|
||||||
|
for(int i = size/2 - 1; i >= 0; i--) {
|
||||||
|
if(!bv_get_bit(&low, i))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
printf("%s ", alphabetize(info->dq->cosets[i].min, stringbuffer));
|
||||||
|
|
||||||
|
bv_difference(&low, &ei->principal_pos[i], &low);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int max_length = 0;
|
int max_length = 0;
|
||||||
@ -100,7 +128,7 @@ void balanced_thickening_callback(const bitvec_t *pos, int size, void *data)
|
|||||||
max_length = info->dq->cosets[size-i-1].max->wordlength;
|
max_length = info->dq->cosets[size-i-1].max->wordlength;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
printf(" max length: %d", max_length);
|
// printf(" max length: %d", max_length);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
if(info->buffer) {
|
if(info->buffer) {
|
||||||
@ -164,9 +192,9 @@ void balanced_thickening_callback(const bitvec_t *pos, int size, void *data)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void balanced_thickening_simple_callback(const bitvec_t *pos, int size, void *data)
|
void balanced_thickening_simple_callback(const bitvec_t *pos, int size, const enumeration_info_t *ei)
|
||||||
{
|
{
|
||||||
long *count = (long*)data;
|
long *count = (long*)ei->callback_data;
|
||||||
|
|
||||||
if((++(*count)) % 100000000 == 0) {
|
if((++(*count)) % 100000000 == 0) {
|
||||||
bv_print(stderr, pos, size/2);
|
bv_print(stderr, pos, size/2);
|
||||||
@ -259,7 +287,8 @@ int main(int argc, const char *argv[])
|
|||||||
printf("\n");
|
printf("\n");
|
||||||
wl = dq->cosets[i].min->wordlength;
|
wl = dq->cosets[i].min->wordlength;
|
||||||
}
|
}
|
||||||
fprintf(stdout, "%s(%d) ", alphabetize(dq->cosets[i].min, stringbuffer), dq->cosets[i].max->wordlength);
|
// fprintf(stdout, "%s(%d) ", alphabetize(dq->cosets[i].min, stringbuffer), dq->cosets[i].max->wordlength);
|
||||||
|
fprintf(stdout, "%s ", alphabetize(dq->cosets[i].min, stringbuffer));
|
||||||
}
|
}
|
||||||
fprintf(stdout, "\n\n");
|
fprintf(stdout, "\n\n");
|
||||||
}
|
}
|
||||||
@ -289,7 +318,7 @@ int main(int argc, const char *argv[])
|
|||||||
if(dq->cosets[i].opposite == &dq->cosets[i]) {
|
if(dq->cosets[i].opposite == &dq->cosets[i]) {
|
||||||
if(output_level >= 1) {
|
if(output_level >= 1) {
|
||||||
if(fixpoints == 0)
|
if(fixpoints == 0)
|
||||||
fprintf(stdout, "No thickenings since the longest element fixes the following cosets:");
|
fprintf(stdout, "No balanced ideals since the longest element fixes the following cosets:");
|
||||||
fprintf(stdout, " %s", alphabetize(dq->cosets[i].min, stringbuffer));
|
fprintf(stdout, " %s", alphabetize(dq->cosets[i].min, stringbuffer));
|
||||||
}
|
}
|
||||||
fixpoints++;
|
fixpoints++;
|
||||||
|
@ -8,15 +8,6 @@
|
|||||||
#include "weyl.h"
|
#include "weyl.h"
|
||||||
#include "queue.h"
|
#include "queue.h"
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
int size; // the size of the weyl group. We store however only the first size/2 elements
|
|
||||||
bitvec_t *principal_pos;
|
|
||||||
bitvec_t *principal_neg;
|
|
||||||
int *principal_is_slim;
|
|
||||||
void (*callback)(const bitvec_t *, int, void*);
|
|
||||||
void *callback_data;
|
|
||||||
} enumeration_info_t;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
This function enumerates all balanced ideals satisfying certain constraints, given by its arguments pos, neg and next_neg
|
This function enumerates all balanced ideals satisfying certain constraints, given by its arguments pos, neg and next_neg
|
||||||
|
|
||||||
@ -71,7 +62,7 @@ static long enumerate_tree(const enumeration_info_t *info, const bitvec_t *pos,
|
|||||||
if(next_next_neg >= info->size/2) {
|
if(next_next_neg >= info->size/2) {
|
||||||
// there is no unknown left, so we found a balanced ideal
|
// there is no unknown left, so we found a balanced ideal
|
||||||
if(info->callback)
|
if(info->callback)
|
||||||
info->callback(&newpos, info->size, info->callback_data);
|
info->callback(&newpos, info->size, info);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -154,7 +145,7 @@ static void generate_principal_ideals(doublequotient_t *dq, bitvec_t *pos, bitve
|
|||||||
returns the number of balanced ideals
|
returns the number of balanced ideals
|
||||||
*/
|
*/
|
||||||
|
|
||||||
long enumerate_balanced_thickenings(doublequotient_t *dq, void (*callback) (const bitvec_t *, int, void*), void *callback_data)
|
long enumerate_balanced_thickenings(doublequotient_t *dq, enumeration_callback callback, void *callback_data)
|
||||||
{
|
{
|
||||||
long count = 0;
|
long count = 0;
|
||||||
enumeration_info_t info;
|
enumeration_info_t info;
|
||||||
|
@ -7,7 +7,19 @@
|
|||||||
|
|
||||||
#define DEBUG(msg, ...) do{fprintf(stderr, msg, ##__VA_ARGS__); }while(0)
|
#define DEBUG(msg, ...) do{fprintf(stderr, msg, ##__VA_ARGS__); }while(0)
|
||||||
|
|
||||||
|
struct enumeration_info {
|
||||||
|
int size; // the size of the weyl group. We store however only the first size/2 elements
|
||||||
|
bitvec_t *principal_pos;
|
||||||
|
bitvec_t *principal_neg;
|
||||||
|
int *principal_is_slim;
|
||||||
|
void (*callback)(const bitvec_t *, int, const struct enumeration_info *);
|
||||||
|
void *callback_data;
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef void (*enumeration_callback)(const bitvec_t *, int, const struct enumeration_info *);
|
||||||
|
typedef struct enumeration_info enumeration_info_t;
|
||||||
|
|
||||||
// enumerating balanced thickenings
|
// enumerating balanced thickenings
|
||||||
long enumerate_balanced_thickenings(doublequotient_t *dq, void (*callback) (const bitvec_t *, int, void*), void *callback_data);
|
long enumerate_balanced_thickenings(doublequotient_t *dq, enumeration_callback callback, void *callback_data);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user