1 #ifndef CM2_H_
2 #define CM2_H_
3 
4 /* cm2.h -- data types related to cm2.c
5  *
6  * Copyright (C) 2010, 2011, 2012, 2013 INRIA
7  *
8  * This file is part of CMH.
9  *
10  * CMH is free software; you can redistribute it and/or modify it under
11  * the terms of the GNU General Public License as published by the
12  * Free Software Foundation; either version 3 of the License, or (at your
13  * option) any later version.
14  *
15  * CMH is distributed in the hope that it will be useful, but WITHOUT ANY
16  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
17  * FOR A PARTICULAR PURPOSE. See the GNU General Public License for
18  * more details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with this program. If not, see http://www.gnu.org/licenses/ .
22  */
23 
24 #include <mpfrcx.h>
25 #include "quadratic_field.h"
26 #include "factor.h"
27 #include "params.h"
28 
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32 
33 struct cm_data {
34     int DAB[3];
35     int DAB_r[3];
36     mpz_t dr;   /* square-free integer s.t. K0r = Q(sqrt(dr)) */
37 
38     // square root of largest root of X^2-2AX+A^2-4B. i times this
39     // generates the reflex real field.
40     mpfr_t r;
41 
42     int ncosets;
43 
44     unsigned long int denom_prime_bound;
45 
46     int invariant_set;
47 
48     struct cm_orbit_data * orbits;
49 };
50 
51 struct cm_orbit_data {
52     int nperiods;
53     // the period matrices corresponding to an orbit of ppav's of the same type
54     // under the action of the group C(K)
55     struct cm_period_data * periods;
56     int nclasses;       // counting conjugate pairs, the number of classes
57                         // (this is sometimes h1, sometimes 1/2^k times h1)
58 
59     // minimum and maximum of xprec's across the different periods.
60     mpfr_prec_t minprec;
61     mpfr_prec_t maxprec;
62 
63     // class polynomials H1, H2, H3, H12, H13
64     quadratic_number * H[3];    // eventually all have denominator 1
65     factor_matrix Hdenom_fact[3];
66     mpz_t Hdenom[3];
67 };
68 
69 struct cm_period_data {
70 
71     mpfr_prec_t base_prec;  // precision from which the newton lifting
72                             // process started, for this period (might
73                             // differ from what we have for other periods)
74 
75     int field;             // 1 for a real conjugate, 2 for a complex pair.
76 
77     mpz_t pm_t[3][4];   // symbolic period_matrix (coefficients, denominator)
78     mpz_t pm_denom;
79 
80     mpc_t b[3];         // Quotients of theta constants.
81                         // These get lifted iteration after iteration.
82 
83     mpc_t j[3];         // j-invariants. Recomputed from b[] at each iteration
84 
85     /* Computation of invariants from b[] is done at precision
86      * prec(b[0]). However, the result is truncated to smaller precision,
87      * because we believe that b[] is only accurate to some relative
88      * precision. This count is updated at each Newton step. */
89     mpfr_prec_t probably_correct_bits;
90 
91     int orbit, no, iter;
92       /* only needed for checkpointing to determine the file name */
93 };
94 
95 struct reconstruction_status_s {/*{{{*/
96     int size;
97     int ncoeffs;
98     int last;
99     int ndone, ntodo, nworking;
100     int hold;
101     int * status;
102     int * wlist;
103     double io_time;
104     double client_time;
105     double vain_time;
106     double total_time;
107     mpz_t denom_lcm;
108     /* we do not (yet) have ownership on these */
109     mpfrx_srcptr Hr;
110 
111     quadratic_number * H;
112     int hecke;  /* 1 when we're recognizing an interpolating poly */
113     const char * poly_name;
114     mpz_t premult;
115 };
116 typedef struct reconstruction_status_s reconstruction_status[1];
117 typedef struct reconstruction_status_s * reconstruction_status_ptr;
118 typedef const struct reconstruction_status_s * reconstruction_status_srcptr;
119 /*}}}*/
120 struct reconstruction_coeff_result_s {/*{{{*/
121     int i;
122     double ttc;
123     /* The following two are either private data for the mpi client loop,
124      * or possibly direct pointer to the relevant parent structures for
125      * the non-mpi program. Thus in any case, this structure does
126      * obviously not have ownership of the data */
127     quadratic_number_ptr q;
128     mpfr_ptr cx;
129 
130     mpz_t premult;
131 
132     /* only needed for checkpointing to determine the right file name */
133     int orbit, inum, iter;
134 };
135 typedef struct reconstruction_coeff_result_s reconstruction_coeff_result[1];
136 typedef struct reconstruction_coeff_result_s * reconstruction_coeff_result_ptr;
137 typedef const struct reconstruction_coeff_result_s * reconstruction_coeff_result_srcptr;
138 /*}}}*/
139 
140 #ifdef __cplusplus
141 }
142 #endif
143 
144 #endif	/* CM2_H_ */
145