bridge/class-master/depend/pari/src/basemath/ecpp.c
/* Given a Dmvec of [D,m]'s, simultaneously remove all prime factors of each
 * m less then BOUND_PRIMORIAL. This implements Franke 2004: Proving the
 * Primality of Very Large Numbers with fastECPP */
Given a Dmvec of [D,m]'s, simultaneously remove all prime factors of each
m less then BOUND_PRIMORIAL. This implements Franke 2004: Proving the
Primality of Very Large Numbers with fastECPP
Given a Dmvec of [ D m ] ' s simultaneously remove all prime factors of each m less then BOUND_PRIMORIAL . This implements Franke 2004 : Proving the Primality of Very Large Numbers with fastECPP
static GEN
Dmvec_batchfactor(GEN Dmvec, GEN primorial)
{
  long i, l = lg(Dmvec);
  GEN leaf, v = cgetg(l, t_VEC);
  for (i = 1; i < l; i++)
  { 
    GEN m = gmael(Dmvec, i, 2);
    long v2 = vali(m);
    gel(v,i) = v2? shifti(m,-v2): m;
  }
  leaf = Z_ZV_mod_tree(primorial, v, ZV_producttree(v));
  for (i = 1; i < l; i++)
  {
    GEN q = gel(v,i), Dm = gel(Dmvec,i), L = gel(leaf,i);
    while (!equali1(L)) { L = gcdii(q, L); q = diviiexact(q, L); }
    gel(v,i) = mkvec3(gel(Dm,1), gel(Dm,2), q);
  }
  return v;
}
static GEN Dmvec_batchfactor ( GEN Dmvec , GEN primorial ) { long i , l = lg ( Dmvec ) ; GEN leaf , v = cgetg ( l , t_VEC ) ; for ( i = 1 ; i < l ; i ++ ) { GEN m = gmael ( Dmvec , i , 2 ) ; long v2 = vali ( m ) ; gel ( v , i ) = v2 ? shifti ( m , - v2 ) : m ; } leaf = Z_ZV_mod_tree ( primorial , v , ZV_producttree ( v ) ) ; for ( i = 1 ; i < l ; i ++ ) { GEN q = gel ( v , i ) , Dm = gel ( Dmvec , i ) , L = gel ( leaf , i ) ; while ( ! equali1 ( L ) ) { L = gcdii ( q , L ) ; q = diviiexact ( q , L ) ; } gel ( v , i ) = mkvec3 ( gel ( Dm , 1 ) , gel ( Dm , 2 ) , q ) ; } return v ; }
Given a Dmvec of [D,m]'s, simultaneously remove all prime factors of each
 m less then BOUND_PRIMORIAL.
Given a Dmvec of [ D m ] ' s simultaneously remove all prime factors of each m less then BOUND_PRIMORIAL .
/* cheaply remove powers of 2 */ /* Go through each leaf and remove small factors. */