compute complex max slope
This commit is contained in:
@@ -9,6 +9,7 @@
|
||||
#include <math.h>
|
||||
|
||||
#define LOOP(i,n) for(int i = 0; i < (n); i++)
|
||||
#define SWAP(t,x,y) do { t _tmp = (x); (x) = (y); (y) = _tmp; } while (0);
|
||||
|
||||
/*
|
||||
Elements up to length 0: 1
|
||||
@@ -134,15 +135,50 @@ int main(int argc, char *argv[])
|
||||
struct tracedata *traces;
|
||||
int nuniq = enumerate_coxeter_group_traces(group, gen, &traces);
|
||||
|
||||
mps_context *solver = mps_context_new();
|
||||
mps_monomial_poly *poly = mps_monomial_poly_new(solver, 3);
|
||||
mps_context_set_output_prec(solver, 20); // relative precision
|
||||
mps_context_set_output_goal(solver, MPS_OUTPUT_GOAL_APPROXIMATE);
|
||||
|
||||
double ev_real[3], ev_imag[3], ev_abs2[3];
|
||||
double max_slope = 0;
|
||||
int max_slope_id = 0;
|
||||
|
||||
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));
|
||||
solve_characteristic_polynomial_d(solver, poly,
|
||||
gaussian_sqrt5_real(traces[i].tr),
|
||||
gaussian_sqrt5_imag(traces[i].tr),
|
||||
gaussian_sqrt5_real(traces[i].trinv),
|
||||
gaussian_sqrt5_imag(traces[i].trinv),
|
||||
ev_real, ev_imag);
|
||||
|
||||
LOOP(j, 3) ev_abs2[j] = ev_real[j]*ev_real[j] + ev_imag[j]*ev_imag[j];
|
||||
|
||||
if(fabs(ev_abs2[0]) < fabs(ev_abs2[1]))
|
||||
SWAP(double, ev_abs2[0], ev_abs2[1]);
|
||||
if(fabs(ev_abs2[1]) < fabs(ev_abs2[2]))
|
||||
SWAP(double, ev_abs2[1], ev_abs2[2]);
|
||||
if(fabs(ev_abs2[0]) < fabs(ev_abs2[1]))
|
||||
SWAP(double, ev_abs2[0], ev_abs2[1]);
|
||||
|
||||
if(log(ev_abs2[0]) < 1e-3) // we regard this as a finite order element
|
||||
continue;
|
||||
|
||||
double slope = - log(ev_abs2[0]) / log(ev_abs2[2]);
|
||||
if(slope > max_slope) {
|
||||
max_slope = slope;
|
||||
max_slope_id = traces[i].id;
|
||||
}
|
||||
|
||||
printf("%d %f %f %f\n",
|
||||
traces[i].id, log(ev_abs2[0]), log(ev_abs2[1]), log(ev_abs2[2]));
|
||||
}
|
||||
|
||||
coxeter_snprint(buf, sizeof(buf), &group->elements[max_slope_id]);
|
||||
gmp_printf("q = %Qd + i*%Qd\tElements: %d\tTraces: %d\tMaximal slope: %f at %s\n", qreal, qimag, n, nuniq, max_slope, buf);
|
||||
|
||||
mps_monomial_poly_free(solver, MPS_POLYNOMIAL(poly));
|
||||
mps_context_free(solver);
|
||||
enumerate_tracedata_clear(traces, nuniq);
|
||||
LOOP(i, 3) mat_clear(gen[i]);
|
||||
coxeter_clear(group);
|
||||
|
||||
Reference in New Issue
Block a user