bridge/class-master/depend/pari/src/basemath/ellsea.c
/*Returns the possible values of the trace when ell is an Atkin prime, */
/*given r the splitting degree of the modular equation at J = E.j */
Returns the possible values of the trace when ell is an Atkin prime,
given r the splitting degree of the modular equation at J = E.j
Returns the possible values of the trace when ell is an Atkin prime given r the splitting degree of the modular equation at J = E . j
static GEN
find_trace_Atkin(ulong ell, long r, GEN q)
{
  pari_sp ltop = avma;
  long nval = 0;
  ulong teta, pell = umodiu(q, ell), invp = Fl_inv(pell, ell);
  GEN val_pos = cgetg(1+ell, t_VECSMALL), P = gel(factoru(r), 1);
  GEN S = mkvecsmall4(0, pell, 0, 1);
  GEN U = mkvecsmall3(0, ell-1, 0);
  pari_sp btop = avma;
  if (r==2 && krouu(ell-pell, ell) < 0)
    val_pos[++nval] = 0;
  for (teta = 1; teta < ell; teta++, avma = btop)
  {
    ulong disc = Fl_sub(Fl_sqr(teta,ell), Fl_mul(4UL,pell,ell), ell);
    GEN a;
    if (krouu(disc, ell) >= 0) continue;
    S[3] = Fl_neg(teta, ell);
    U[3] = Fl_mul(invp, teta, ell);
    a = Flxq_powu(U, r/P[1], S, ell);
    if (!Flx_equal1(a) && Flx_equal1(Flxq_powu(a, P[1], S, ell)))
    {
      pari_sp av = avma;
      long i, l=lg(P);
      for (i = 2; i < l; i++, avma = av)
        if (Flx_equal1(Flxq_powu(U, r/P[i], S, ell))) break;
      if (i==l) val_pos[++nval] = teta;
    }
  }
  return gerepileupto(ltop, vecsmall_shorten(val_pos, nval));
}
static GEN find_trace_Atkin ( ulong ell , long r , GEN q ) { pari_sp ltop = avma ; long nval = 0 ; ulong teta , pell = umodiu ( q , ell ) , invp = Fl_inv ( pell , ell ) ; GEN val_pos = cgetg ( 1 + ell , t_VECSMALL ) , P = gel ( factoru ( r ) , 1 ) ; GEN S = mkvecsmall4 ( 0 , pell , 0 , 1 ) ; GEN U = mkvecsmall3 ( 0 , ell - 1 , 0 ) ; pari_sp btop = avma ; if ( r == 2 && krouu ( ell - pell , ell ) < 0 ) val_pos [ ++ nval ] = 0 ; for ( teta = 1 ; teta < ell ; teta ++ , avma = btop ) { ulong disc = Fl_sub ( Fl_sqr ( teta , ell ) , Fl_mul ( 4UL , pell , ell ) , ell ) ; GEN a ; if ( krouu ( disc , ell ) >= 0 ) continue ; S [ 3 ] = Fl_neg ( teta , ell ) ; U [ 3 ] = Fl_mul ( invp , teta , ell ) ; a = Flxq_powu ( U , r / P [ 1 ] , S , ell ) ; if ( ! Flx_equal1 ( a ) && Flx_equal1 ( Flxq_powu ( a , P [ 1 ] , S , ell ) ) ) { pari_sp av = avma ; long i , l = lg ( P ) ; for ( i = 2 ; i < l ; i ++ , avma = av ) if ( Flx_equal1 ( Flxq_powu ( U , r / P [ i ] , S , ell ) ) ) break ; if ( i == l ) val_pos [ ++ nval ] = teta ; } } return gerepileupto ( ltop , vecsmall_shorten ( val_pos , nval ) ) ; }
Returns the possible values of the trace when ell is an Atkin prime,
given r the splitting degree of the modular equation at J = E.j
Returns the possible values of the trace when ell is an Atkin prime given r the splitting degree of the modular equation at J = E . j