bridge/class-master/depend/pari/src/basemath/lfun.c
/* Check whether the coefficients, conductor, weight, polar part and root
 * number are compatible with the functional equation at t0 and 1/t0.
 * Different from lfunrootres. */
Check whether the coefficients, conductor, weight, polar part and root
number are compatible with the functional equation at t0 and 1/t0.
Different from lfunrootres.
Check whether the coefficients conductor weight polar part and root number are compatible with the functional equation at t0 and 1 / t0 . Different from lfunrootres .
long
lfuncheckfeq(GEN lmisc, GEN t0, long bitprec)
{
  GEN ldata, theta, thetad, t0i, S0, S0i, w, eno;
  long e, prec;
  pari_sp av;
  if (is_linit(lmisc) && linit_get_type(lmisc)==t_LDESC_PRODUCT)
  {
    GEN v = lfunprod_get_fact(linit_get_tech(lmisc)), F = gel(v,1);
    long i, b = -bitprec, l = lg(F);
    for (i = 1; i < l; i++)
      b = maxss(b, lfuncheckfeq(gel(F,i), t0, bitprec));
    return b;
  }
  av = avma;
  prec = nbits2prec(bitprec);
  if (!t0)
  {
    t0 = gadd(gdivgs(mppi(prec), 3), gdivgs(gen_I(), 7));
    t0i = ginv(t0);
  }
  else if (gcmpgs(gnorm(t0), 1) < 0)
  {
    t0i = t0;
    t0 = ginv(t0);
  }
  else
    t0i = ginv(t0);
  theta = lfunthetacheckinit(lmisc, t0i, 0, bitprec);
  ldata = linit_get_ldata(theta);
  thetad = theta_dual(theta, ldata_get_dual(ldata));
  if (thetad)
    S0 = lfuntheta(thetad, t0, 0, bitprec);
  else
    S0 = conj_i(lfuntheta(theta, conj_i(t0), 0, bitprec));
  S0i = lfuntheta(theta, t0i, 0, bitprec);
  eno = ldata_get_rootno(ldata);
  if (ldata_get_residue(ldata))
  {
    GEN R = theta_get_R(linit_get_tech(theta));
    if (gequal0(R))
    {
      GEN v, r;
      if (ldata_get_type(ldata) == t_LFUN_NF)
      { 
        GEN T = gel(ldata_get_an(ldata), 2);
        GEN L = lfunzetakinit(T,zerovec(3),0,0,bitprec);
        long e = lfuncheckfeq(L,t0,bitprec);
        avma = av; return e;
      }
      v = lfunrootres(theta, bitprec);
      r = gel(v,1);
      if (gequal0(eno)) eno = gel(v,3);
      R = lfunrtoR_i(ldata, r, eno, nbits2prec(bitprec));
    }
    S0i = theta_add_polar_part(S0i, R, t0, prec);
  }
  if (gequal0(S0i) || gequal0(S0)) pari_err_PREC("lfuncheckfeq");
  w = gdiv(S0i, gmul(S0, gpowgs(t0, ldata_get_k(ldata))));
  if (gequal0(eno)) eno = lfunrootno(theta, bitprec);
  w = gsub(w, eno);
  if (thetad) w = gdiv(w, eno); 
  e = gexpo(w);
  avma = av; return e;
}
long lfuncheckfeq ( GEN lmisc , GEN t0 , long bitprec ) { GEN ldata , theta , thetad , t0i , S0 , S0i , w , eno ; long e , prec ; pari_sp av ; if ( is_linit ( lmisc ) && linit_get_type ( lmisc ) == t_LDESC_PRODUCT ) { GEN v = lfunprod_get_fact ( linit_get_tech ( lmisc ) ) , F = gel ( v , 1 ) ; long i , b = - bitprec , l = lg ( F ) ; for ( i = 1 ; i < l ; i ++ ) b = maxss ( b , lfuncheckfeq ( gel ( F , i ) , t0 , bitprec ) ) ; return b ; } av = avma ; prec = nbits2prec ( bitprec ) ; if ( ! t0 ) { t0 = gadd ( gdivgs ( mppi ( prec ) , 3 ) , gdivgs ( gen_I ( ) , 7 ) ) ; t0i = ginv ( t0 ) ; } else if ( gcmpgs ( gnorm ( t0 ) , 1 ) < 0 ) { t0i = t0 ; t0 = ginv ( t0 ) ; } else t0i = ginv ( t0 ) ; theta = lfunthetacheckinit ( lmisc , t0i , 0 , bitprec ) ; ldata = linit_get_ldata ( theta ) ; thetad = theta_dual ( theta , ldata_get_dual ( ldata ) ) ; if ( thetad ) S0 = lfuntheta ( thetad , t0 , 0 , bitprec ) ; else S0 = conj_i ( lfuntheta ( theta , conj_i ( t0 ) , 0 , bitprec ) ) ; S0i = lfuntheta ( theta , t0i , 0 , bitprec ) ; eno = ldata_get_rootno ( ldata ) ; if ( ldata_get_residue ( ldata ) ) { GEN R = theta_get_R ( linit_get_tech ( theta ) ) ; if ( gequal0 ( R ) ) { GEN v , r ; if ( ldata_get_type ( ldata ) == t_LFUN_NF ) { GEN T = gel ( ldata_get_an ( ldata ) , 2 ) ; GEN L = lfunzetakinit ( T , zerovec ( 3 ) , 0 , 0 , bitprec ) ; long e = lfuncheckfeq ( L , t0 , bitprec ) ; avma = av ; return e ; } v = lfunrootres ( theta , bitprec ) ; r = gel ( v , 1 ) ; if ( gequal0 ( eno ) ) eno = gel ( v , 3 ) ; R = lfunrtoR_i ( ldata , r , eno , nbits2prec ( bitprec ) ) ; } S0i = theta_add_polar_part ( S0i , R , t0 , prec ) ; } if ( gequal0 ( S0i ) || gequal0 ( S0 ) ) pari_err_PREC ( " " ) ; w = gdiv ( S0i , gmul ( S0 , gpowgs ( t0 , ldata_get_k ( ldata ) ) ) ) ; if ( gequal0 ( eno ) ) eno = lfunrootno ( theta , bitprec ) ; w = gsub ( w , eno ) ; if ( thetad ) w = gdiv ( w , eno ) ; e = gexpo ( w ) ; avma = av ; return e ; }
Check whether the coefficients, conductor, weight, polar part and root
 number are compatible with the functional equation at t0 and 1/t0.
Check whether the coefficients conductor weight polar part and root number are compatible with the functional equation at t0 and 1 / t0 .
/* |t0| >= 1 */ /* inefficient since theta not needed; no need to optimize for this
           (artificial) query [e.g. lfuncheckfeq(t_POL)] */ /* missing rootno: guess it */ /* |eno| may be large in non-dual case */