1 /* Copyright (C) 2000  The PARI group.
2 
3 This file is part of the PARI/GP package.
4 
5 PARI/GP is free software; you can redistribute it and/or modify it under the
6 terms of the GNU General Public License as published by the Free Software
7 Foundation; either version 2 of the License, or (at your option) any later
8 version. It is distributed in the hope that it will be useful, but WITHOUT
9 ANY WARRANTY WHATSOEVER.
10 
11 Check the License for details. You should have received a copy of it, along
12 with the package; see the file 'COPYING'. If not, write to the Free Software
13 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */
14 
15 /* output of get_nf and get_bnf */
16 enum {
17   typ_NULL = 0,
18   typ_POL,
19   typ_Q,
20   typ_NF,
21   typ_BNF,
22   typ_BNR,
23   typ_ELL, /* elliptic curve */
24   typ_QUA, /* quadclassunit  */
25   typ_GAL, /* galoisinit     */
26   typ_BID,
27   typ_BIDZ,
28   typ_PRID,
29   typ_MODPR,
30   typ_RNF
31 };
32 
33 /* types of algebras */
34 enum  {
35   al_NULL = 0,
36   al_TABLE,
37   al_CSA,
38   al_CYCLIC
39 };
40 
41 /* models for elements of algebras */
42 enum {
43   al_INVALID = 0,
44   al_TRIVIAL,
45   al_ALGEBRAIC,
46   al_BASIS,
47   al_MATRIX
48 };
49 
50 /* idealtyp */
51 enum {
52   id_PRINCIPAL = 0,
53   id_PRIME,
54   id_MAT
55 };
56 
57 typedef struct {
58   GEN T, dT; /* defining polynomial (monic ZX), disc(T) */
59   GEN T0; /* original defining polynomial (ZX) */
60   GEN unscale; /* T = C*T0(x / unscale), rational */
61   GEN dK; /* disc(K) */
62   GEN index; /* [O_K : Z[X]/(T)] */
63   GEN basis;  /* Z-basis of O_K (t_VEC of t_POL) */
64 
65   long r1; /* number of real places of K */
66   GEN basden; /* [nums(bas), dens(bas)] */
67   GEN dTP, dTE; /* (possibly partial) factorization of dT, primes / exponents */
68   GEN dKP, dKE; /* (possibly partial) factorization of dK, primes / exponents */
69 } nfmaxord_t;
70 
71 /* qfr3 / qfr5 */
72 struct qfr_data { GEN D, sqrtD, isqrtD; };
73 
74 /* various flags for nf/bnf routines */
75 enum {
76   nf_ORIG = 1,
77   nf_GEN = 1,
78   nf_ABSOLUTE = 2,
79   nf_FORCE = 2,
80   nf_ALL = 4,
81   nf_GENMAT = 4,
82   nf_INIT = 4,
83   nf_RAW = 8,
84   nf_RED = 8,
85   nf_PARTIALFACT = 16,
86   nf_ROUND2 = 64, /* obsolete */
87   nf_GEN_IF_PRINCIPAL = 512
88 };
89 
90 enum {
91   rnf_REL = 1,
92   rnf_COND = 2
93 };
94 
95 /* LLL */
96 enum {
97   LLL_KER  = 1, /* only kernel */
98   LLL_IM   = 2, /* only image */
99   LLL_ALL  = 4, /* kernel & image */
100   LLL_GRAM       = 0x100,
101   LLL_KEEP_FIRST = 0x200,
102   LLL_INPLACE    = 0x400,
103   LLL_COMPATIBLE = 0x800 /* attempt same behavior on 32/64bit kernels */
104 };
105 
106 /* HNF */
107 enum { hnf_MODID = 1, hnf_PART = 2, hnf_CENTER = 4 };
108 
109 /* for fincke_pohst() */
110 typedef struct FP_chk_fun {
111   GEN (*f)(void *,GEN);
112   /* f_init allowed to permute the columns of u and r */
113   GEN (*f_init)(struct FP_chk_fun*,GEN,GEN);
114   GEN (*f_post)(struct FP_chk_fun*,GEN,GEN);
115   void *data;
116   long skipfirst;
117 } FP_chk_fun;
118 
119 /* for ideallog / zlog */
120 typedef struct {
121   GEN bid;
122   GEN P, k;
123   GEN sprk; /* sprk[i] = sprkinit(P[i]^k[i])*/
124   GEN archp; /* archimedean part of conductor, in permutation form */
125   GEN mod;
126   GEN U; /* base change matrix blocks from (Z_K/P^k)^* and (Z/2)^#f_oo
127           * to bid.gen */
128   long hU; /* #bid.gen */
129   int no2; /* 1 iff fa2 = fa, i.e. no prime of norm 2 divide exactly bid.mod */
130 } zlog_S;
131