1 /*
2 
3 cm_class.h - header file for the cm_class library
4 
5 Copyright (C) 2009, 2010, 2018 Andreas Enge
6 
7 This file is part of CM.
8 
9 CM is free software; you can redistribute it and/or modify it under
10 the terms of the GNU General Public License as published by the
11 Free Software Foundation; either version 3 of the license, or (at your
12 option) any later version.
13 
14 CM is distributed in the hope that it will be useful, but WITHOUT ANY
15 WARRANTY; without even the implied warranty of MERCHANTABILITY or
16 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
17 for more details.
18 
19 You should have received a copy of the GNU General Public License along
20 with CM; see the file COPYING. If not, write to the Free Software
21 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 */
23 
24 #ifndef __CM_CLASS_H
25 #define __CM_CLASS_H
26 
27 #include "cm_common.h"
28 #include <inttypes.h>
29 
30 #define CM_INVARIANT_NONE      '\0'
31 #define CM_INVARIANT_J         'j'
32 #define CM_INVARIANT_GAMMA2    '2'
33 #define CM_INVARIANT_GAMMA3    '3'
34 #define CM_INVARIANT_WEBER     'w'
35 #define CM_INVARIANT_DOUBLEETA 'd'
36 #define CM_INVARIANT_SIMPLEETA 's'
37 #define CM_INVARIANT_MULTIETA  'm'
38 #define CM_INVARIANT_ATKIN     'a'
39 
40 
41 typedef int_fast64_t int_cl_t;
42 typedef uint_fast64_t uint_cl_t;
43    /* integer types used to represent discriminants, conductors and class    */
44    /* group entries  */
45 #define PRIicl PRIiFAST64
46 #define PRIucl PRIuFAST64
47 #define SCNicl SCNiFAST64
48 
49 typedef struct {
50    char invariant;
51       /* a constant describing which invariant is actually used                 */
52    int field;
53       /* a constant describing whether we are working over the real or the      */
54       /* complex numbers                                                        */
55    int p [6], e, s;
56       /* some parameters of the class invariant                                 */
57       /* p is a 0-terminated list of integers (often the primes dividing the    */
58       /* level); s is the canonical power, e the power actually used.           */
59    char paramstr [255];
60       /* a string encoding the previous characters, used in files and their     */
61       /* names                                                                  */
62    int_cl_t d;
63       /* the discriminant                                                       */
64    int h;
65       /* the class number */
66    int minpoly_deg;
67       /* the degree of the minimal polynomial; usually h */
68    mpz_t *minpoly;
69       /* real part of the minimal polynomial of the function over Q             */
70    mpz_t *minpoly_complex;
71       /* Only meaningful in the complex case; then the minimal polynomial is    */
72       /* decomposed into two parts over the integral basis                      */
73       /* [1, sqrt (D)/2] resp. [1, (1 + sqrt (D))/2]; the first part is in      */
74       /* minpoly, the second one in this variable.                              */
75 } cm_class_t;
76 
77 
78 #if defined (__cplusplus)
79 extern "C" {
80 #endif
81 
82 /* functions for class polynomials */
83 extern void cm_class_init (cm_class_t *c, int_cl_t d, char inv,
84    bool verbose);
85 extern void cm_class_clear (cm_class_t *c);
86 extern void cm_class_compute_minpoly (cm_class_t c, bool checkpoints,
87    bool disk, bool print, bool verbose);
88 
89 /* functions for computing parameters of a complex multiplication curve      */
90 extern void cm_curve_compute_curve (int_cl_t d, char inv, int fieldsize,
91    const char* modpoldir, bool readwrite, bool print, bool verbose);
92 #if defined (__cplusplus)
93 }
94 #endif
95 #endif /* ifndef __CM_CLASS_H */
96