Code coverage tests

This page documents the degree to which the PARI/GP source code is tested by our public test suite, distributed with the source distribution in directory src/test/. This is measured by the gcov utility; we then process gcov output using the lcov frond-end.

We test a few variants depending on Configure flags on the pari.math.u-bordeaux.fr machine (x86_64 architecture), and agregate them in the final report:

The target is 90% coverage for all mathematical modules (given that branches depending on DEBUGLEVEL or DEBUGMEM are not covered). This script is run to produce the results below.

LCOV - code coverage report
Current view: top level - headers - paripriv.h (source / functions) Hit Total Coverage
Test: PARI/GP v2.8.0 lcov report (development 19352-1b11b25) Lines: 9 9 100.0 %
Date: 2016-08-25 06:11:27 Functions: 7 7 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* Copyright (C) 2004  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. It is distributed in the hope that it will be useful, but WITHOUT
       8             : ANY WARRANTY WHATSOEVER.
       9             : 
      10             : Check the License for details. You should have received a copy of it, along
      11             : with the package; see the file 'COPYING'. If not, write to the Free Software
      12             : Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */
      13             : 
      14             : BEGINEXTERN
      15             : /* hashtables */
      16             : hashtable *hashstr_import_static(hashentry *e, ulong size);
      17             : void hashstr_dbg(hashtable *h);
      18             : 
      19             : /* for qsort */
      20             : typedef int (*QSCOMP)(const void *, const void *);
      21             : 
      22             : #define ucoeff(a,i,j)  (((ulong**)(a))[j][i])
      23             : #define umael(a,i,j)   (((ulong**)(a))[i][j])
      24             : #define uel(a,i)       (((ulong*)(a))[i])
      25             : 
      26             : #define numberof(x) (sizeof(x) / sizeof((x)[0]))
      27             : 
      28             : /* to manipulate 'blocs' */
      29             : #define BL_HEAD 4
      30             : #define bl_base(x) (void*)((x) - BL_HEAD)
      31             : #define bl_refc(x) (((GEN)x)[-4])
      32             : #define bl_next(x) (((GEN*)x)[-3])
      33             : #define bl_prev(x) (((GEN*)x)[-2])
      34             : #define bl_num(x)  (((GEN)x)[-1])
      35             : INLINE void
      36   188384397 : clone_lock(GEN C) { if (isclone(C)) ++bl_refc(C); }
      37             : INLINE void
      38   188827629 : clone_unlock(GEN C) { if (isclone(C)) gunclone(C); }
      39             : 
      40             : /* swap */
      41             : #define lswap(x,y) {long _z=x; x=y; y=_z;}
      42             : #define pswap(x,y) {GEN *_z=x; x=y; y=_z;}
      43             : #define swap(x,y)  {GEN  _z=x; x=y; y=_z;}
      44             : #define dswap(x,y) { double _t=x; x=y; y=_t; }
      45             : #define pdswap(x,y) { double* _t=x; x=y; y=_t; }
      46             : #define swapspec(x,y, nx,ny) {swap(x,y); lswap(nx,ny);}
      47             : 
      48             : /* unused */
      49             : void ellprint(GEN e);
      50             : 
      51             : /* binary splitting */
      52             : struct abpq { GEN *a, *b, *p, *q; };
      53             : struct abpq_res { GEN P, Q, B, T; };
      54             : void abpq_init(struct abpq *A, long n);
      55             : void abpq_sum(struct abpq_res *r, long n1, long n2, struct abpq *A);
      56             : 
      57             : /* generic */
      58             : GEN trans_fix_arg(long *prec, GEN *s0, GEN *sig, GEN *tau, pari_sp *av, GEN *res);
      59             : GEN sort_factor_pol(GEN y, int (*cmp)(GEN,GEN));
      60             : 
      61             : /* loops */
      62             : GEN incloop(GEN a);
      63             : GEN resetloop(GEN a, GEN b);
      64             : GEN setloop(GEN a);
      65             : 
      66             : /* parser */
      67             : GEN  iferrpari(GEN a, GEN b, GEN c);
      68             : void forpari(GEN a, GEN b, GEN node);
      69             : void untilpari(GEN a, GEN b);
      70             : void whilepari(GEN a, GEN b);
      71             : GEN  ifpari(GEN g, GEN a, GEN b);
      72             : GEN  andpari(GEN a, GEN b);
      73             : GEN  orpari(GEN a, GEN b);
      74             : void ifpari_void(GEN g, GEN a, GEN b);
      75             : GEN  ifpari_multi(GEN g, GEN a);
      76             : GEN  geval_gp(GEN x, GEN t);
      77             : 
      78             : GEN  gadde(GEN *x, GEN y);
      79             : GEN  gadd1e(GEN *x);
      80             : GEN  gdive(GEN *x, GEN y);
      81             : GEN  gdivente(GEN *x, GEN y);
      82             : GEN  gdivrounde(GEN *x, GEN y);
      83             : GEN  gmode(GEN *x, GEN y);
      84             : GEN  gmule(GEN *x, GEN y);
      85             : GEN  gshiftle(GEN *x, long n);
      86             : GEN  gshiftre(GEN *x, long n);
      87             : GEN  gsube(GEN *x, GEN y);
      88             : GEN  gsub1e(GEN *x);
      89             : GEN  gshift_right(GEN x, long n);
      90             : 
      91             : GEN  asympnum0(GEN u, long muli, GEN alpha, long prec);
      92             : GEN  derivnum0(GEN a, GEN code, long prec);
      93             : GEN  derivfun0(GEN code, GEN args, long prec);
      94             : GEN  direuler0(GEN a, GEN b, GEN code, GEN c);
      95             : GEN  direuler_bad(void *E, GEN (*eval)(void *, GEN), GEN a, GEN b, GEN c, GEN Sbad);
      96             : void forcomposite(GEN a, GEN b, GEN code);
      97             : void fordiv(GEN a, GEN code);
      98             : void forell0(long a, long b, GEN code, long flag);
      99             : void forprime(GEN a, GEN b, GEN code);
     100             : void forstep(GEN a, GEN b, GEN s, GEN code);
     101             : void forsubgroup0(GEN cyc, GEN bound, GEN code);
     102             : void forvec(GEN x, GEN code, long flag);
     103             : void forpart0(GEN k, GEN code , GEN nbound, GEN abound);
     104             : GEN  intcirc0(GEN a, GEN R, GEN code, GEN tab, long prec);
     105             : GEN  intfuncinit0(GEN a, GEN b, GEN code, long m, long prec);
     106             : GEN  intnum0(GEN a, GEN b, GEN code, GEN tab, long prec);
     107             : GEN  intnumgauss0(GEN a, GEN b, GEN code, GEN tab, long prec);
     108             : GEN  intnumromb0_bitprec(GEN a, GEN b, GEN code, long flag, long bit);
     109             : GEN  limitnum0(GEN u, long muli, GEN alpha, long prec);
     110             : GEN  matrice(GEN nlig, GEN ncol, GEN code);
     111             : GEN  prodeuler0(GEN a, GEN b, GEN code, long prec);
     112             : GEN  prodinf0(GEN a, GEN code, long flag, long prec);
     113             : GEN  produit(GEN a, GEN b, GEN code, GEN x);
     114             : GEN  somme(GEN a, GEN b, GEN code, GEN x);
     115             : GEN  sumalt0(GEN a, GEN code,long flag, long prec);
     116             : GEN  sumdivexpr(GEN num, GEN code);
     117             : GEN  sumdivmultexpr(GEN num, GEN code);
     118             : GEN  suminf0(GEN a, GEN code, long prec);
     119             : GEN  sumnum0(GEN a, GEN code, GEN tab, long prec);
     120             : GEN  sumnummonien0(GEN a, GEN code, GEN tab, long prec);
     121             : GEN  sumpos0(GEN a, GEN code, long flag,long prec);
     122             : GEN  vecexpr0(GEN nmax, GEN code, GEN pred);
     123             : GEN  vecexpr1(GEN nmax, GEN code, GEN pred);
     124             : GEN  vecteursmall(GEN nmax, GEN code);
     125             : GEN  vecteur(GEN nmax, GEN n);
     126             : GEN  vvecteur(GEN nmax, GEN n);
     127             : GEN  zbrent0(GEN a, GEN b, GEN code, long prec);
     128             : GEN  solvestep0(GEN a, GEN b, GEN step, GEN code, long flag, long prec);
     129             : 
     130             : /* mt */
     131             : void mt_sigint(void);
     132             : void mt_err_recover(long er);
     133             : void mt_init_stack(size_t s);
     134             : int  mt_is_thread(void);
     135             : GEN  parapply_worker(GEN d, GEN code);
     136             : GEN  pareval_worker(GEN code);
     137             : void parfor0(GEN a, GEN b, GEN code, GEN code2);
     138             : GEN  parfor_worker(GEN i, GEN C);
     139             : void parforprime0(GEN a, GEN b, GEN code, GEN code2);
     140             : void parforvec0(GEN a, GEN code, GEN code2, long flag);
     141             : GEN  parvector_worker(GEN i, GEN C);
     142             : GEN  polmodular_worker(ulong p, ulong t, ulong L, GEN hilb, GEN factu,
     143             :        GEN vne, GEN vinfo, long compute_derivs, GEN j_powers, GEN fdb);
     144             : GEN  nmV_polint_center_tree_worker(GEN Va, GEN T, GEN R, GEN xa, GEN m2);
     145             : GEN  ZX_resultant_worker(GEN P, GEN A, GEN B, GEN dB);
     146             : 
     147             : /* multiprecision */
     148             : GEN   addrex01(GEN x);
     149             : GEN   adduispec_offset(ulong s, GEN x, long offset, long nx);
     150             : int   lgcdii(ulong* d, ulong* d1, ulong* u, ulong* u1, ulong* v, ulong* v1, ulong vmax);
     151             : ulong rgcduu(ulong d, ulong d1, ulong vmax, ulong* u, ulong* u1, ulong* v, ulong* v1, long *s);
     152             : ulong xgcduu(ulong d, ulong d1, int f, ulong* v, ulong* v1, long *s);
     153             : ulong xxgcduu(ulong d, ulong d1, int f, ulong* u, ulong* u1, ulong* v, ulong* v1, long *s);
     154             : GEN   divgunu(GEN x, ulong i);
     155             : GEN   divrunu(GEN x, ulong i);
     156             : GEN   muliispec(GEN x, GEN y, long nx, long ny);
     157             : GEN   red_montgomery(GEN T, GEN N, ulong inv);
     158             : GEN   sqrispec(GEN x, long nx);
     159             : GEN   subrex01(GEN x);
     160             : GEN   modr_safe(GEN x, GEN y);
     161             : ulong *convi(GEN x, long *l);
     162             : 
     163             : int approx_0(GEN x, GEN y);
     164             : GEN bernfrac_using_zeta(long n);
     165             : 
     166             : /* powers */
     167             : GEN    rpowuu(ulong a, ulong n, long prec);
     168             : 
     169             : /* floats */
     170             : double dabs(double s, double t);
     171             : void   dcxlog(double s, double t, double *a, double *b);
     172             : double dnorm(double s, double t);
     173             : double dbllog2(GEN z);
     174             : 
     175             : /* hnf */
     176             : GEN hnfadd(GEN m,GEN p,GEN* ptdep,GEN* ptA,GEN* ptC,GEN extramat,GEN extraC);
     177             : GEN hnfadd_i(GEN m,GEN p,GEN* ptdep,GEN* ptA,GEN* ptC,GEN extramat,GEN extraC);
     178             : GEN hnfspec_i(GEN m,GEN p,GEN* ptdep,GEN* ptA,GEN* ptC,long k0);
     179             : GEN hnfspec(GEN m,GEN p,GEN* ptdep,GEN* ptA,GEN* ptC,long k0);
     180             : GEN mathnfspec(GEN x, GEN *ptperm, GEN *ptdep, GEN *ptB, GEN *ptC);
     181             : GEN ZM_hnfmodall_i(GEN x, GEN dm, long flag);
     182             : 
     183             : GEN LLL_check_progress(GEN Bnorm, long n0, GEN m, int final, long *ti_LLL);
     184             : GEN extendedgcd(GEN A);
     185             : 
     186             : /* miscellaneous linear algebra */
     187             : GEN  imagecomplspec(GEN x, long *nlze);
     188             : GEN  ZM_imagecomplspec(GEN x, long *nlze);
     189             : GEN  dim1proj(GEN prh);
     190             : GEN  detcyc(GEN cyc, long *L);
     191             : 
     192             : GEN merge_factor_i(GEN f, GEN g);
     193             : 
     194             : /* integer factorization / discrete log */
     195             : GEN   coprime_part(GEN x, GEN f);
     196             : ulong ucoprime_part(ulong x, ulong f);
     197             : ulong is_kth_power(GEN x, ulong p, GEN *pt);
     198             : GEN   mpqs(GEN N);
     199             : ulong gcduodd(ulong x, ulong y);
     200             : 
     201             : /* Polynomials */
     202             : /* a) Arithmetic/conversions */
     203             : GEN  addmulXn(GEN x, GEN y, long d);
     204             : GEN  addshiftpol(GEN x, GEN y, long d);
     205             : GEN  lift_if_rational(GEN x);
     206             : GEN  monomial(GEN a, long degpol, long v);
     207             : GEN  monomialcopy(GEN a, long degpol, long v);
     208             : GEN  mulmat_pol(GEN A, GEN x);
     209             : GEN  ser2pol_i(GEN x, long lx);
     210             : GEN  ser2rfrac_i(GEN x);
     211             : GEN  shiftpol_i(GEN x, long v);
     212             : GEN  swap_vars(GEN b0, long v);
     213             : GEN  RgX_recipspec_shallow(GEN x, long l, long n);
     214             : 
     215             : /* b) Modular */
     216             : GEN  bezout_lift_fact(GEN T, GEN Tmod, GEN p, long e);
     217             : long F2x_split_Berlekamp(GEN *t);
     218             : long Flx_split_Berlekamp(GEN *t, ulong p);
     219             : long FpX_split_Berlekamp(GEN *t, GEN pp);
     220             : long FqX_split_Berlekamp(GEN *t, GEN T, GEN p);
     221             : GEN  FpX_quad_root(GEN x, GEN p, int unknown);
     222             : GEN  FqX_split_all(GEN z, GEN T, GEN p);
     223             : long FqX_split_by_degree(GEN *pz, GEN u, GEN T, GEN p);
     224             : long FqX_split_deg1(GEN *pz, GEN u, GEN T, GEN p);
     225             : GEN  FqX_split_roots(GEN z, GEN T, GEN p, GEN pol);
     226             : GEN  polsym_gen(GEN P, GEN y0, long n, GEN T, GEN N);
     227             : GEN  ZXQ_charpoly_sqf(GEN A, GEN B, long *lambda, long v);
     228             : GEN  ZX_disc_all(GEN,ulong);
     229             : GEN  ZX_resultant_all(GEN A, GEN B, GEN dB, ulong bound);
     230             : GEN  ZX_ZXY_resultant_all(GEN A, GEN B, long *lambda, GEN *LPRS);
     231             : GEN  RgXQ_minpoly_naive(GEN y, GEN P);
     232             : GEN lift_intern(GEN x);
     233             : 
     234             : /* c) factorization */
     235             : GEN chk_factors_get(GEN lt, GEN famod, GEN c, GEN T, GEN N);
     236             : long cmbf_maxK(long nb);
     237             : GEN ZX_DDF(GEN x);
     238             : GEN initgaloisborne(GEN T, GEN dn, long prec, GEN *pL, GEN *pprep, GEN *pdis);
     239             : GEN logmax_modulus_bound(GEN p);
     240             : GEN polint_i(GEN xa, GEN ya, GEN x, long n, GEN *ptdy);
     241             : GEN quicktrace(GEN x, GEN sym);
     242             : GEN special_pivot(GEN x);
     243             : 
     244             : /* Relative number fields */
     245             : enum { rnf_NFABS = 1, rnf_MAPS };
     246             : 
     247             : /* Finite fields */
     248             : enum { t_FF_FpXQ = 0, t_FF_Flxq = 1, t_FF_F2xq = 2 };
     249             : GEN FF_ellinit(GEN E, GEN fg);
     250             : GEN FF_elldata(GEN E, GEN fg);
     251             : 
     252             : /* L functions */
     253             : enum { t_LFUN_GENERIC, t_LFUN_ZETA, t_LFUN_NF, t_LFUN_ELL, t_LFUN_KRONECKER,
     254             :        t_LFUN_CHIZ, t_LFUN_CHIGEN, t_LFUN_ETA,
     255             :        t_LFUN_DIV, t_LFUN_MUL, t_LFUN_CONJ,
     256             :        t_LFUN_SYMSQ_ELL, t_LFUN_QF, t_LFUN_ARTIN,
     257             :        t_LFUN_GENUS2 };
     258             : enum { t_LDESC_INIT, t_LDESC_THETA, t_LDESC_PRODUCT };
     259             : 
     260             : /* Elliptic curves */
     261             : /* common to Q and Rg */
     262             : enum { R_PERIODS = 1, R_ETA, R_ROOTS, R_AB };
     263             : 
     264             : enum { Qp_ROOT = 1, Qp_TATE };
     265             : enum { Q_GROUPGEN = 5, Q_GLOBALRED, Q_ROOTNO, Q_MINIMALMODEL };
     266             : enum { NF_MINIMALMODEL = 1 };
     267             : 
     268             : /* common to Fp and Fq */
     269             : enum { FF_CARD = 1, FF_GROUP, FF_GROUPGEN, FF_O };
     270             : 
     271             : /* for Buchall_param */
     272             : enum { fupb_NONE, fupb_RELAT, fupb_LARGE, fupb_PRECI };
     273             : 
     274             : 
     275             : /* Polycyclic presentation for the classgroup of discriminant D. */
     276             : typedef struct {
     277             :   /* Negative discriminant */
     278             :   long D;
     279             :   /* Size of classgroup */
     280             :   long h;
     281             :   /* Either h or h/2 (if L0 is set) */
     282             :   long enum_cnt;
     283             :   /* If nonzero, L0=L[0] and n[0]=2 and classpoly is a perfect square
     284             :    * (and we enumerate each double root just once), default is 0 */
     285             :   long L0;
     286             :   /* Product of primes L that are prohibited as norms of generators or
     287             :    * auxilliary prime forms (by default, primes that make enumeration
     288             :    * hard) */
     289             :   long Lfilter;
     290             :   /* Norms of implicit generators (primeforms a=(L*x^2+b*x*y+c*y^2)
     291             :    * with norm L and b >=0) */
     292             :   long *L;
     293             :   /* Partial products of relative orders (equivalently, m[i] is the
     294             :    * order of the subgroup generated by generators 1,...i) */
     295             :   long *m;
     296             :   /* Relative orders */
     297             :   long *n;
     298             :   /* Absolute orders */
     299             :   long *o;
     300             :   /* Power relations (a[i]^n[i] = a[0]^e[0]*...*a[i-1]^e[i-1], where e
     301             :    * is an exponent vector of length i stored at offset binom(i,2) of
     302             :    * r) */
     303             :   long *r;
     304             :   /* Optional list of norms of orienting primes p ... */
     305             :   long *orient_p;
     306             :   /* ... or product of primes p*q (q=1 when only p is needed) */
     307             :   long *orient_q;
     308             :   /* Representation of orienting norm p*q in terms of Ls */
     309             :   long *orient_reps;
     310             :   /* Associated invariant */
     311             :   long inv;
     312             :   /* Number of generators */
     313             :   long k;
     314             :   GEN _data; /* Storage space for the above arrays */
     315             : } classgp_pcp_struct;
     316             : typedef classgp_pcp_struct classgp_pcp_t[1];
     317             : 
     318             : /*
     319             :  * Represents the data in the equation(s)
     320             :  *
     321             :  *   4p = t^2 - v^2 D = t^2 - v^2 u^2 D_K = w^2 D_K.
     322             :  *
     323             :  * t is the absolute trace, so always > 0.
     324             :  * T is a twisting parameter, which satisfies (T|p) == -1.
     325             :  */
     326             : typedef struct {
     327             :   long D;
     328             :   long t, u, v;
     329             :   ulong p, pi;
     330             :   ulong T;
     331             : } norm_eqn_struct;
     332             : typedef norm_eqn_struct norm_eqn_t[1];
     333             : 
     334             : #define zv_to_longptr(v) (&((v)[1]))
     335             : #define zv_to_ulongptr(v) ((ulong *)&((v)[1]))
     336             : 
     337             : /* Isogeny volcanos */
     338             : long j_level_in_volcano(
     339             :   GEN phi, ulong j, ulong p, ulong pi, long L, long depth);
     340             : ulong ascend_volcano(
     341             :   GEN phi, ulong j, ulong p, ulong pi, long level, long L, long depth,
     342             :   long steps);
     343             : ulong descend_volcano(
     344             :   GEN phi, ulong j, ulong p, ulong pi, long level, long L, long depth,
     345             :   long steps);
     346             : 
     347             : long next_surface_nbr(
     348             :   ulong *nJ,
     349             :   GEN phi, long L, long h, ulong J, const ulong *pJ, ulong p, ulong pi);
     350             : GEN enum_roots(ulong j, norm_eqn_t ne, GEN fdb, classgp_pcp_t G);
     351             : 
     352             : /* Modular invariants */
     353             : #define INV_J       0
     354             : #define INV_F       1
     355             : #define INV_F2      2
     356             : #define INV_F3      3
     357             : #define INV_F4      4
     358             : #define INV_G2      5
     359             : #define INV_W2W3    6
     360             : #define INV_F8      8
     361             : #define INV_W3W3    9
     362             : #define INV_W2W5    10
     363             : #define INV_W2W7    14
     364             : #define INV_W3W5    15
     365             : #define INV_W3W7    21
     366             : #define INV_W2W3E2  23
     367             : #define INV_W2W5E2  24
     368             : #define INV_W2W13   26
     369             : #define INV_W2W7E2  27
     370             : #define INV_W3W3E2  28
     371             : #define INV_W5W7    35
     372             : #define INV_W3W13   39
     373             : 
     374             : int inv_is_valid(long inv);
     375             : long inv_level(long inv);
     376             : long inv_degree(long *p1, long *p2, long inv);
     377             : long inv_ramified(long D, long inv);
     378             : double inv_height_factor(long inv);
     379             : int inv_good_discriminant(long D, long inv);
     380             : int inv_good_prime(long p, long inv);
     381             : int inv_weber(long inv);
     382             : int inv_double_eta(long inv);
     383             : long inv_j_from_2double_eta(long inv, ulong *j, ulong x0, ulong x1, ulong p, ulong pi);
     384             : ulong modfn_root(ulong j, norm_eqn_t ne, long inv);
     385             : long modfn_unambiguous_root(ulong *r, long inv, ulong j0, norm_eqn_t ne, GEN jdb);
     386             : GEN qfb_nform(long D, long n);
     387             : 
     388             : /* Get coefficient of x^d in f, assuming f is nonzero. */
     389    13616556 : INLINE ulong Flx_coeff(GEN f, long d) { return f[d + 2]; }
     390             : /* Return the root of f, assuming deg(f) = 1. */
     391      210112 : INLINE ulong Flx_deg1_root(GEN f, ulong p) {
     392      210112 :   if (degpol(f) != 1) pari_err_BUG("Flx_deg1_root");
     393      210111 :   return Fl_div(Fl_neg(Flx_coeff(f, 0), p), Flx_coeff(f, 1), p);
     394             : }
     395             : 
     396             : /* Internal polclass and polmodular functions, to allow sharing
     397             :  * modular polynomial cache */
     398             : GEN polclass0(long D, long inv, long xvar, GEN *db);
     399             : GEN polmodular0_ZM(long L, long inv, GEN J, GEN Q, int compute_derivs, GEN *db);
     400             : GEN Flm_Fl_polmodular_evalx(GEN phi, long L, ulong j, ulong p, ulong pi);
     401             : 
     402             : /* Polmodular database maintenance */
     403             : GEN polmodular_db_init(long inv);
     404             : void polmodular_db_clear(GEN db);
     405             : void polmodular_db_add_level(GEN *db, long L, long inv);
     406             : void polmodular_db_add_levels(GEN *db, long *levels, long k, long inv);
     407             : GEN polmodular_db_for_inv(GEN db, long inv);
     408             : GEN polmodular_db_getp(GEN fdb, long L, ulong p);
     409             : 
     410             : void random_curves_with_m_torsion(
     411             :   ulong *a4, ulong *a6, ulong *tx, ulong *ty,
     412             :   long ncurves, long m, ulong p);
     413             : 
     414             : /* Allocation / gerepile */
     415             : long   getdebugvar(void);
     416             : void   setdebugvar(long n);
     417             : void   debug_stack(void);
     418             : void   fill_stack(void);
     419             : void   init_dalloc(void);
     420             : double *dalloc(size_t n);
     421             : void   minim_alloc(long n, double ***q, GEN *x, double **y,  double **z, double **v);
     422             : int    pop_entree_block(entree *ep, long loc);
     423             : int    pop_val_if_newer(entree *ep, long loc);
     424             : 
     425             : /* general printing */
     426             : void print_errcontext(PariOUT *out, const char *msg, const char *s, const char *entry);
     427             : void print_prefixed_text(PariOUT *out, const char *s, const char *prefix, const char *str);
     428             : INLINE void
     429          56 : print_text(const char *s) { print_prefixed_text(pariOut, s,NULL,NULL); }
     430             : INLINE void
     431        5411 : out_print_text(PariOUT *out, const char *s) { print_prefixed_text(out, s,NULL,NULL); }
     432             : INLINE long
     433     1366578 : is_keyword_char(char c) { return (isalnum((int)c) || c=='_'); }
     434             : 
     435             : /* Interfaces (GP, etc.) */
     436             : hashtable *hash_from_link(GEN e, GEN names, int use_stack);
     437             : void gen_relink(GEN x, hashtable *table);
     438             : entree* do_alias(entree *ep);
     439             : char* get_sep(const char *t);
     440             : long get_int(const char *s, long dflt);
     441             : ulong get_uint(const char *s);
     442             : int  gp_init_functions(void);
     443             : void gp_initrc(pari_stack *p_A);
     444             : 
     445             : void pari_sigint(const char *s);
     446             : pariFILE *pari_last_tmp_file(void);
     447             : void* get_stack(double fraction, long min);
     448             : void  init_graph(void);
     449             : void  free_graph(void);
     450             : void  initout(int initerr);
     451             : void  resetout(int initerr);
     452             : void  init_linewrap(long w);
     453             : void  pari_kernel_init(void);
     454             : void  pari_kernel_close(void);
     455             : void  print_functions_hash(const char *s);
     456             : void  print_all_user_fun(int member);
     457             : GEN   readbin(const char *name, FILE *f, int *vector);
     458             : int   term_height(void);
     459             : int   term_width(void);
     460             : void  whatnow_new_syntax(const char *f, long n);
     461             : /* gp_colors */
     462             : void decode_color(long n, long *c);
     463             : 
     464             : /* defaults */
     465             : extern long precreal;
     466             : 
     467             : void lim_lines_output(char *s, long n, long max);
     468             : int tex2mail_output(GEN z, long n);
     469             : void gen_output(GEN x, pariout_t *T);
     470             : void fputGEN_pariout(GEN x, pariout_t *T, FILE *out);
     471             : 
     472             : void parsestate_reset(void);
     473             : void parsestate_save(struct pari_parsestate *state);
     474             : void parsestate_restore(struct pari_parsestate *state);
     475             : 
     476             : void compilestate_reset(void);
     477             : void compilestate_save(struct pari_compilestate *comp);
     478             : void compilestate_restore(struct pari_compilestate *comp);
     479             : 
     480             : void evalstate_clone(void);
     481             : void evalstate_reset(void);
     482             : void evalstate_restore(struct pari_evalstate *state);
     483             : GEN  evalstate_restore_err(struct pari_evalstate *state);
     484             : void evalstate_save(struct pari_evalstate *state);
     485             : void varstate_save(struct pari_varstate *s);
     486             : void varstate_restore(struct pari_varstate *s);
     487             : 
     488             : void mtstate_save(long *pending);
     489             : void mtstate_reset(void);
     490             : void mtstate_restore(long *pending);
     491             : 
     492             : void pari_thread_init_varstate();
     493             : void pari_pthread_init_varstate();
     494             : 
     495             : void debug_context(void);
     496             : 
     497             : typedef struct {
     498             :   const char *s;
     499             :   size_t ls;
     500             :   char **dir;
     501             : } forpath_t;
     502             : void forpath_init(forpath_t *T, gp_path *path, const char *s);
     503             : char *forpath_next(forpath_t *T);
     504             : 
     505             : /* GP output && output format */
     506             : void gpwritebin(const char *s, GEN x);
     507             : extern char *current_logfile;
     508             : 
     509             : /* colors */
     510             : extern long    gp_colors[];
     511             : extern int     disable_color;
     512             : 
     513             : /* entrees */
     514             : #define EpVALENCE(ep) ((ep)->valence & 0xFF)
     515             : #define EpSTATIC(ep) ((ep)->valence & 0x100)
     516             : #define EpSETSTATIC(ep) ((ep)->valence |= 0x100)
     517             : enum { EpNEW = 100, EpALIAS, EpVAR, EpINSTALL };
     518             : #define initial_value(ep) ((ep)+1)
     519             : 
     520             : /* functions lists */
     521             : extern const long functions_tblsz;  /* hashcodes table size */
     522             : extern entree **functions_hash;   /* functions hashtable */
     523             : extern entree **defaults_hash;    /* defaults hashtable */
     524             : 
     525             : /* buffers */
     526             : typedef struct Buffer {
     527             :   char *buf;
     528             :   ulong len;
     529             :   jmp_buf env;
     530             : } Buffer;
     531             : Buffer *new_buffer(void);
     532             : void delete_buffer(Buffer *b);
     533             : void fix_buffer(Buffer *b, long newlbuf);
     534             : 
     535             : typedef struct {
     536             :   const char *s; /* source */
     537             :   char *t, *end; /* target, last char read */
     538             :   int in_string, in_comment, more_input, wait_for_brace;
     539             :   Buffer *buf;
     540             : } filtre_t;
     541             : void init_filtre(filtre_t *F, Buffer *buf);
     542             : Buffer *filtered_buffer(filtre_t *F);
     543             : const char *break_loop_prompt(long n);
     544             : void kill_buffers_upto_including(Buffer *B);
     545             : void pop_buffer(void);
     546             : void kill_buffers_upto(Buffer *B);
     547             : int gp_read_line(filtre_t *F, const char *PROMPT);
     548             : void parse_key_val(char *src, char **ps, char **pt);
     549             : void pari_init_buffers(void);
     550             : extern int (*cb_pari_get_line_interactive)(const char*, const char*, filtre_t *F);
     551             : extern char *(*cb_pari_fgets_interactive)(char *s, int n, FILE *f);
     552             : int get_line_from_file(const char *prompt, filtre_t *F, FILE *file);
     553             : void pari_skip_space(char **s);
     554             : void pari_skip_alpha(char **s);
     555             : char *pari_translate_string(const char *src, char *s, char *entry);
     556             : 
     557             : gp_data *default_gp_data(void);
     558             : 
     559             : void delete_dirs(gp_path *p);
     560             : void gp_expand_path(gp_path *p);
     561             : const char *pari_default_path(void);
     562             : int path_is_absolute(char *s);
     563             : 
     564             : typedef char *(*fgets_t)(char *, int, void*);
     565             : 
     566             : typedef struct input_method {
     567             : /* optional */
     568             :   fgets_t fgets;  /* like libc fgets() but last argument is (void*) */
     569             : /* mandatory */
     570             :   char * (*getline)(char**, int f, struct input_method*, filtre_t *F);
     571             :   int free; /* boolean: must we free the output of getline() ? */
     572             : /* optional */
     573             :   const char *prompt, *prompt_cont;
     574             :   void *file;  /* can be used as last argument for fgets() */
     575             : } input_method;
     576             : 
     577             : int input_loop(filtre_t *F, input_method *IM);
     578             : char *file_input(char **s0, int junk, input_method *IM, filtre_t *F);
     579             : char *file_getline(Buffer *b, char **s0, input_method *IM);
     580             : 
     581             : /* readline */
     582             : typedef struct {
     583             :   /* pointers to readline variables/functions */
     584             :   char **line_buffer;
     585             :   int *point;
     586             :   int *end;
     587             :   char **(*completion_matches)(const char *, char *(*)(const char*, int));
     588             :   char *(*filename_completion_function)(const char *, int);
     589             :   char *(*username_completion_function)(const char *, int);
     590             :   int (*insert)(int, int);
     591             :   int *completion_append_character;
     592             : 
     593             :   /* PARI-specific */
     594             :   int back;  /* rewind the cursor by this number of chars */
     595             : } pari_rl_interface;
     596             : 
     597             : /* Code which wants to use readline needs to do the following:
     598             : 
     599             : #include <readline.h>
     600             : #include <paripriv.h>
     601             : pari_rl_interface pari_rl;
     602             : pari_use_readline(pari_rl);
     603             : 
     604             : This will initialize the pari_rl structure. A pointer to this structure
     605             : must be given as first argument to all PARI readline functions. */
     606             : 
     607             : /* IMPLEMENTATION NOTE: this really must be a macro (not a function),
     608             :  * since we refer to readline symbols. */
     609             : #define pari_use_readline(pari_rl) do {\
     610             :     (pari_rl).line_buffer = &rl_line_buffer; \
     611             :     (pari_rl).point = &rl_point; \
     612             :     (pari_rl).end = &rl_end; \
     613             :     (pari_rl).completion_matches = &rl_completion_matches; \
     614             :     (pari_rl).filename_completion_function = &rl_filename_completion_function; \
     615             :     (pari_rl).username_completion_function = &rl_username_completion_function; \
     616             :     (pari_rl).insert = &rl_insert; \
     617             :     (pari_rl).completion_append_character = &rl_completion_append_character; \
     618             :     (pari_rl).back = 0; } while(0)
     619             : 
     620             : 
     621             : /* By files */
     622             : 
     623             : /* Qfb.c */
     624             : 
     625             : GEN     redimagsl2(GEN q, GEN *U);
     626             : GEN     redrealsl2(GEN V, GEN d, GEN rd);
     627             : GEN     redrealsl2step(GEN A, GEN d, GEN rd);
     628             : GEN     redtausl2(GEN t, GEN *U);
     629             : 
     630             : /* alglin1.c */
     631             : 
     632             : typedef long (*pivot_fun)(GEN,GEN,long,GEN);
     633             : GEN ZM_pivots(GEN x0, long *rr);
     634             : GEN RgM_pivots(GEN x0, GEN data, long *rr, pivot_fun pivot);
     635             : void RgMs_structelim_col(GEN M, long nbcol, long nbrow, GEN A, GEN *p_col, GEN *p_lin);
     636             : 
     637             : /* arith1.c */
     638             : 
     639             : int     is_gener_Fp(GEN x, GEN p, GEN p_1, GEN L);
     640             : int     is_gener_Fl(ulong x, ulong p, ulong p_1, GEN L);
     641             : 
     642             : /* arith2.c */
     643             : 
     644             : int     divisors_init(GEN n, GEN *pP, GEN *pE);
     645             : long    set_optimize(long what, GEN g);
     646             : 
     647             : /* base2.c */
     648             : 
     649             : GEN     gen_if_principal(GEN bnf, GEN x);
     650             : GEN     polsymmodp(GEN g, GEN p);
     651             : GEN     nfbasis_gp(GEN T);
     652             : 
     653             : /* base3.c */
     654             : 
     655             : void    check_nfelt(GEN x, GEN *den);
     656             : GEN     zk_ei_mul(GEN nf, GEN x, long i);
     657             : 
     658             : /* base4.c */
     659             : 
     660             : void    check_listpr(GEN x);
     661             : GEN     extideal_HNF_mul(GEN nf, GEN x, GEN y);
     662             : GEN     factor_norm(GEN x);
     663             : GEN     factorbackprime(GEN nf, GEN L, GEN e);
     664             : long    val_norm(GEN x, GEN p, long *vz);
     665             : 
     666             : /* base5.c */
     667             : 
     668             : GEN     check_and_build_nfabs(GEN rnf, long prec);
     669             : void    rnfcomplete(GEN rnf);
     670             : 
     671             : /* buch1.c */
     672             : 
     673             : GEN     form_to_ideal(GEN x);
     674             : GEN     qfbforms(GEN D);
     675             : 
     676             : /* buch2.c */
     677             : 
     678             : typedef struct GRHprime_t { ulong p; double logp; GEN dec; } GRHprime_t;
     679             : typedef struct GRHcheck_t { double cD, cN; GRHprime_t *primes; long clone, nprimes, maxprimes; ulong limp; forprime_t P; } GRHcheck_t;
     680             : void    free_GRHcheck(GRHcheck_t *S);
     681             : void    init_GRHcheck(GRHcheck_t *S, long N, long R1, double LOGD);
     682             : void    GRH_ensure(GRHcheck_t *S, long nb);
     683             : ulong   GRH_last_prime(GRHcheck_t *S);
     684             : int     GRHok(GRHcheck_t *S, double L, double SA, double SB);
     685             : GEN     check_and_build_matal(GEN bnf);
     686             : GEN     extract_full_lattice(GEN x);
     687             : GEN     init_red_mod_units(GEN bnf, long prec);
     688             : GEN     isprincipalarch(GEN bnf, GEN col, GEN kNx, GEN e, GEN dx, long *pe);
     689             : GEN     red_mod_units(GEN col, GEN z);
     690             : 
     691             : /* buch3.c */
     692             : 
     693             : GEN     minkowski_bound(GEN D, long N, long r2, long prec);
     694             : int     subgroup_conductor_ok(GEN H, GEN L);
     695             : GEN     subgrouplist_cond_sub(GEN bnr, GEN C, GEN bound);
     696             : 
     697             : /* ellsea.c */
     698             : 
     699             : void    pari_init_seadata(void);
     700             : void    pari_thread_init_seadata(void);
     701             : void    pari_pthread_init_seadata(void);
     702             : 
     703             : /* es.c */
     704             : 
     705             : const char * eng_ord(long i);
     706             : char *  env_ok(const char *s);
     707             : void    filestate_restore(pariFILE *F);
     708             : void    killallfiles(void);
     709             : pariFILE* newfile(FILE *f, const char *name, int type);
     710             : void    pari_init_homedir(void);
     711             : void    pari_close_homedir(void);
     712             : void    pari_init_files(void);
     713             : void    pari_thread_close_files(void);
     714             : void    pari_close_files(void);
     715             : int     popinfile(void);
     716             : pariFILE* try_pipe(const char *cmd, int flag);
     717             : 
     718             : /* Flx.c */
     719             : 
     720             : GEN FlxqM_mul_Kronecker(GEN A, GEN B, GEN T, ulong p);
     721             : 
     722             : /* Flxq_log.c */
     723             : 
     724             : GEN Flxq_log_index(GEN a0, GEN b0, GEN m, GEN T0, ulong p);
     725             : int Flxq_log_use_index(GEN m, GEN T0, ulong p);
     726             : 
     727             : /* FlxqE.c */
     728             : 
     729             : GEN     ZpXQ_norm_pcyc(GEN x, GEN T, GEN q, GEN p);
     730             : long    zx_is_pcyc(GEN T);
     731             : 
     732             : /* FpV.c */
     733             : 
     734             : GEN FpMs_leftkernel_elt_col(GEN M, long nbcol, long nbrow, GEN p);
     735             : 
     736             : /* forprime.c*/
     737             : 
     738             : void    pari_close_primes(void);
     739             : void    init_modular(forprime_t *S);
     740             : void    init_modular_big(forprime_t *S);
     741             : void    init_modular_small(forprime_t *S);
     742             : 
     743             : /* galconj.c */
     744             : 
     745             : GEN     galoiscosets(GEN O, GEN perm);
     746             : GEN     listznstarelts(long m, long p);
     747             : GEN     matrixnorm(GEN M, long prec);
     748             : GEN     vandermondeinverseprep(GEN L);
     749             : 
     750             : /* galois.c */
     751             : 
     752             : GEN     polgaloisnamesbig(long n, long k);
     753             : 
     754             : /* gen1.c */
     755             : 
     756             : int     ff_poltype(GEN *x, GEN *p, GEN *pol);
     757             : GEN     gred_frac2(GEN x1, GEN x2);
     758             : GEN     gred_rfrac2(GEN x1, GEN x2);
     759             : GEN     gred_rfrac_simple(GEN n, GEN d);
     760             : GEN     sqr_ser_part(GEN x, long l1, long l2);
     761             : 
     762             : /* gen3.c */
     763             : 
     764             : GEN     gsubst_expr(GEN pol, GEN from, GEN to);
     765             : GEN     poltoser(GEN x, long v, long prec);
     766             : GEN     rfractoser(GEN x, long v, long prec);
     767             : 
     768             : /* hyperell.c */
     769             : 
     770             : GEN     ZlXQX_hyperellpadicfrobenius(GEN H, GEN T, ulong p, long n);
     771             : 
     772             : /* ifactor1.c */
     773             : 
     774             : GEN     ellfacteur(GEN n, int insist);
     775             : GEN     pollardbrent(GEN n);
     776             : ulong   snextpr(ulong p, byteptr *d, long *rcn, long *q, long k);
     777             : GEN     squfof(GEN n);
     778             : 
     779             : /* intnum.c */
     780             : 
     781             : GEN     contfraceval_inv(GEN CF, GEN tinv, long nlim);
     782             : 
     783             : /* prime.c */
     784             : 
     785             : long    BPSW_psp_nosmalldiv(GEN N);
     786             : int     Fl_MR_Jaeschke(ulong n, long k);
     787             : int     MR_Jaeschke(GEN n, long k);
     788             : long    isanypower_nosmalldiv(GEN N, GEN *px);
     789             : void    prime_table_next_p(ulong a, byteptr *pd, ulong *pp, ulong *pn);
     790             : int     uisprime_101(ulong n);
     791             : int     uisprime_661(ulong n);
     792             : 
     793             : /* init.c */
     794             : 
     795             : void    pari_init_defaults(void);
     796             : 
     797             : /* nffactor.c */
     798             : 
     799             : int     nfissplit(GEN nf, GEN x);
     800             : 
     801             : /* perm.c */
     802             : 
     803             : long    cosets_perm_search(GEN C, GEN p);
     804             : GEN     group_export_GAP(GEN G);
     805             : GEN     group_export_MAGMA(GEN G);
     806             : GEN     perm_generate(GEN S, GEN H, long o);
     807             : long    perm_relorder(GEN p, GEN S);
     808             : GEN     perm_to_GAP(GEN p);
     809             : 
     810             : /* polarit1.c */
     811             : 
     812             : GEN     F2x_Berlekamp_ker(GEN u);
     813             : GEN     Flx_Berlekamp_ker(GEN u, ulong p);
     814             : GEN     FpX_Berlekamp_ker(GEN u, GEN p);
     815             : GEN     FlxqX_Berlekamp_ker(GEN u, GEN T, ulong p);
     816             : GEN     FpXQX_Berlekamp_ker(GEN u, GEN T, GEN p);
     817             : GEN     F2x_factcantor(GEN f, long flag);
     818             : GEN     Flx_factcantor(GEN f, ulong p, long flag);
     819             : GEN     FpX_factcantor(GEN f, GEN pp, long flag);
     820             : int     cmp_padic(GEN x, GEN y);
     821             : GEN     factcantor0(GEN f, GEN pp, long flag);
     822             : 
     823             : /* polarit2.c */
     824             : 
     825             : GEN     sylvestermatrix_i(GEN x, GEN y);
     826             : 
     827             : /* QX_factor */
     828             : 
     829             : void    factor_quad(GEN x, GEN res, long *ptcnt);
     830             : 
     831             : /* FpX.c */
     832             : 
     833             : ulong   Flj_order_ufact(GEN P, ulong n, GEN F, ulong a4, ulong p, ulong pi);
     834             : 
     835             : /* FpX.c */
     836             : 
     837             : GEN     FpX_gcd_check(GEN x, GEN y, GEN p);
     838             : 
     839             : /* polarit3.c */
     840             : 
     841             : GEN     Flm_Frobenius_pow(GEN M, long d, GEN T, ulong p);
     842             : GEN     FpM_Frobenius_pow(GEN M, long d, GEN T, GEN p);
     843             : GEN     FpX_compositum(GEN A, GEN B, GEN p);
     844             : GEN     FpX_direct_compositum(GEN A, GEN B, GEN p);
     845             : ulong   ZX_ZXY_ResBound(GEN A, GEN B, GEN dB);
     846             : GEN     ffinit_Artin_Shreier(GEN ip, long l);
     847             : GEN     ffinit_rand(GEN p, long n);
     848             : 
     849             : /* random.c */
     850             : 
     851             : void    pari_init_rand(void);
     852             : 
     853             : /* readline.c */
     854             : 
     855             : char**  pari_completion(pari_rl_interface *pari_rl, char *text, int START, int END);
     856             : char*   pari_completion_word(pari_rl_interface *pari_rl, long end);
     857             : char**  pari_completion_matches(pari_rl_interface *pari_rl, const char *s, long pos, long *wordpos);
     858             : 
     859             : /* rootpol.c */
     860             : 
     861             : GEN     FFT(GEN x, GEN Omega);
     862             : GEN     FFTinit(long k, long prec);
     863             : 
     864             : /* subcyclo.c */
     865             : 
     866             : GEN     bnr_to_znstar(GEN bnr, long *complex);
     867             : GEN     galoiscyclo(long n, long v);
     868             : GEN     znstar_bits(long n, GEN H);
     869             : long    znstar_conductor(long n, GEN H);
     870             : GEN     znstar_cosets(long n, long phi_n, GEN H);
     871             : GEN     znstar_elts(long n, GEN H);
     872             : GEN     znstar_generate(long n, GEN V);
     873             : GEN     znstar_hnf(GEN Z, GEN M);
     874             : GEN     znstar_hnf_elts(GEN Z, GEN H);
     875             : GEN     znstar_hnf_generators(GEN Z, GEN M);
     876             : GEN     znstar_reduce_modulus(GEN H, long n);
     877             : GEN     znstar_small(GEN zn);
     878             : 
     879             : /* trans1.c */
     880             : 
     881             : GEN     logagmcx(GEN q, long prec);
     882             : void    pari_init_floats(void);
     883             : void    pari_close_floats(void);
     884             : GEN     rootsof1complex(GEN n, long prec);
     885             : GEN     rootsof1padic(GEN n, GEN y);
     886             : GEN     zellagmcx(GEN a0, GEN b0, GEN r, GEN t, long prec);
     887             : 
     888             : /* trans2.c */
     889             : 
     890             : GEN     cxpsi(GEN s0, long prec);
     891             : double  darg(double s, double t);
     892             : 
     893             : /* trans3.c */
     894             : 
     895             : GEN     bernreal_using_zeta(long n, GEN iz, long prec);
     896             : GEN     double_eta_quotient(GEN a, GEN w, GEN D, long p, long q, GEN pq, GEN sqrtD);
     897             : GEN     inv_szeta_euler(long n, double lba, long prec);
     898             : GEN     polylogd0(long m, GEN x, long flag, long prec);
     899             : GEN     trueE2(GEN tau, long prec);
     900             : 
     901             : ENDEXTERN

Generated by: LCOV version 1.11