bridge/class-master/depend/pari/src/basemath/base2.c
/* D an integer, P a ZV, return a factorization matrix for D over P, removing
 * entries with 0 exponent. */
D an integer, P a ZV, return a factorization matrix for D over P, removing
entries with 0 exponent.
D an integer P a ZV return a factorization matrix for D over P removing entries with 0 exponent .
static GEN
fact_from_factors(GEN D, GEN P, long flag)
{
  long i, l = lg(P), iq = 1;
  GEN Q = cgetg(l+1,t_COL);
  GEN E = cgetg(l+1,t_COL);
  for (i=1; i<l; i++)
  {
    GEN p = gel(P,i);
    long k;
    if (flag && !equalim1(p))
    {
      p = gcdii(p, D);
      if (is_pm1(p)) continue;
    }
    k = safe_Z_pvalrem(D, p, &D);
    if (k) { gel(Q,iq) = p; gel(E,iq) = utoipos(k); iq++; }
  }
  D = absi_shallow(D);
  if (!equali1(D))
  {
    long k = Z_isanypower(D, &D);
    if (!k) k = 1;
    gel(Q,iq) = D; gel(E,iq) = utoipos(k); iq++;
  }
  setlg(Q,iq);
  setlg(E,iq); return mkmat2(Q,E);
}
static GEN fact_from_factors ( GEN D , GEN P , long flag ) { long i , l = lg ( P ) , iq = 1 ; GEN Q = cgetg ( l + 1 , t_COL ) ; GEN E = cgetg ( l + 1 , t_COL ) ; for ( i = 1 ; i < l ; i ++ ) { GEN p = gel ( P , i ) ; long k ; if ( flag && ! equalim1 ( p ) ) { p = gcdii ( p , D ) ; if ( is_pm1 ( p ) ) continue ; } k = safe_Z_pvalrem ( D , p , & D ) ; if ( k ) { gel ( Q , iq ) = p ; gel ( E , iq ) = utoipos ( k ) ; iq ++ ; } } D = absi_shallow ( D ) ; if ( ! equali1 ( D ) ) { long k = Z_isanypower ( D , & D ) ; if ( ! k ) k = 1 ; gel ( Q , iq ) = D ; gel ( E , iq ) = utoipos ( k ) ; iq ++ ; } setlg ( Q , iq ) ; setlg ( E , iq ) ; return mkmat2 ( Q , E ) ; }
D an integer, P a ZV, return a factorization matrix for D over P, removing
 entries with 0 exponent.
D an integer P a ZV return a factorization matrix for D over P removing entries with 0 exponent .