/* log N_{F_P/Q_p}(x) / deg_F P */ static GEN vtilde_i(GEN K, GEN x, GEN T, GEN deg, GEN ell, long prec) { GEN L, N, cx; if (typ(x) != t_POL) x = nf_to_scalar_or_alg(K, x); x = Q_primitive_part(x,&cx); N = RgXQ_norm(x, T); L = Qp_log(cvtop(N,ell,prec)); if (cx) { Q_pvalrem(cx, ell, &cx); if (!isint1(cx)) L = gadd(L, gmulsg(degpol(T), Qp_log(cvtop(cx,ell,prec)))); } return gdiv(L, deg); }
/* min(v, v(Log_p Norm_{F_\p/Q_p}(x))) */ static long vlognorm(GEN nf, GEN T, GEN x, GEN p, long v) { GEN a = nf_to_scalar_or_alg(nf, x); GEN N = RgXQ_norm(a, T); if (typ(N) != t_PADIC) N = cvtop(N, p, v); return minss(v, valp( Qp_log(N) )); }
/* v[i] = deg S[i] mod p^prec */ static GEN get_vdegS(GEN Ftilde, GEN ell, long prec) { long i, l = lg(Ftilde); GEN v = cgetg(l, t_VEC), degell = Qp_log( cvtop(ell1(ell), ell, prec) ); for (i = 1; i < l; i++) gel(v,i) = gmulsg(Ftilde[i], degell); return v; }
/* Assume a = 1 [4] */ static GEN Z2XQ_invnorm(GEN a, GEN T, long e) { pari_timer ti; GEN pe = int2n(e), s; if (degpol(a)==0) return Fp_inv(Fp_powu(gel(a,2), get_FpX_degree(T), pe), pe); if (DEBUGLEVEL>=3) timer_start(&ti); s = ZpXQ_log(a, T, gen_2, e); if (DEBUGLEVEL>=3) timer_printf(&ti,"Z2XQ_log"); s = Fp_neg(FpXQ_trace(s, T, pe), pe); if (DEBUGLEVEL>=3) timer_printf(&ti,"FpXQ_trace"); s = modii(gel(Qp_exp(cvtop(s, gen_2, e-2)),4),pe); if (DEBUGLEVEL>=3) timer_printf(&ti,"Qp_exp"); return s; }