Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-11-07 10:15:30

0001 /*
0002     Copyright (C) 2013 William Hart
0003 
0004     This file is part of FLINT.
0005 
0006     FLINT is free software: you can redistribute it and/or modify it under
0007     the terms of the GNU Lesser General Public License (LGPL) as published
0008     by the Free Software Foundation; either version 3 of the License, or
0009     (at your option) any later version.  See <https://www.gnu.org/licenses/>.
0010 */
0011 
0012 #ifndef NF_H
0013 #define NF_H
0014 
0015 #include "fmpz_poly.h"
0016 #include "fmpq_poly.h"
0017 
0018 #ifdef __cplusplus
0019 extern "C" {
0020 #endif
0021 
0022 typedef struct {
0023    fmpq_poly_t pol;  /* defining polynomial */
0024    union {
0025       /* insert any precomputed inverse for zz case here */
0026       fmpz_preinvn_t qq; /* precomputed inverse for leading coeff of num(pol), QQ case */
0027    } pinv;
0028    union { /* powers of the generator mod pol */
0029       fmpq_poly_powers_precomp_t qq;
0030       fmpz_poly_powers_precomp_t zz;
0031    } powers;
0032    fmpq_poly_t traces; /* S_k = sum_i \theta_i^k for k = 0, 1, 2, ..., (n-1) */
0033    ulong flag;       /* 1 = pol monic over ZZ, 2, = linear, 4 = quadratic field */
0034 } nf_struct;
0035 
0036 typedef nf_struct nf_t[1];
0037 
0038 #define NF_POWERS_CUTOFF 30 /* maximum length of pol where we precompute powers */
0039 
0040 #define NF_GENERIC 0
0041 #define NF_MONIC 1
0042 #define NF_LINEAR 2
0043 #define NF_QUADRATIC 4
0044 #define NF_GAUSSIAN 8
0045 
0046 /******************************************************************************
0047 
0048     Initialisation
0049 
0050 ******************************************************************************/
0051 
0052 void nf_init(nf_t nf, const fmpq_poly_t pol);
0053 
0054 void nf_init_randtest(nf_t nf, flint_rand_t state, slong len,  flint_bitcnt_t bits_in);
0055 
0056 void nf_clear(nf_t nf);
0057 
0058 void nf_print(const nf_t nf);
0059 
0060 #ifdef __cplusplus
0061 }
0062 #endif
0063 
0064 #endif