bridge/class-master/depend/pari/src/basemath/lfunutils.c
/* Based on
Symmetric powers of elliptic curve L-functions,
Phil Martin and Mark Watkins, ANTS VII
<http://magma.maths.usyd.edu.au/users/watkins/papers/antsVII.pdf>
with thanks to Mark Watkins. BA20180402
*/
Based on
Symmetric powers of elliptic curve L-functions,
Phil Martin and Mark Watkins, ANTS VII

with thanks to Mark Watkins.
Based on Symmetric powers of elliptic curve L - functions Phil Martin and Mark Watkins ANTS VII with thanks to Mark Watkins .
static GEN
lfunellsympow(GEN e, ulong m)
{
  pari_sp av = avma;
  GEN B, N, Nfa, pr, ex, ld, bad, ejd, et, pole;
  long i, l, mero, w = (m&7)==1 || (m&7)==3 ? -1: 1;
  checkell_Q(e);
  e = ellminimalmodel(e, NULL);
  ejd = Q_denom(ell_get_j(e));
  mero = m==0 || (m%4==0 && ellQ_get_CM(e)<0);
  ellQ_get_Nfa(e, &N, &Nfa);
  pr = gel(Nfa,1);
  ex = gel(Nfa,2); l = lg(pr);
  if (ugcd(umodiu(N,6), 6) == 1)
    et = NULL;
  else
    et = ellminimaldotwist(e, NULL, DEFAULTPREC);
  B = gen_1;
  bad = cgetg(l, t_VEC);
  for (i=1; i<l; i++)
  {
    long vN = itos(gel(ex,i));
    GEN p = gel(pr,i), eul;
    long cnd, wp;
    if (dvdii(ejd, p))
      eul = ellsympow_multred(e, p, m, vN, &cnd, &wp);
    else if (equaliu(p, 2))
      eul = ellsympow_goodred2(e, et, p, m, vN, &cnd, &wp);
    else if (equaliu(p, 3))
      eul = ellsympow_goodred3(e, et, p, m, vN, &cnd, &wp);
    else
      eul = ellsympow_goodred(e, p, m, &cnd, &wp);
    gel(bad, i) = mkvec2(p, ginv(eul));
    B = mulii(B, powiu(p,cnd));
    w *= wp;
  }
  pole = mero ? mkvec(mkvec2(stoi(1+(m>>1)),gen_0)): NULL;
  ld = mkvecn(mero? 7: 6, tag(mkvec2(mkvec2(e,utoi(m)),bad), t_LFUN_SYMPOW_ELL),
        gen_0, ellsympow_gamma(m), stoi(m+1), B, stoi(w), pole);
  if (et) obj_free(et);
  return gerepilecopy(av, ld);
}
static GEN lfunellsympow ( GEN e , ulong m ) { pari_sp av = avma ; GEN B , N , Nfa , pr , ex , ld , bad , ejd , et , pole ; long i , l , mero , w = ( m & 7 ) == 1 || ( m & 7 ) == 3 ? -1 : 1 ; checkell_Q ( e ) ; e = ellminimalmodel ( e , NULL ) ; ejd = Q_denom ( ell_get_j ( e ) ) ; mero = m == 0 || ( m % 4 == 0 && ellQ_get_CM ( e ) < 0 ) ; ellQ_get_Nfa ( e , & N , & Nfa ) ; pr = gel ( Nfa , 1 ) ; ex = gel ( Nfa , 2 ) ; l = lg ( pr ) ; if ( ugcd ( umodiu ( N , 6 ) , 6 ) == 1 ) et = NULL ; else et = ellminimaldotwist ( e , NULL , DEFAULTPREC ) ; B = gen_1 ; bad = cgetg ( l , t_VEC ) ; for ( i = 1 ; i < l ; i ++ ) { long vN = itos ( gel ( ex , i ) ) ; GEN p = gel ( pr , i ) , eul ; long cnd , wp ; if ( dvdii ( ejd , p ) ) eul = ellsympow_multred ( e , p , m , vN , & cnd , & wp ) ; else if ( equaliu ( p , 2 ) ) eul = ellsympow_goodred2 ( e , et , p , m , vN , & cnd , & wp ) ; else if ( equaliu ( p , 3 ) ) eul = ellsympow_goodred3 ( e , et , p , m , vN , & cnd , & wp ) ; else eul = ellsympow_goodred ( e , p , m , & cnd , & wp ) ; gel ( bad , i ) = mkvec2 ( p , ginv ( eul ) ) ; B = mulii ( B , powiu ( p , cnd ) ) ; w *= wp ; } pole = mero ? mkvec ( mkvec2 ( stoi ( 1 + ( m >> 1 ) ) , gen_0 ) ) : NULL ; ld = mkvecn ( mero ? 7 : 6 , tag ( mkvec2 ( mkvec2 ( e , utoi ( m ) ) , bad ) , t_LFUN_SYMPOW_ELL ) , gen_0 , ellsympow_gamma ( m ) , stoi ( m + 1 ) , B , stoi ( w ) , pole ) ; if ( et ) obj_free ( et ) ; return gerepilecopy ( av , ld ) ; }
Based on
Symmetric powers of elliptic curve L-functions,
Phil Martin and Mark Watkins, ANTS VII
<http://magma.maths.usyd.edu.au/users/watkins/papers/antsVII.pdf>
with thanks to Mark Watkins.
Based on Symmetric powers of elliptic curve L - functions Phil Martin and Mark Watkins ANTS VII <http : // magma . maths . usyd . edu . au / users / watkins / papers / antsVII . pdf > with thanks to Mark Watkins .