bridge/class-master/depend/pari/src/basemath/mellininv.c
/* Initialize data for computing m-th derivative of inverse Mellin */
Initialize data for computing m-th derivative of inverse Mellin
Initialize data for computing m - th derivative of inverse Mellin
GEN
gammamellininvinit(GEN Vga, long m, long bitprec)
{
  pari_sp ltop = avma;
  GEN A2, M, VS, VL, cd;
  long d = lg(Vga)-1, status;
  const double C2 = MELLININV_CUTOFF, D = get_D(d);
  double E = M_LN2*bitprec, tmax = get_tmax(bitprec); 
  const long nlimmax = ceil(E*log2(1+M_PI*tmax)*C2/D);
  if (!is_vec_t(typ(Vga))) pari_err_TYPE("gammamellininvinit",Vga);
  A2 = gaddsg(m*(2-d) + 1-d, vecsum(Vga));
  cd = (d <= 2)? gen_2: gsqrt(gdivgs(int2n(d+1), d), nbits2prec(bitprec));
  M = gammamellininvasymp_i(Vga, nlimmax, m, &status);
  if (status == 2)
  {
    tmax = -1.; 
    VS = gen_0;
  }
  else
  {
    long prec = nbits2prec((4*bitprec)/3);
    VS = Kderivsmallinit(Vga, m, bitprec);
    if (status == 0 && ishankelspec(Vga, M)) status = 1;
    if (status == 1)
    { 
      GEN t = ginv(mppi(prec));
      long i;
      for (i = 2; i < lg(M); ++i)
        gel(M, i) = gadd(gel(M, i), gmul(gel(M, i-1), t));
    }
    else
      M = RgC_gtofp(M, prec); 
    M = contfracinit(M, lg(M)-2);
  }
  VL = mkvec3(mkvec2(M, stoi(status)), cd, A2);
  return gerepilecopy(ltop, mkvec5(dbltor(tmax), Vga, stoi(m), VS, VL));
}
GEN gammamellininvinit ( GEN Vga , long m , long bitprec ) { pari_sp ltop = avma ; GEN A2 , M , VS , VL , cd ; long d = lg ( Vga ) - 1 , status ; const double C2 = MELLININV_CUTOFF , D = get_D ( d ) ; double E = M_LN2 * bitprec , tmax = get_tmax ( bitprec ) ; const long nlimmax = ceil ( E * log2 ( 1 + M_PI * tmax ) * C2 / D ) ; if ( ! is_vec_t ( typ ( Vga ) ) ) pari_err_TYPE ( " " , Vga ) ; A2 = gaddsg ( m * ( 2 - d ) + 1 - d , vecsum ( Vga ) ) ; cd = ( d <= 2 ) ? gen_2 : gsqrt ( gdivgs ( int2n ( d + 1 ) , d ) , nbits2prec ( bitprec ) ) ; M = gammamellininvasymp_i ( Vga , nlimmax , m , & status ) ; if ( status == 2 ) { tmax = -1. ; VS = gen_0 ; } else { long prec = nbits2prec ( ( 4 * bitprec ) / 3 ) ; VS = Kderivsmallinit ( Vga , m , bitprec ) ; if ( status == 0 && ishankelspec ( Vga , M ) ) status = 1 ; if ( status == 1 ) { GEN t = ginv ( mppi ( prec ) ) ; long i ; for ( i = 2 ; i < lg ( M ) ; ++ i ) gel ( M , i ) = gadd ( gel ( M , i ) , gmul ( gel ( M , i - 1 ) , t ) ) ; } else M = RgC_gtofp ( M , prec ) ; M = contfracinit ( M , lg ( M ) - 2 ) ; } VL = mkvec3 ( mkvec2 ( M , stoi ( status ) ) , cd , A2 ) ; return gerepilecopy ( ltop , mkvec5 ( dbltor ( tmax ) , Vga , stoi ( m ) , VS , VL ) ) ; }
Initialize data for computing m-th derivative of inverse Mellin
Initialize data for computing m - th derivative of inverse Mellin
/* = E/C2 */ /* if in Klarge, we have |t| > tmax = E/C2, thus nlim < E*C2/D. */ /* only use Klarge */ /* a Hankel determinant vanishes => contfracinit is undefined.
         So compute K(t) / (1 - 1/(pi^2*t)) instead of K(t)*/ /* convert from rationals to t_REAL: faster */