bridge/class-master/depend/pari/src/basemath/mftrace.c
/* P a t_POL, 1 if spherical, 0 otherwise */
P a t_POL, 1 if spherical, 0 otherwise
P a t_POL 1 if spherical 0 otherwise
static long
RgX_isspherical(GEN Qi, GEN P)
{
  pari_sp av = avma;
  GEN va, S;
  long lva, i, j, r;
  if (degpol(P) <= 1) return 1;
  va = variables_vecsmall(P); lva = lg(va);
  if (lva > lg(Qi)) pari_err(e_MISC, "too many variables in mffromqf");
  S = gen_0;
  for (j = 1; j < lva; j++)
  {
    GEN col = gel(Qi, j), Pj = deriv(P, va[j]);
    for (i = 1; i <= j; i++)
    {
      GEN coe = gel(col, i);
      if (i != j) coe = gmul2n(coe, 1);
      if (!gequal0(coe)) S = gadd(S, gmul(coe, deriv(Pj, va[i])));
    }
  }
  r = gequal0(S); avma = av; return r;
}
static long RgX_isspherical ( GEN Qi , GEN P ) { pari_sp av = avma ; GEN va , S ; long lva , i , j , r ; if ( degpol ( P ) <= 1 ) return 1 ; va = variables_vecsmall ( P ) ; lva = lg ( va ) ; if ( lva > lg ( Qi ) ) pari_err ( e_MISC , " " ) ; S = gen_0 ; for ( j = 1 ; j < lva ; j ++ ) { GEN col = gel ( Qi , j ) , Pj = deriv ( P , va [ j ] ) ; for ( i = 1 ; i <= j ; i ++ ) { GEN coe = gel ( col , i ) ; if ( i != j ) coe = gmul2n ( coe , 1 ) ; if ( ! gequal0 ( coe ) ) S = gadd ( S , gmul ( coe , deriv ( Pj , va [ i ] ) ) ) ; } } r = gequal0 ( S ) ; avma = av ; return r ; }
P a t_POL, 1 if spherical, 0 otherwise
P a t_POL 1 if spherical 0 otherwise