bridge/class-master/depend/pari/src/basemath/rootpol.c
/* return the log of the k-th modulus r_k of p, rel. error tau, knowing that
 * rmin < r_k < rmax. This information helps because we may reduce precision
 * quicker */
return the log of the k-th modulus r_k of p, rel. error tau, knowing that
rmin < r_k < rmax. This information helps because we may reduce precision
quicker
return the log of the k - th modulus r_k of p rel . error tau knowing that rmin < r_k < rmax . This information helps because we may reduce precision quicker
static double
logpre_modulus(GEN p, long k, double tau, double lrmin, double lrmax)
{
  GEN q;
  long n = degpol(p), i, imax, imax2, bit;
  pari_sp ltop = avma, av;
  double lrho, aux, tau2 = tau/6.;
  aux = (lrmax - lrmin) / 2. + 4*tau2;
  imax = (long) log2(log((double)n)/ aux);
  if (imax <= 0) return logmodulus(p,k,tau);
  lrho  = (lrmin + lrmax) / 2;
  av = avma;
  bit = (long)(n*(2. + aux / M_LN2 - log2(tau2)));
  q = homothetie(p, lrho, bit);
  imax2 = (long)(log2(3./tau * log(4.*n))) + 1;
  if (imax > imax2) imax = imax2;
  for (i=0; i<imax; i++)
  {
    q = eval_rel_pol(q,bit);
    set_karasquare_limit(bit);
    q = gerepileupto(av, graeffe(q));
    aux = 2*aux + 2*tau2;
    tau2 *= 1.5;
    bit = (long)(n*(2. + aux / M_LN2 - log2(1-exp(-tau2))));
    q = RgX_gtofp_bit(q, bit);
  }
  aux = exp2((double)imax);
  aux = logmodulus(q,k, aux*tau/3.) / aux;
  avma = ltop; return lrho + aux;
}
static double logpre_modulus ( GEN p , long k , double tau , double lrmin , double lrmax ) { GEN q ; long n = degpol ( p ) , i , imax , imax2 , bit ; pari_sp ltop = avma , av ; double lrho , aux , tau2 = tau / 6. ; aux = ( lrmax - lrmin ) / 2. + 4 * tau2 ; imax = ( long ) log2 ( log ( ( double ) n ) / aux ) ; if ( imax <= 0 ) return logmodulus ( p , k , tau ) ; lrho = ( lrmin + lrmax ) / 2 ; av = avma ; bit = ( long ) ( n * ( 2. + aux / M_LN2 - log2 ( tau2 ) ) ) ; q = homothetie ( p , lrho , bit ) ; imax2 = ( long ) ( log2 ( 3. / tau * log ( 4. * n ) ) ) + 1 ; if ( imax > imax2 ) imax = imax2 ; for ( i = 0 ; i < imax ; i ++ ) { q = eval_rel_pol ( q , bit ) ; set_karasquare_limit ( bit ) ; q = gerepileupto ( av , graeffe ( q ) ) ; aux = 2 * aux + 2 * tau2 ; tau2 *= 1.5 ; bit = ( long ) ( n * ( 2. + aux / M_LN2 - log2 ( 1 - exp ( - tau2 ) ) ) ) ; q = RgX_gtofp_bit ( q , bit ) ; } aux = exp2 ( ( double ) imax ) ; aux = logmodulus ( q , k , aux * tau / 3. ) / aux ; avma = ltop ; return lrho + aux ; }
return the log of the k-th modulus r_k of p, rel.
return the log of the k - th modulus r_k of p rel .