bridge/class-master/depend/pari/src/basemath/mellininv.c
/* generalized power series expansion of inverse Mellin around x = 0;
 * m-th derivative */
generalized power series expansion of inverse Mellin around x = 0;
m-th derivative
generalized power series expansion of inverse Mellin around x = 0 ; m - th derivative
static GEN
Kderivsmallinit(GEN Vga, long m, long bitprec)
{
  pari_sp av = avma;
  long d = lg(Vga)-1, N, j, l, limn, prec;
  GEN LA, lj, mj, mat;
  double C2 = MELLININV_CUTOFF;
  LA = gammapoles(Vga);
  N = lg(LA)-1;
  lj = cgetg(N+1, t_VECSMALL);
  mj = cgetg(N+1, t_VEC);
  for (j = 1; j <= N; ++j)
  {
    GEN L = gel(LA,j);
    lj[j] = lg(L)-1;
    gel(mj,j) = gsubsg(2, vecmin(L));
  }
  prec = nbits2prec((long)(1+bitprec*(1+M_PI*d/C2)));
  limn = ceil(2*M_LN2*bitprec/(d*dbllambertW0(C2/(M_PI*M_E))));
  mat = cgetg(N+1, t_VEC);
  l = limn + 2;
  for (j=1; j <= N; j++)
  {
    GEN C, c, mjj = gel(mj,j), pr = gen_1, t = gen_1;
    long i, k, n, ljj = lj[j], lprecdl = ljj+3;
    for (i=1; i <= d; i++)
    {
      GEN a = gmul2n(gadd(mjj, gel(Vga,i)), -1);
      GEN u = deg1pol_shallow(ghalf, a, 0);
      pr = gmul(pr, ggamma(RgX_to_ser(u, lprecdl), prec));
      t = gmul(t, u);
    }
    c = cgetg(limn+2,t_COL);
    gel(c,1) = pr;
    for (n=1; n <= limn; n++)
      gel(c,n+1) = gdiv(gel(c,n), RgX_translate(t, stoi(-2*n)));
    gel(mat, j) = C = cgetg(ljj+1, t_COL);
    for (k = 1; k <= ljj; k++)
    {
      GEN L = cgetg(l, t_POL);
      L[1] = evalsigne(1)|evalvarn(0);
      for (n = 2; n < l; n++) gel(L,n) = sercoeff(gel(c,n), -k, prec);
      gel(C,k) = L;
    }
    if (m)
    {
      mjj = gsubgs(mjj, 2);
      for (i = 1; i <= m; i++, mjj = gaddgs(mjj, 1))
      {
        for (k = 1; k <= ljj; k++)
        {
          GEN c = gel(C,k), d = RgX_shift_shallow(gmul2n(RgX_deriv(c),1), 1);
          c = RgX_Rg_mul(c, mjj);
          if (k < ljj) c = RgX_add(c, gel(C,k+1));
          gel(C,k) = RgX_sub(d, c);
        }
      }
      gel(mj,j) = gaddgs(mjj,2);
    }
    for (k = 1; k <= ljj; k++)
    {
      GEN c = gel(C,k);
      if (k > 2) c = RgX_Rg_div(c, mpfact(k-1));
      gel(C,k) = RgX_to_RgC(c, lgpol(c));
    }
  }
  return gerepilecopy(av, mkvec3(lj,RgV_neg(mj),mat));
}
static GEN Kderivsmallinit ( GEN Vga , long m , long bitprec ) { pari_sp av = avma ; long d = lg ( Vga ) - 1 , N , j , l , limn , prec ; GEN LA , lj , mj , mat ; double C2 = MELLININV_CUTOFF ; LA = gammapoles ( Vga ) ; N = lg ( LA ) - 1 ; lj = cgetg ( N + 1 , t_VECSMALL ) ; mj = cgetg ( N + 1 , t_VEC ) ; for ( j = 1 ; j <= N ; ++ j ) { GEN L = gel ( LA , j ) ; lj [ j ] = lg ( L ) - 1 ; gel ( mj , j ) = gsubsg ( 2 , vecmin ( L ) ) ; } prec = nbits2prec ( ( long ) ( 1 + bitprec * ( 1 + M_PI * d / C2 ) ) ) ; limn = ceil ( 2 * M_LN2 * bitprec / ( d * dbllambertW0 ( C2 / ( M_PI * M_E ) ) ) ) ; mat = cgetg ( N + 1 , t_VEC ) ; l = limn + 2 ; for ( j = 1 ; j <= N ; j ++ ) { GEN C , c , mjj = gel ( mj , j ) , pr = gen_1 , t = gen_1 ; long i , k , n , ljj = lj [ j ] , lprecdl = ljj + 3 ; for ( i = 1 ; i <= d ; i ++ ) { GEN a = gmul2n ( gadd ( mjj , gel ( Vga , i ) ) , -1 ) ; GEN u = deg1pol_shallow ( ghalf , a , 0 ) ; pr = gmul ( pr , ggamma ( RgX_to_ser ( u , lprecdl ) , prec ) ) ; t = gmul ( t , u ) ; } c = cgetg ( limn + 2 , t_COL ) ; gel ( c , 1 ) = pr ; for ( n = 1 ; n <= limn ; n ++ ) gel ( c , n + 1 ) = gdiv ( gel ( c , n ) , RgX_translate ( t , stoi ( -2 * n ) ) ) ; gel ( mat , j ) = C = cgetg ( ljj + 1 , t_COL ) ; for ( k = 1 ; k <= ljj ; k ++ ) { GEN L = cgetg ( l , t_POL ) ; L [ 1 ] = evalsigne ( 1 ) | evalvarn ( 0 ) ; for ( n = 2 ; n < l ; n ++ ) gel ( L , n ) = sercoeff ( gel ( c , n ) , - k , prec ) ; gel ( C , k ) = L ; } if ( m ) { mjj = gsubgs ( mjj , 2 ) ; for ( i = 1 ; i <= m ; i ++ , mjj = gaddgs ( mjj , 1 ) ) { for ( k = 1 ; k <= ljj ; k ++ ) { GEN c = gel ( C , k ) , d = RgX_shift_shallow ( gmul2n ( RgX_deriv ( c ) , 1 ) , 1 ) ; c = RgX_Rg_mul ( c , mjj ) ; if ( k < ljj ) c = RgX_add ( c , gel ( C , k + 1 ) ) ; gel ( C , k ) = RgX_sub ( d , c ) ; } } gel ( mj , j ) = gaddgs ( mjj , 2 ) ; } for ( k = 1 ; k <= ljj ; k ++ ) { GEN c = gel ( C , k ) ; if ( k > 2 ) c = RgX_Rg_div ( c , mpfact ( k - 1 ) ) ; gel ( C , k ) = RgX_to_RgC ( c , lgpol ( c ) ) ; } } return gerepilecopy ( av , mkvec3 ( lj , RgV_neg ( mj ) , mat ) ) ; }
generalized power series expansion of inverse Mellin around x = 0;
 m-th derivative
generalized power series expansion of inverse Mellin around x = 0 ; m - th derivative
/* C[k] = \sum_n c_{j,k} t^n =: C_k(t) in Dokchitser's Algo 3.3 */ /* Take m-th derivative of t^(-mj+2) sum_k (-ln t)^k/k! C_k(t^2) */ /* Algo 3.3: * \phi^(m)(t) = sum_j t^m_j sum_k (-ln t)^k mat[j,k](t^2) */