bridge/class-master/depend/pari/src/basemath/mftrace.c
/* Compute all slashexpansions for all cosets */
Compute all slashexpansions for all cosets
Compute all slashexpansions for all cosets
static GEN
mfgaexpansionall(GEN mf, GEN FE, GEN cosets, double height, long prec)
{
  GEN CHI = MF_get_CHI(mf), vres, vresaw;
  long lco, j, k = MF_get_k(mf), N = MF_get_N(mf), bitprec = prec2nbits(prec);
  lco = lg(cosets);
  vres = const_vec(lco-1, NULL);
  vresaw = cgetg(lco, t_VEC);
  for (j = 1; j < lco; j++) if (!gel(vres,j))
  {
    GEN ga = gel(cosets, j), van, aw, al, z, gai;
    long w1 = mfZC_width(N, gel(ga,1));
    long w2 = mfZC_width(N, gel(ga,2));
    long nlim, nlim2, daw, da, na, i;
    double sqNinvdbl = height ? height/w1 : 1./sqrt((double)w1*N);
    nlim = mfperiod_prelim_double(sqNinvdbl, k, bitprec + 32);
    van = mfslashexpansion(mf, FE, ga, nlim, 0, &aw, prec + 1);
    van = vanembed(gel(FE, 1), van, prec + 1);
    al = gel(aw, 1);
    nlim2 = height? nlim: getnlim2(N, w1, w2, nlim, k, bitprec);
    gel(vres, j) = vecslice(van, 1, nlim2 + 1);
    gel(vresaw, j) = aw;
    Qtoss(al, &na, &da); daw = da*w1;
    z = rootsof1powinit(1, daw, prec + 1);
    gai = ga;
    for (i = 1; i < w1; i++)
    {
      GEN V, coe;
      long Di, n, ind, w2, s = ((i*na) % da) * w1, t = i*da;
      gai = ZM_mulT(gai);
      ind = mftocoset_iD(N, gai, cosets, &Di);
      w2 = mfZC_width(N, gel(gel(cosets,ind), 2));
      nlim2 = height? nlim: getnlim2(N, w1, w2, nlim, k, bitprec);
      gel(vresaw, ind) = aw;
      V = cgetg(nlim2 + 2, t_VEC);
      for (n = 0; n <= nlim2; n++, s = Fl_add(s, t, daw))
        gel(V, n+1) = gmul(gel(van, n+1), rootsof1pow(z, s));
      coe = mfcharcxeval(CHI, Di, prec + 1);
      if (!gequal1(coe)) V = RgV_Rg_mul(V, conj_i(coe));
      gel(vres, ind) = V;
    }
  }
  return mkvec2(vres, vresaw);
}
static GEN mfgaexpansionall ( GEN mf , GEN FE , GEN cosets , double height , long prec ) { GEN CHI = MF_get_CHI ( mf ) , vres , vresaw ; long lco , j , k = MF_get_k ( mf ) , N = MF_get_N ( mf ) , bitprec = prec2nbits ( prec ) ; lco = lg ( cosets ) ; vres = const_vec ( lco - 1 , NULL ) ; vresaw = cgetg ( lco , t_VEC ) ; for ( j = 1 ; j < lco ; j ++ ) if ( ! gel ( vres , j ) ) { GEN ga = gel ( cosets , j ) , van , aw , al , z , gai ; long w1 = mfZC_width ( N , gel ( ga , 1 ) ) ; long w2 = mfZC_width ( N , gel ( ga , 2 ) ) ; long nlim , nlim2 , daw , da , na , i ; double sqNinvdbl = height ? height / w1 : 1. / sqrt ( ( double ) w1 * N ) ; nlim = mfperiod_prelim_double ( sqNinvdbl , k , bitprec + 32 ) ; van = mfslashexpansion ( mf , FE , ga , nlim , 0 , & aw , prec + 1 ) ; van = vanembed ( gel ( FE , 1 ) , van , prec + 1 ) ; al = gel ( aw , 1 ) ; nlim2 = height ? nlim : getnlim2 ( N , w1 , w2 , nlim , k , bitprec ) ; gel ( vres , j ) = vecslice ( van , 1 , nlim2 + 1 ) ; gel ( vresaw , j ) = aw ; Qtoss ( al , & na , & da ) ; daw = da * w1 ; z = rootsof1powinit ( 1 , daw , prec + 1 ) ; gai = ga ; for ( i = 1 ; i < w1 ; i ++ ) { GEN V , coe ; long Di , n , ind , w2 , s = ( ( i * na ) % da ) * w1 , t = i * da ; gai = ZM_mulT ( gai ) ; ind = mftocoset_iD ( N , gai , cosets , & Di ) ; w2 = mfZC_width ( N , gel ( gel ( cosets , ind ) , 2 ) ) ; nlim2 = height ? nlim : getnlim2 ( N , w1 , w2 , nlim , k , bitprec ) ; gel ( vresaw , ind ) = aw ; V = cgetg ( nlim2 + 2 , t_VEC ) ; for ( n = 0 ; n <= nlim2 ; n ++ , s = Fl_add ( s , t , daw ) ) gel ( V , n + 1 ) = gmul ( gel ( van , n + 1 ) , rootsof1pow ( z , s ) ) ; coe = mfcharcxeval ( CHI , Di , prec + 1 ) ; if ( ! gequal1 ( coe ) ) V = RgV_Rg_mul ( V , conj_i ( coe ) ) ; gel ( vres , ind ) = V ; } } return mkvec2 ( vres , vresaw ) ; }
Compute all slashexpansions for all cosets
Compute all slashexpansions for all cosets