bridge/class-master/depend/pari/src/basemath/rootpol.c
/* return the log of the k-th modulus (ascending order) of p, rel. error tau*/
return the log of the k-th modulus (ascending order) of p, rel. error tau
return the log of the k - th modulus ( ascending order ) of p rel . error tau
static double
logmodulus(GEN p, long k, double tau)
{
  GEN q;
  long i, kk = k, imax, n = degpol(p), nn, bit, e;
  pari_sp av, ltop=avma;
  double r, tau2 = tau/6;
  bit = (long)(n * (2. + log2(3.*n/tau2)));
  av = avma;
  q = gprec_w(p, nbits2prec(bit));
  q = RgX_gtofp_bit(q, bit);
  e = newton_polygon(q,k);
  r = (double)e;
  homothetie2n(q,e);
  imax = (long)(log2(3./tau) + log2(log(4.*n)))+1;
  for (i=1; i<imax; i++)
  {
    q = eval_rel_pol(q,bit);
    kk -= RgX_valrem(q, &q);
    nn = degpol(q);
    set_karasquare_limit(bit);
    q = gerepileupto(av, graeffe(q));
    e = newton_polygon(q,kk);
    r += e / exp2((double)i);
    q = RgX_gtofp_bit(q, bit);
    homothetie2n(q,e);
    tau2 *= 1.5; if (tau2 > 1.) tau2 = 1.;
    bit = 1 + (long)(nn*(2. + log2(3.*nn/tau2)));
  }
  avma = ltop; return -r * M_LN2;
}
static double logmodulus ( GEN p , long k , double tau ) { GEN q ; long i , kk = k , imax , n = degpol ( p ) , nn , bit , e ; pari_sp av , ltop = avma ; double r , tau2 = tau / 6 ; bit = ( long ) ( n * ( 2. + log2 ( 3. * n / tau2 ) ) ) ; av = avma ; q = gprec_w ( p , nbits2prec ( bit ) ) ; q = RgX_gtofp_bit ( q , bit ) ; e = newton_polygon ( q , k ) ; r = ( double ) e ; homothetie2n ( q , e ) ; imax = ( long ) ( log2 ( 3. / tau ) + log2 ( log ( 4. * n ) ) ) + 1 ; for ( i = 1 ; i < imax ; i ++ ) { q = eval_rel_pol ( q , bit ) ; kk -= RgX_valrem ( q , & q ) ; nn = degpol ( q ) ; set_karasquare_limit ( bit ) ; q = gerepileupto ( av , graeffe ( q ) ) ; e = newton_polygon ( q , kk ) ; r += e / exp2 ( ( double ) i ) ; q = RgX_gtofp_bit ( q , bit ) ; homothetie2n ( q , e ) ; tau2 *= 1.5 ; if ( tau2 > 1. ) tau2 = 1. ; bit = 1 + ( long ) ( nn * ( 2. + log2 ( 3. * nn / tau2 ) ) ) ; } avma = ltop ; return - r * M_LN2 ; }
return the log of the k-th modulus (ascending order) of p, rel.
return the log of the k - th modulus ( ascending order ) of p rel .