bridge/class-master/depend/pari/src/basemath/nffactor.c
/* Factor polynomial a on the number field defined by polynomial T, using
 * Trager's trick */
Factor polynomial a on the number field defined by polynomial T, using
Trager's trick
Factor polynomial a on the number field defined by polynomial T using Trager ' s trick
GEN
polfnf(GEN a, GEN T)
{
  GEN rep = cgetg(3, t_MAT), A, B, y, dent, bad;
  long dA;
  int tmonic;
  if (typ(a)!=t_POL) pari_err_TYPE("polfnf",a);
  if (typ(T)!=t_POL) pari_err_TYPE("polfnf",T);
  T = Q_primpart(T); tmonic = is_pm1(leading_coeff(T));
  RgX_check_ZX(T,"polfnf");
  A = Q_primpart( QXQX_normalize(RgX_nffix("polfnf",T,a,1), T) );
  dA = degpol(A);
  if (dA <= 0)
  {
    avma = (pari_sp)(rep + 3);
    return (dA == 0)? trivial_fact(): zerofact(varn(A));
  }
  bad = dent = ZX_disc(T);
  if (tmonic) dent = indexpartial(T, dent);
  (void)nfgcd_all(A,RgX_deriv(A), T, dent, &B);
  if (degpol(B) != dA) B = Q_primpart( QXQX_normalize(B, T) );
  ensure_lt_INT(B);
  y = nfsqff_trager(B, T, dent);
  fact_from_sqff(rep, A, B, y, T, bad);
  return sort_factor_pol(rep, cmp_RgX);
}
GEN polfnf ( GEN a , GEN T ) { GEN rep = cgetg ( 3 , t_MAT ) , A , B , y , dent , bad ; long dA ; int tmonic ; if ( typ ( a ) != t_POL ) pari_err_TYPE ( " " , a ) ; if ( typ ( T ) != t_POL ) pari_err_TYPE ( " " , T ) ; T = Q_primpart ( T ) ; tmonic = is_pm1 ( leading_coeff ( T ) ) ; RgX_check_ZX ( T , " " ) ; A = Q_primpart ( QXQX_normalize ( RgX_nffix ( " " , T , a , 1 ) , T ) ) ; dA = degpol ( A ) ; if ( dA <= 0 ) { avma = ( pari_sp ) ( rep + 3 ) ; return ( dA == 0 ) ? trivial_fact ( ) : zerofact ( varn ( A ) ) ; } bad = dent = ZX_disc ( T ) ; if ( tmonic ) dent = indexpartial ( T , dent ) ; ( void ) nfgcd_all ( A , RgX_deriv ( A ) , T , dent , & B ) ; if ( degpol ( B ) != dA ) B = Q_primpart ( QXQX_normalize ( B , T ) ) ; ensure_lt_INT ( B ) ; y = nfsqff_trager ( B , T , dent ) ; fact_from_sqff ( rep , A , B , y , T , bad ) ; return sort_factor_pol ( rep , cmp_RgX ) ; }
Factor polynomial a on the number field defined by polynomial T, using
 Trager's trick
Factor polynomial a on the number field defined by polynomial T using Trager ' s trick