bridge/class-master/depend/pari/src/modules/algebras.c
/* if data == NULL, the test is skipped */
/* in the test, the factorization does not contain the known factors */
if data == NULL, the test is skipped
in the test, the factorization does not contain the known factors
if data == NULL the test is skipped in the test the factorization does not contain the known factors
static GEN
factoredextchinesetest(GEN nf, GEN x, GEN y, GEN pl, GEN* fa, GEN data, int (*test)(GEN,GEN,GEN))
{
  pari_sp av = avma;
  long n,i;
  GEN x1, y0, y1, red, N, I, P = gel(x,1), E = gel(x,2);
  n = nf_get_degree(nf);
  x = idealchineseinit(nf, mkvec2(x,pl));
  x1 = gel(x,1);
  red = lg(x1) == 1? matid(n): gel(x1,1);
  y0 = idealchinese(nf, x, y);
  E = shallowcopy(E);
  if (!gequal0(y0))
    for (i=1; i<lg(E); i++)
    {
      long v = nfval(nf,y0,gel(P,i));
      if (cmpsi(v, gel(E,i)) < 0) gel(E,i) = stoi(v);
    }
  I = factorbackprime(nf, P, E);
  N = idealnorm(nf,I);
  y1 = backtrackfacto(y0, n, red, pl, nf, data, test, fa, N, I);
  for (i=1; i<lg(E); i++) gel(E,i) = stoi(nfval(nf,y1,gel(P,i)));
  *fa = famat_reduce(famat_mul_shallow(*fa, mkmat2(P, E)));
  gerepileall(av, 2, &y1, fa);
  return y1;
}
static GEN factoredextchinesetest ( GEN nf , GEN x , GEN y , GEN pl , GEN * fa , GEN data , int ( * test ) ( GEN , GEN , GEN ) ) { pari_sp av = avma ; long n , i ; GEN x1 , y0 , y1 , red , N , I , P = gel ( x , 1 ) , E = gel ( x , 2 ) ; n = nf_get_degree ( nf ) ; x = idealchineseinit ( nf , mkvec2 ( x , pl ) ) ; x1 = gel ( x , 1 ) ; red = lg ( x1 ) == 1 ? matid ( n ) : gel ( x1 , 1 ) ; y0 = idealchinese ( nf , x , y ) ; E = shallowcopy ( E ) ; if ( ! gequal0 ( y0 ) ) for ( i = 1 ; i < lg ( E ) ; i ++ ) { long v = nfval ( nf , y0 , gel ( P , i ) ) ; if ( cmpsi ( v , gel ( E , i ) ) < 0 ) gel ( E , i ) = stoi ( v ) ; } I = factorbackprime ( nf , P , E ) ; N = idealnorm ( nf , I ) ; y1 = backtrackfacto ( y0 , n , red , pl , nf , data , test , fa , N , I ) ; for ( i = 1 ; i < lg ( E ) ; i ++ ) gel ( E , i ) = stoi ( nfval ( nf , y1 , gel ( P , i ) ) ) ; * fa = famat_reduce ( famat_mul_shallow ( * fa , mkmat2 ( P , E ) ) ) ; gerepileall ( av , 2 , & y1 , fa ) ; return y1 ; }
if data == NULL, the test is skipped
in the test, the factorization does not contain the known factors
if data == NULL the test is skipped in the test the factorization does not contain the known factors
/* N and I : known factors */ /* restore known factors */