bridge/class-master/depend/pari/src/basemath/base2.c
/* T monic separable ZX, p prime */
T monic separable ZX, p prime
T monic separable ZX p prime
GEN
ZpX_primedec(GEN T, GEN p)
{
  const pari_sp av = avma;
  GEN w, F1, F2, res, g, k = ZX_Dedekind(T, &g, p);
  decomp_t S;
  if (!degpol(k)) return zm_to_ZM(FpX_degfact(T, p));
  k = FpX_normalize(k, p);
  F1 = FpX_factor(k,p);
  F2 = FpX_factor(FpX_div(g,k,p),p);
  w = merge_sort_uniq(gel(F1,1),gel(F2,1),(void*)cmpii,&gen_cmp_RgX);
  res = maxord_i(&S, p, T, ZpX_disc_val(T, p), w, -1);
  if (!res)
  {
    long f = degpol(S.nu), e = degpol(T) / f;
    avma = av; retmkmat2(mkcols(f), mkcols(e));
  }
  return gerepilecopy(av,res);
}
GEN ZpX_primedec ( GEN T , GEN p ) { const pari_sp av = avma ; GEN w , F1 , F2 , res , g , k = ZX_Dedekind ( T , & g , p ) ; decomp_t S ; if ( ! degpol ( k ) ) return zm_to_ZM ( FpX_degfact ( T , p ) ) ; k = FpX_normalize ( k , p ) ; F1 = FpX_factor ( k , p ) ; F2 = FpX_factor ( FpX_div ( g , k , p ) , p ) ; w = merge_sort_uniq ( gel ( F1 , 1 ) , gel ( F2 , 1 ) , ( void * ) cmpii , & gen_cmp_RgX ) ; res = maxord_i ( & S , p , T , ZpX_disc_val ( T , p ) , w , -1 ) ; if ( ! res ) { long f = degpol ( S . nu ) , e = degpol ( T ) / f ; avma = av ; retmkmat2 ( mkcols ( f ) , mkcols ( e ) ) ; } return gerepilecopy ( av , res ) ; }
T monic separable ZX, p prime
T monic separable ZX p prime