compute complex traces
This commit is contained in:
141
complex_anosov.c
141
complex_anosov.c
@@ -5,9 +5,148 @@
|
||||
#include "qext.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
|
||||
#define LOOP(i,n) for(int i = 0; i < (n); i++)
|
||||
|
||||
/*
|
||||
Elements up to length 0: 1
|
||||
Elements up to length 1: 4
|
||||
Elements up to length 2: 10
|
||||
Elements up to length 3: 22
|
||||
Elements up to length 4: 46
|
||||
Elements up to length 5: 91
|
||||
Elements up to length 6: 175
|
||||
Elements up to length 7: 334
|
||||
Elements up to length 8: 634
|
||||
Elements up to length 9: 1198
|
||||
Elements up to length 10: 2260
|
||||
Elements up to length 11: 4261
|
||||
Elements up to length 12: 8029
|
||||
Elements up to length 13: 15124
|
||||
Elements up to length 14: 28486
|
||||
Elements up to length 15: 53650
|
||||
Elements up to length 16: 101038
|
||||
Elements up to length 17: 190279
|
||||
Elements up to length 18: 358339
|
||||
Elements up to length 19: 674830
|
||||
Elements up to length 20: 1270846
|
||||
Elements up to length 21: 2393266
|
||||
Elements up to length 22: 4507012
|
||||
Elements up to length 23: 8487625
|
||||
*/
|
||||
|
||||
static double gaussian_sqrt5_real(NUMBER x)
|
||||
{
|
||||
double result = 0.0;
|
||||
|
||||
mpq_t tmp;
|
||||
mpq_init(tmp);
|
||||
|
||||
// a_0 + sqrt(5)a_1 + 4a_2 + 2sqrt(5)a_3
|
||||
mpq_set_si(tmp, 4, 1);
|
||||
mpq_mul(tmp, tmp, x->a[2]);
|
||||
mpq_add(tmp, tmp, x->a[0]);
|
||||
result = mpq_get_d(tmp);
|
||||
mpq_set_si(tmp, 2, 1);
|
||||
mpq_mul(tmp, tmp, x->a[3]);
|
||||
mpq_add(tmp, tmp, x->a[1]);
|
||||
result += mpq_get_d(tmp)*sqrt(5);
|
||||
|
||||
mpq_clear(tmp);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
static double gaussian_sqrt5_imag(NUMBER x)
|
||||
{
|
||||
double result = 0.0;
|
||||
|
||||
mpq_t tmp;
|
||||
mpq_init(tmp);
|
||||
|
||||
// a_1 + 2sqrt(5)a_2 + 14a_3
|
||||
mpq_set_si(tmp, 14, 1);
|
||||
mpq_mul(tmp, tmp, x->a[3]);
|
||||
mpq_add(tmp, tmp, x->a[1]);
|
||||
result = mpq_get_d(tmp);
|
||||
mpq_set_si(tmp, 2, 1);
|
||||
mpq_mul(tmp, tmp, x->a[2]);
|
||||
result += mpq_get_d(tmp)*sqrt(5);
|
||||
|
||||
mpq_clear(tmp);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
printf("initial main function.\n");
|
||||
char buf[100];
|
||||
int n = atoi(argv[1]);
|
||||
|
||||
mpq_t qreal, qimag;
|
||||
mpq_inits(qreal, qimag, NULL);
|
||||
mpq_set_si(qreal, 50, 10);
|
||||
mpq_set_si(qimag, 1, 10);
|
||||
mpq_canonicalize(qreal);
|
||||
mpq_canonicalize(qimag);
|
||||
|
||||
/*
|
||||
int length = 0;
|
||||
LOOP(i, n) {
|
||||
if(group->elements[i].length > length) {
|
||||
printf("Elements up to length %d: %d\n", length, i);
|
||||
length = group->elements[i].length;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
*/
|
||||
|
||||
/*
|
||||
LOOP(i, n) {
|
||||
groupelement_t *cur = &group->elements[i];
|
||||
groupelement_t *other;
|
||||
|
||||
cur->conjugacy_class = cur; // start with itself and reduce if possible
|
||||
|
||||
LOOP(j, 3) {
|
||||
if(cur->left[j] && cur->left[j]->right[j]) {
|
||||
other = cur->left[j]->right[j];
|
||||
if(other->id < cur->id)
|
||||
cur->conjugacy_class = other->conjugacy_class;
|
||||
}
|
||||
if(cur->right[j] && cur->right[j]->left[j]) {
|
||||
other = cur->right[j]->left[j];
|
||||
if(other->id < cur->id)
|
||||
cur->conjugacy_class = other->conjugacy_class;
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
group_t *group = coxeter_init_triangle(5, 5, 5, n);
|
||||
|
||||
mat gen[3];
|
||||
LOOP(i, 3) mat_init(gen[i], 3, QT_GAUSS_SQRT5);
|
||||
generators_triangle_reflection_group_555_complex(gen, 2, 2, 2, qreal, qimag);
|
||||
|
||||
struct tracedata *traces;
|
||||
int nuniq = enumerate_coxeter_group_traces(group, gen, &traces);
|
||||
|
||||
LOOP(i, nuniq) {
|
||||
printf("%d %f %f %f %f\n",
|
||||
traces[i].id,
|
||||
gaussian_sqrt5_real(traces[i].tr),
|
||||
gaussian_sqrt5_imag(traces[i].tr),
|
||||
gaussian_sqrt5_real(traces[i].trinv),
|
||||
gaussian_sqrt5_imag(traces[i].trinv));
|
||||
}
|
||||
|
||||
enumerate_tracedata_clear(traces, nuniq);
|
||||
LOOP(i, 3) mat_clear(gen[i]);
|
||||
coxeter_clear(group);
|
||||
mpq_clears(qreal, qimag, NULL);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user