bridge/class-master/depend/pari/src/basemath/mftrace.c
/* Evaluate an mf closure numerically, i.e., in the usual sense, either for a
 * single tau or a vector of tau; for each, return a vector of results
 * corresponding to all complex embeddings of F. If flag is non-zero, allow
 * replacing F by F | gamma to increase imag(gamma^(-1).tau) [ expensive if
 * MF_EISENSPACE not present ] */
Evaluate an mf closure numerically, i.e., in the usual sense, either for a
single tau or a vector of tau; for each, return a vector of results
corresponding to all complex embeddings of F. If flag is non-zero, allow
replacing F by F | gamma to increase imag(gamma^(-1).tau) [ expensive if
MF_EISENSPACE not present ]
Evaluate an mf closure numerically i . e . in the usual sense either for a single tau or a vector of tau ; for each return a vector of results corresponding to all complex embeddings of F . If flag is non - zero allow replacing F by F | gamma to increase imag ( gamma^ ( - 1 ) . tau ) [ expensive if MF_EISENSPACE not present ]
static GEN
mfeval_i(GEN mf, GEN F, GEN vtau, long flag, long bitprec)
{
  GEN L0, vL, vb, sqN, vczd, vTAU, vs, van, vE;
  long N = mf_get_N(F), N0, ta, lv, i, prec = nbits2prec(bitprec);
  GEN gN = utoipos(N), gk = mf_get_gk(F), gk1 = gsubgs(gk,1), vgk;
  long flscal = 0;
  vgk = mkvec2(gen_0, mfiscuspidal(mf,F)? gmul2n(gk1,-1): gk1);
  ta = typ(vtau);
  if (!is_vec_t(ta)) { flscal = 1; vtau = mkvec(vtau); ta = t_VEC; }
  lv = lg(vtau);
  sqN = sqrtr_abs(utor(N, prec));
  vs = const_vec(lv-1, NULL);
  vb = const_vec(lv-1, NULL);
  vL = cgetg(lv, t_VEC);
  vTAU = cgetg(lv, t_VEC);
  vczd = cgetg(lv, t_VEC);
  L0 = mfthetaancreate(NULL, gN, vgk); 
  vE = mfgetembed(F, prec);
  N0 = 0;
  for (i = 1; i < lv; i++)
  {
    GEN z = gel(vtau,i), tau, U;
    long w, n;
    gel(vs,i) = evalcusp(mf, F, z, prec);
    if (gel(vs,i)) continue;
    tau = cxredga0N(N, z, &U, &gel(vczd,i), flag);
    if (!flag) w = 0; else { w = mfZC_width(N, gel(U,1)); tau = gdivgs(tau,w); }
    gel(vTAU,i) = mulcxmI(gmul(tau, sqN));
    n = lfunthetacost(L0, real_i(gel(vTAU,i)), 0, bitprec);
    if (N0 < n) N0 = n;
    if (flag)
    {
      GEN A, al, v = mfslashexpansion(mf, F, ZM_inv(U,NULL), N0, 0, &A, prec);
      gel(vL,i) = van_embedall(v, vE, gN, vgk);
      al = gel(A,1);
      if (!gequal0(al))
        gel(vb,i) = gexp(gmul(gmul(gmulsg(w,al),PiI2(prec)), tau), prec);
    }
  }
  if (!flag)
  {
    van = mfcoefs_i(F, N0, 1);
    vL = const_vec(lv-1, van_embedall(van, vE, gN, vgk));
  }
  for (i = 1; i < lv; i++)
  {
    GEN T;
    if (gel(vs,i)) continue;
    T = gpow(gel(vczd,i), gneg(gk), prec);
    if (flag && gel(vb,i)) T = gmul(T, gel(vb,i));
    gel(vs,i) = lfunthetaall(T, gel(vL,i), gel(vTAU,i), bitprec);
  }
  return flscal? gel(vs,1): vs;
}
static GEN mfeval_i ( GEN mf , GEN F , GEN vtau , long flag , long bitprec ) { GEN L0 , vL , vb , sqN , vczd , vTAU , vs , van , vE ; long N = mf_get_N ( F ) , N0 , ta , lv , i , prec = nbits2prec ( bitprec ) ; GEN gN = utoipos ( N ) , gk = mf_get_gk ( F ) , gk1 = gsubgs ( gk , 1 ) , vgk ; long flscal = 0 ; vgk = mkvec2 ( gen_0 , mfiscuspidal ( mf , F ) ? gmul2n ( gk1 , -1 ) : gk1 ) ; ta = typ ( vtau ) ; if ( ! is_vec_t ( ta ) ) { flscal = 1 ; vtau = mkvec ( vtau ) ; ta = t_VEC ; } lv = lg ( vtau ) ; sqN = sqrtr_abs ( utor ( N , prec ) ) ; vs = const_vec ( lv - 1 , NULL ) ; vb = const_vec ( lv - 1 , NULL ) ; vL = cgetg ( lv , t_VEC ) ; vTAU = cgetg ( lv , t_VEC ) ; vczd = cgetg ( lv , t_VEC ) ; L0 = mfthetaancreate ( NULL , gN , vgk ) ; vE = mfgetembed ( F , prec ) ; N0 = 0 ; for ( i = 1 ; i < lv ; i ++ ) { GEN z = gel ( vtau , i ) , tau , U ; long w , n ; gel ( vs , i ) = evalcusp ( mf , F , z , prec ) ; if ( gel ( vs , i ) ) continue ; tau = cxredga0N ( N , z , & U , & gel ( vczd , i ) , flag ) ; if ( ! flag ) w = 0 ; else { w = mfZC_width ( N , gel ( U , 1 ) ) ; tau = gdivgs ( tau , w ) ; } gel ( vTAU , i ) = mulcxmI ( gmul ( tau , sqN ) ) ; n = lfunthetacost ( L0 , real_i ( gel ( vTAU , i ) ) , 0 , bitprec ) ; if ( N0 < n ) N0 = n ; if ( flag ) { GEN A , al , v = mfslashexpansion ( mf , F , ZM_inv ( U , NULL ) , N0 , 0 , & A , prec ) ; gel ( vL , i ) = van_embedall ( v , vE , gN , vgk ) ; al = gel ( A , 1 ) ; if ( ! gequal0 ( al ) ) gel ( vb , i ) = gexp ( gmul ( gmul ( gmulsg ( w , al ) , PiI2 ( prec ) ) , tau ) , prec ) ; } } if ( ! flag ) { van = mfcoefs_i ( F , N0 , 1 ) ; vL = const_vec ( lv - 1 , van_embedall ( van , vE , gN , vgk ) ) ; } for ( i = 1 ; i < lv ; i ++ ) { GEN T ; if ( gel ( vs , i ) ) continue ; T = gpow ( gel ( vczd , i ) , gneg ( gk ) , prec ) ; if ( flag && gel ( vb , i ) ) T = gmul ( T , gel ( vb , i ) ) ; gel ( vs , i ) = lfunthetaall ( T , gel ( vL , i ) , gel ( vTAU , i ) , bitprec ) ; } return flscal ? gel ( vs , 1 ) : vs ; }
Evaluate an mf closure numerically, i.e., in the usual sense, either for a
 single tau or a vector of tau; for each, return a vector of results
 corresponding to all complex embeddings of F. If flag is non-zero, allow
 replacing F by F | gamma to increase imag(gamma^(-1).tau) [ expensive if
 MF_EISENSPACE not present ]
Evaluate an mf closure numerically i . e . in the usual sense either for a single tau or a vector of tau ; for each return a vector of results corresponding to all complex embeddings of F . If flag is non - zero allow replacing F by F | gamma to increase imag ( gamma^ ( - 1 ) . tau ) [ expensive if MF_EISENSPACE not present ]
/* gen_0 is ignored, second component assumes Ramanujan-Petersson in
   * 1/2-integer weight */ /* only for thetacost */