bridge/class-master/depend/pari/src/modules/algebras.c
/* Try to split al using x's charpoly. Return gen_0 if simple, NULL if failure.
 * And a splitting otherwise
 * If pt_primelt!=NULL, compute a primitive element of the center when simple */
Try to split al using x's charpoly. Return gen_0 if simple, NULL if failure.
And a splitting otherwise
If pt_primelt!=NULL, compute a primitive element of the center when simple
Try to split al using x ' s charpoly . Return gen_0 if simple NULL if failure . And a splitting otherwise If pt_primelt! = NULL compute a primitive element of the center when simple
static GEN
try_fact(GEN al, GEN x, GEN zx, GEN Z, GEN Zal, long mini, GEN* pt_primelt)
{
  GEN z, dec0, dec1, cp = algcharpoly(Zal,zx,0,1), fa, p = alg_get_char(al);
  long nfa, e;
  dbg_printf(3)("  try_fact: zx=%Ps\n", zx);
  if (signe(p)) fa = FpX_factor(cp,p);
  else          fa = factor(cp);
  dbg_printf(3)("  charpoly=%Ps\n", fa);
  nfa = nbrows(fa);
  if (nfa == 1) {
    if (signe(p)) e = gel(fa,2)[1];
    else          e = itos(gcoeff(fa,1,2));
    if (e == 1) {
      if (pt_primelt != NULL) *pt_primelt = mkvec2(x, cp);
      return gen_0;
    }
    else return NULL;
  }
  dec0 = alg_decompose_from_facto(al, x, fa, Z, mini);
  if (!dec0) return NULL;
  if (!mini) return dec0;
  dec1 = alg_decompose(gel(dec0,1), gel(dec0,4), 1, pt_primelt);
  z = gel(dec0,5);
  if (!isintzero(dec1)) {
    if (signe(p)) z = FpM_FpC_mul(gel(dec0,3),dec1,p);
    else          z = RgM_RgC_mul(gel(dec0,3),dec1);
  }
  return z;
}
static GEN try_fact ( GEN al , GEN x , GEN zx , GEN Z , GEN Zal , long mini , GEN * pt_primelt ) { GEN z , dec0 , dec1 , cp = algcharpoly ( Zal , zx , 0 , 1 ) , fa , p = alg_get_char ( al ) ; long nfa , e ; dbg_printf ( 3 ) ( " \n " , zx ) ; if ( signe ( p ) ) fa = FpX_factor ( cp , p ) ; else fa = factor ( cp ) ; dbg_printf ( 3 ) ( " \n " , fa ) ; nfa = nbrows ( fa ) ; if ( nfa == 1 ) { if ( signe ( p ) ) e = gel ( fa , 2 ) [ 1 ] ; else e = itos ( gcoeff ( fa , 1 , 2 ) ) ; if ( e == 1 ) { if ( pt_primelt != NULL ) * pt_primelt = mkvec2 ( x , cp ) ; return gen_0 ; } else return NULL ; } dec0 = alg_decompose_from_facto ( al , x , fa , Z , mini ) ; if ( ! dec0 ) return NULL ; if ( ! mini ) return dec0 ; dec1 = alg_decompose ( gel ( dec0 , 1 ) , gel ( dec0 , 4 ) , 1 , pt_primelt ) ; z = gel ( dec0 , 5 ) ; if ( ! isintzero ( dec1 ) ) { if ( signe ( p ) ) z = FpM_FpC_mul ( gel ( dec0 , 3 ) , dec1 , p ) ; else z = RgM_RgC_mul ( gel ( dec0 , 3 ) , dec1 ) ; } return z ; }
Try to split al using x's charpoly.
Try to split al using x ' s charpoly .