bridge/class-master/depend/pari/src/basemath/polarit2.c
/* return 0 if the subresultant chain can be interrupted.
 * Set u = NULL if the resultant is 0. */
return 0 if the subresultant chain can be interrupted.
Set u = NULL if the resultant is 0.
return 0 if the subresultant chain can be interrupted . Set u = NULL if the resultant is 0 .
static int
subres_step(GEN *u, GEN *v, GEN *g, GEN *h, GEN *uze, GEN *um1, long *signh)
{
  GEN u0, c, r, q = RgX_pseudodivrem(*u,*v, &r);
  long du, dv, dr, degq;
  if (gequal0(leading_coeff(r))) r = RgX_renormalize(r);
  dr = lg(r); if (!signe(r)) { *u = NULL; return 0; }
  du = degpol(*u);
  dv = degpol(*v);
  degq = du - dv;
  if (*um1 == gen_1)
    u0 = gpowgs(gel(*v,dv+2),degq+1);
  else if (*um1 == gen_0)
    u0 = gen_0;
  else 
    u0 = RgX_Rg_mul(*um1, gpowgs(gel(*v,dv+2),degq+1));
  if (*uze == gen_0) 
    u0 = scalarpol(u0, varn(*u)); 
  else
    u0 = gsub(u0, gmul(q,*uze));
  *um1 = *uze;
  *uze = u0; 
  *u = *v; c = *g; *g  = leading_coeff(*u);
  switch(degq)
  {
    case 0: break;
    case 1:
      c = gmul(*h,c); *h = *g; break;
    default:
      c = gmul(gpowgs(*h,degq), c);
      *h = gdivexact(gpowgs(*g,degq), gpowgs(*h,degq-1));
  }
  *v  = RgX_Rg_divexact(r,c);
  *uze= RgX_Rg_divexact(*uze,c);
  if (both_odd(du, dv)) *signh = -*signh;
  return (dr > 3);
}
static int subres_step ( GEN * u , GEN * v , GEN * g , GEN * h , GEN * uze , GEN * um1 , long * signh ) { GEN u0 , c , r , q = RgX_pseudodivrem ( * u , * v , & r ) ; long du , dv , dr , degq ; if ( gequal0 ( leading_coeff ( r ) ) ) r = RgX_renormalize ( r ) ; dr = lg ( r ) ; if ( ! signe ( r ) ) { * u = NULL ; return 0 ; } du = degpol ( * u ) ; dv = degpol ( * v ) ; degq = du - dv ; if ( * um1 == gen_1 ) u0 = gpowgs ( gel ( * v , dv + 2 ) , degq + 1 ) ; else if ( * um1 == gen_0 ) u0 = gen_0 ; else u0 = RgX_Rg_mul ( * um1 , gpowgs ( gel ( * v , dv + 2 ) , degq + 1 ) ) ; if ( * uze == gen_0 ) u0 = scalarpol ( u0 , varn ( * u ) ) ; else u0 = gsub ( u0 , gmul ( q , * uze ) ) ; * um1 = * uze ; * uze = u0 ; * u = * v ; c = * g ; * g = leading_coeff ( * u ) ; switch ( degq ) { case 0 : break ; case 1 : c = gmul ( * h , c ) ; * h = * g ; break ; default : c = gmul ( gpowgs ( * h , degq ) , c ) ; * h = gdivexact ( gpowgs ( * g , degq ) , gpowgs ( * h , degq - 1 ) ) ; } * v = RgX_Rg_divexact ( r , c ) ; * uze = RgX_Rg_divexact ( * uze , c ) ; if ( both_odd ( du , dv ) ) * signh = - * signh ; return ( dr > 3 ) ; }
return 0 if the subresultant chain can be interrupted.
return 0 if the subresultant chain can be interrupted .
/* except in those 2 cases, um1 is an RgX */ /* except in that case, uze is an RgX */ /* now an RgX */ /* uze <- lead(v)^(degq + 1) * um1 - q * uze */