bridge/class-master/depend/pari/src/basemath/elltors.c
/* Finds a multiplicative upper bound for #E_tor; assume integral model */
Finds a multiplicative upper bound for #E_tor; assume integral model
Finds a multiplicative upper bound for #E_tor ; assume integral model
static long
torsbound(GEN e)
{
  GEN D = ell_get_disc(e);
  pari_sp av = avma, av2;
  long m, b, bold, nb;
  forprime_t S;
  long CM = ellQ_get_CM(e);
  nb = expi(D) >> 3;
  b = bold = 5040; 
  m = 0;
  (void)u_forprime_init(&S, 3, ULONG_MAX);
  av2 = avma;
  while (m < nb || (b > 12 && b != 16))
  {
    ulong p = u_forprime_next(&S);
    if (!p) pari_err_BUG("torsbound [ran out of primes]");
    if (!umodiu(D, p)) continue;
    b = ugcd(b, p+1 - ellap_CM_fast(e,p,CM));
    avma = av2;
    if (b == 1) break;
    if (b == bold) m++; else { bold = b; m = 0; }
  }
  avma = av; return b;
}
static long torsbound ( GEN e ) { GEN D = ell_get_disc ( e ) ; pari_sp av = avma , av2 ; long m , b , bold , nb ; forprime_t S ; long CM = ellQ_get_CM ( e ) ; nb = expi ( D ) >> 3 ; b = bold = 5040 ; m = 0 ; ( void ) u_forprime_init ( & S , 3 , ULONG_MAX ) ; av2 = avma ; while ( m < nb || ( b > 12 && b != 16 ) ) { ulong p = u_forprime_next ( & S ) ; if ( ! p ) pari_err_BUG ( " " ) ; if ( ! umodiu ( D , p ) ) continue ; b = ugcd ( b , p + 1 - ellap_CM_fast ( e , p , CM ) ) ; avma = av2 ; if ( b == 1 ) break ; if ( b == bold ) m ++ ; else { bold = b ; m = 0 ; } } avma = av ; return b ; }
Finds a multiplicative upper bound for #E_tor; assume integral model
Finds a multiplicative upper bound for #E_tor ; assume integral model
/* nb = number of primes to try ~ 1 prime every 8 bits in D */ /* = 2^4 * 3^2 * 5 * 7 */ /* p > 2 has good reduction => E(Q) injects in E(Fp) */