Valid Weyl group check cleanup

This commit is contained in:
Florian Stecker 2016-12-13 21:55:21 +01:00
parent 32d0dc8da1
commit ab546946c8
2 changed files with 24 additions and 36 deletions

View File

@ -165,7 +165,7 @@ int main(int argc, const char *argv[])
type.n = 0; type.n = 0;
for(int i = 0; i < argc - 1; i++) { for(int i = 0; i < argc - 1; i++) {
if(argv[i+1][0] < 'A' || argv[i+1][0] > 'I') if(argv[i+1][0] < 'A' || argv[i+1][0] > 'G')
break; break;
type.n++; type.n++;
} }
@ -174,7 +174,7 @@ int main(int argc, const char *argv[])
for(int i = 0; i < type.n; i++) { for(int i = 0; i < type.n; i++) {
type.factors[i].series = argv[i+1][0]; type.factors[i].series = argv[i+1][0];
type.factors[i].rank = argv[i+1][1] - '0'; type.factors[i].rank = argv[i+1][1] - '0';
ERROR(argv[i+1][0] < 'A' || argv[i+1][0] > 'I' || argv[i+1][1] < '1' || argv[i+1][1] > '9', "Arguments must be Xn with X out of A-I and n out of 0-9\n"); ERROR(argv[i+1][0] < 'A' || argv[i+1][0] > 'I' || argv[i+1][1] < '1' || argv[i+1][1] > '9', "Arguments must be Xn with X out of A-G and n out of 1-9\n");
} }
left_invariance = right_invariance = 0; left_invariance = right_invariance = 0;

56
weyl.c
View File

@ -110,6 +110,20 @@ static void reflect_root_vector(const int *cartan, int rank, int i, int *old, in
/************* Weyl group infos ************************/ /************* Weyl group infos ************************/
static int weyl_exists(simple_type_t type)
{
if(type.series < 'A' || type.series > 'G' || type.rank < 1 ||
type.series == 'B' && type.rank < 2 ||
type.series == 'C' && type.rank < 2 ||
type.series == 'D' && type.rank < 3 ||
type.series == 'E' && type.rank != 6 && type.rank != 7 && type.rank != 8 ||
type.series == 'F' && type.rank != 4 ||
type.series == 'G' && type.rank != 2)
return 0;
else
return 1;
}
int weyl_rank(semisimple_type_t type) int weyl_rank(semisimple_type_t type)
{ {
int rank = 0; int rank = 0;
@ -122,8 +136,9 @@ int weyl_order(semisimple_type_t type)
{ {
int order = 1; int order = 1;
for(int i = 0; i < type.n; i++) { for(int i = 0; i < type.n; i++) {
switch(type.factors[i].series) { ERROR(!weyl_exists(type.factors[i]), "A Weyl group of type %c%d does not exist!\n", type.factors[i].series, type.factors[i].rank);
switch(type.factors[i].series) {
case 'A': case 'A':
for(int j = 1; j <= type.factors[i].rank + 1; j++) for(int j = 1; j <= type.factors[i].rank + 1; j++)
order *= j; order *= j;
@ -146,22 +161,15 @@ int weyl_order(semisimple_type_t type)
order *= 2903040; order *= 2903040;
else if(type.factors[i].rank == 8) else if(type.factors[i].rank == 8)
order *= 696729600; order *= 696729600;
else
ERROR(1, "A Weyl group of type %c%d does not exist or is not implemented!\n", type.factors[i].series, type.factors[i].rank);
break; break;
case 'F': case 'F':
ERROR(type.factors[i].rank != 4, "A Weyl group of type %c%d does not exist or is not implemented!\n", type.factors[i].series, type.factors[i].rank);
order *= 1152; order *= 1152;
break; break;
case 'G': case 'G':
ERROR(type.factors[i].rank != 2, "A Weyl group of type %c%d does not exist or is not implemented!\n", type.factors[i].series, type.factors[i].rank);
order *= 12; order *= 12;
break; break;
default:
ERROR(1, "A Weyl group of type %c%d does not exist or is not implemented!\n", type.factors[i].series, type.factors[i].rank);
} }
} }
@ -173,6 +181,8 @@ int weyl_hyperplanes(semisimple_type_t type)
int hyperplanes = 0; int hyperplanes = 0;
for(int i = 0; i < type.n; i++) { for(int i = 0; i < type.n; i++) {
ERROR(!weyl_exists(type.factors[i]), "A Weyl group of type %c%d does not exist!\n", type.factors[i].series, type.factors[i].rank);
switch(type.factors[i].series) { switch(type.factors[i].series) {
case 'A': case 'A':
hyperplanes += (type.factors[i].rank * (type.factors[i].rank + 1)) / 2; hyperplanes += (type.factors[i].rank * (type.factors[i].rank + 1)) / 2;
@ -193,22 +203,15 @@ int weyl_hyperplanes(semisimple_type_t type)
hyperplanes += 63; hyperplanes += 63;
else if(type.factors[i].rank == 8) else if(type.factors[i].rank == 8)
hyperplanes += 120; hyperplanes += 120;
else
ERROR(1, "A Weyl group of type %c%d does not exist or is not implemented!\n", type.factors[i].series, type.factors[i].rank);
break; break;
case 'F': case 'F':
ERROR(type.factors[i].rank != 4, "A Weyl group of type %c%d does not exist or is not implemented!\n", type.factors[i].series, type.factors[i].rank);
hyperplanes += 24; hyperplanes += 24;
break; break;
case 'G': case 'G':
ERROR(type.factors[i].rank != 2, "A Weyl group of type %c%d does not exist or is not implemented!\n", type.factors[i].series, type.factors[i].rank);
hyperplanes += 6; hyperplanes += 6;
break; break;
default:
ERROR(1, "A Weyl group of type %c%d does not exist or is not implemented!\n", type.factors[i].series, type.factors[i].rank);
} }
} }
@ -228,6 +231,8 @@ int weyl_opposition(semisimple_type_t type, int simple_root)
offset += type.factors[factor].rank; offset += type.factors[factor].rank;
r = simple_root - offset; r = simple_root - offset;
ERROR(!weyl_exists(type.factors[factor]), "A Weyl group of type %c%d does not exist!\n", type.factors[factor].series, type.factors[factor].rank);
switch(type.factors[factor].series) { switch(type.factors[factor].series) {
case 'B': case 'C': case 'F': case 'G': case 'B': case 'C': case 'F': case 'G':
iota_r = r; iota_r = r;
@ -250,9 +255,6 @@ int weyl_opposition(semisimple_type_t type, int simple_root)
else else
iota_r = r == 3 || r == 4 ? r : 5 - r; iota_r = r == 3 || r == 4 ? r : 5 - r;
break; break;
default:
ERROR(1, "A Weyl group of type %c%d does not exist or is not implemented!\n", type.factors[factor].series, type.factors[factor].rank);
} }
return iota_r + offset; return iota_r + offset;
@ -270,6 +272,8 @@ void weyl_cartan_matrix(semisimple_type_t type, int *m)
m[i*rank+i] = 2; m[i*rank+i] = 2;
for(int k = 0; k < type.n; k++) { for(int k = 0; k < type.n; k++) {
ERROR(!weyl_exists(type.factors[k]), "A Weyl group of type %c%d does not exist!\n", type.factors[k].series, type.factors[k].rank);
for(int i = 0; i < type.factors[k].rank; i++) // A is the submatrix corresponding to the current simple factor for(int i = 0; i < type.factors[k].rank; i++) // A is the submatrix corresponding to the current simple factor
A[i] = &m[(i+offset)*rank + offset]; A[i] = &m[(i+offset)*rank + offset];
@ -278,45 +282,29 @@ void weyl_cartan_matrix(semisimple_type_t type, int *m)
A[i-1][i] = -1; A[i-1][i] = -1;
} }
switch(type.factors[k].series) { switch(type.factors[k].series) {
case 'A': case 'A':
break; break;
case 'B': case 'B':
ERROR(type.factors[k].rank < 2, "A Weyl group of type %c%d does not exist or is not implemented!\n", type.factors[k].series, type.factors[k].rank);
A[0][1] = -2; A[0][1] = -2;
break; break;
case 'C': case 'C':
ERROR(type.factors[k].rank < 2, "A Weyl group of type %c%d does not exist or is not implemented!\n", type.factors[k].series, type.factors[k].rank);
A[1][0] = -2; A[1][0] = -2;
break; break;
case 'D': case 'D':
ERROR(type.factors[k].rank < 3, "A Weyl group of type %c%d does not exist or is not implemented!\n", type.factors[k].series, type.factors[k].rank);
A[0][1] = A[1][0] = 0; A[0][1] = A[1][0] = 0;
A[0][2] = A[2][0] = -1; A[0][2] = A[2][0] = -1;
break; break;
case 'E': case 'E':
ERROR(type.factors[k].rank < 6 || type.factors[k].rank > 8, "A Weyl group of type %c%d does not exist or is not implemented!\n", type.factors[k].series, type.factors[k].rank);
A[1][2] = A[2][1] = 0; A[1][2] = A[2][1] = 0;
A[1][3] = A[3][1] = -1; A[1][3] = A[3][1] = -1;
break; break;
case 'F': case 'F':
ERROR(type.factors[k].rank != 4, "A Weyl group of type %c%d does not exist or is not implemented!\n", type.factors[k].series, type.factors[k].rank);
A[3][2] = -2; A[3][2] = -2;
break; break;
case 'G': case 'G':
ERROR(type.factors[k].rank != 2, "A Weyl group of type %c%d does not exist or is not implemented!\n", type.factors[k].series, type.factors[k].rank);
A[1][0] = -3; A[1][0] = -3;
break; break;
default:
ERROR(1, "A Weyl group of type %c%d does not exist or is not implemented!\n", type.factors[k].series, type.factors[k].rank);
} }
offset += type.factors[k].rank; offset += type.factors[k].rank;