Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-11-07 10:15:04

0001 /*
0002     Copyright (C) 2015 Jonathan Bober
0003     Copyright (C) 2016 Fredrik Johansson
0004     Copyright (C) 2016 Pascal Molin
0005 
0006     This file is part of FLINT.
0007 
0008     FLINT is free software: you can redistribute it and/or modify it under
0009     the terms of the GNU Lesser General Public License (LGPL) as published
0010     by the Free Software Foundation; either version 3 of the License, or
0011     (at your option) any later version.  See <https://www.gnu.org/licenses/>.
0012 */
0013 
0014 #ifndef ACB_DIRICHLET_H
0015 #define ACB_DIRICHLET_H
0016 
0017 #include "acb_types.h"
0018 #include "dirichlet.h"
0019 
0020 #ifdef __cplusplus
0021 extern "C" {
0022 #endif
0023 
0024 void acb_dirichlet_powsum_term(acb_ptr res, arb_t log_prev, ulong * prev,
0025     const acb_t s, ulong k, int integer, int critical_line, slong len, slong prec);
0026 
0027 void acb_dirichlet_powsum_sieved(acb_ptr z, const acb_t s, ulong n, slong len, slong prec);
0028 void acb_dirichlet_powsum_smooth(acb_ptr z, const acb_t s, ulong n, slong len, slong prec);
0029 
0030 void acb_dirichlet_zeta_bound(mag_t res, const acb_t s);
0031 void acb_dirichlet_zeta_deriv_bound(mag_t der1, mag_t der2, const acb_t s);
0032 void acb_dirichlet_zeta_rs_f_coeffs(acb_ptr c, const arb_t p, slong N, slong prec);
0033 void acb_dirichlet_zeta_rs_d_coeffs(arb_ptr d, const arb_t sigma, slong k, slong prec);
0034 void acb_dirichlet_zeta_rs_bound(mag_t err, const acb_t s, slong K);
0035 void acb_dirichlet_zeta_rs_r(acb_t res, const acb_t s, slong K, slong prec);
0036 void acb_dirichlet_zeta_rs(acb_t res, const acb_t s, slong K, slong prec);
0037 void acb_dirichlet_zeta(acb_t res, const acb_t s, slong prec);
0038 
0039 void acb_dirichlet_zeta_jet_rs(acb_ptr res, const acb_t s, slong len, slong prec);
0040 void acb_dirichlet_zeta_jet(acb_t res, const acb_t s, int deflate, slong len, slong prec);
0041 
0042 void acb_dirichlet_hurwitz(acb_t res, const acb_t s, const acb_t a, slong prec);
0043 
0044 void acb_dirichlet_lerch_phi_integral(acb_t res, const acb_t z, const acb_t s, const acb_t a, slong prec);
0045 void acb_dirichlet_lerch_phi_direct(acb_t res, const acb_t z, const acb_t s, const acb_t a, slong prec);
0046 void acb_dirichlet_lerch_phi(acb_t res, const acb_t z, const acb_t s, const acb_t a, slong prec);
0047 
0048 void acb_dirichlet_stieltjes(acb_t res, const fmpz_t n, const acb_t a, slong prec);
0049 
0050 typedef struct
0051 {
0052     acb_struct s;
0053     mag_struct err;
0054     acb_ptr coeffs;
0055     int deflate;
0056     slong A;
0057     slong N;
0058     slong K;
0059 }
0060 acb_dirichlet_hurwitz_precomp_struct;
0061 
0062 typedef acb_dirichlet_hurwitz_precomp_struct acb_dirichlet_hurwitz_precomp_t[1];
0063 
0064 void acb_dirichlet_hurwitz_precomp_init(acb_dirichlet_hurwitz_precomp_t pre, const acb_t s, int deflate, slong A, slong K, slong N, slong prec);
0065 void acb_dirichlet_hurwitz_precomp_init_num(acb_dirichlet_hurwitz_precomp_t pre, const acb_t s, int deflate, double num_eval, slong prec);
0066 void acb_dirichlet_hurwitz_precomp_clear(acb_dirichlet_hurwitz_precomp_t pre);
0067 void acb_dirichlet_hurwitz_precomp_bound(mag_t res, const acb_t s, slong A, slong K, slong N);
0068 void acb_dirichlet_hurwitz_precomp_eval(acb_t res, const acb_dirichlet_hurwitz_precomp_t pre, ulong p, ulong q, slong prec);
0069 void acb_dirichlet_hurwitz_precomp_choose_param(ulong * A, ulong * K, ulong * N, const acb_t s, double num_eval, slong prec);
0070 
0071 void _acb_dirichlet_euler_product_real_ui(arb_t res, ulong s,
0072     const signed char * chi, int mod, int reciprocal, slong prec);
0073 
0074 void acb_dirichlet_eta(acb_t res, const acb_t s, slong prec);
0075 
0076 void acb_dirichlet_xi(acb_t res, const acb_t s, slong prec);
0077 
0078 void acb_dirichlet_pairing(acb_t res, const dirichlet_group_t G, ulong m, ulong n, slong prec);
0079 void acb_dirichlet_pairing_char(acb_t res, const dirichlet_group_t G, const dirichlet_char_t a, const dirichlet_char_t b, slong prec);
0080 
0081 /* precompute roots of unity */
0082 typedef struct
0083 {
0084     ulong order;
0085     ulong reduced_order;
0086     acb_t z;
0087     slong size;
0088     slong depth;
0089     acb_ptr * Z;
0090     int use_pow;
0091 }
0092 acb_dirichlet_roots_struct;
0093 
0094 typedef acb_dirichlet_roots_struct acb_dirichlet_roots_t[1];
0095 
0096 void acb_dirichlet_roots_init(acb_dirichlet_roots_t t, ulong order, slong num, slong prec);
0097 void acb_dirichlet_roots_clear(acb_dirichlet_roots_t t);
0098 void acb_dirichlet_root(acb_t z, const acb_dirichlet_roots_t t, ulong n, slong prec);
0099 
0100 void acb_dirichlet_chi(acb_t res, const dirichlet_group_t G, const dirichlet_char_t chi, ulong n, slong prec);
0101 void acb_dirichlet_chi_vec(acb_ptr v, const dirichlet_group_t G, const dirichlet_char_t chi, slong nv, slong prec);
0102 
0103 void acb_dirichlet_arb_quadratic_powers(arb_ptr v, slong nv, const arb_t x, slong prec);
0104 void acb_dirichlet_qseries_arb(acb_t res, acb_srcptr a, const arb_t x, slong len, slong prec);
0105 void acb_dirichlet_qseries_arb_powers_naive(acb_t res, const arb_t x, int parity, const ulong *a, const acb_dirichlet_roots_t z, slong len, slong prec);
0106 void acb_dirichlet_qseries_arb_powers_smallorder(acb_t res, const arb_t x, int parity, const ulong *a, const acb_dirichlet_roots_t z, slong len, slong prec);
0107 
0108 ulong acb_dirichlet_theta_length_d(ulong q, double x, slong prec);
0109 ulong acb_dirichlet_theta_length(ulong q, const arb_t x, slong prec);
0110 void mag_tail_kexpk2_arb(mag_t res, const arb_t a, ulong n);
0111 
0112 void _acb_dirichlet_theta_argument_at_arb(arb_t xt, ulong q, const arb_t t, slong prec);
0113 void _acb_dirichlet_theta_arb_series(acb_t res, const dirichlet_group_t G, const dirichlet_char_t chi, const arb_t xt, slong len, slong prec);
0114 void acb_dirichlet_theta_arb(acb_t res, const dirichlet_group_t G, const dirichlet_char_t chi, const arb_t t, slong prec);
0115 void acb_dirichlet_ui_theta_arb(acb_t res, const dirichlet_group_t G, ulong a, const arb_t t, slong prec);
0116 
0117 void acb_dirichlet_gauss_sum_naive(acb_t res, const dirichlet_group_t G, const dirichlet_char_t chi, slong prec);
0118 void acb_dirichlet_gauss_sum_factor(acb_t res, const dirichlet_group_t G, const dirichlet_char_t chi, slong prec);
0119 void acb_dirichlet_gauss_sum_order2(acb_t res, const dirichlet_group_t G, const dirichlet_char_t chi, slong prec);
0120 void acb_dirichlet_gauss_sum_theta(acb_t res, const dirichlet_group_t G, const dirichlet_char_t chi, slong prec);
0121 void acb_dirichlet_gauss_sum(acb_t res, const dirichlet_group_t G, const dirichlet_char_t chi, slong prec);
0122 
0123 void acb_dirichlet_root_number_theta(acb_t res, const dirichlet_group_t G, const dirichlet_char_t chi, slong prec);
0124 void acb_dirichlet_root_number(acb_t res, const dirichlet_group_t G, const dirichlet_char_t chi, slong prec);
0125 
0126 void acb_dirichlet_si_poly_evaluate(acb_t res, slong * v, slong len, const acb_t z, slong prec);
0127 
0128 void acb_dirichlet_jacobi_sum_naive(acb_t res, const dirichlet_group_t G, const dirichlet_char_t chi1, const dirichlet_char_t chi2, slong prec);
0129 ulong jacobi_one_prime(ulong p, ulong e, ulong pe, ulong cond);
0130 void acb_dirichlet_jacobi_sum_factor(acb_t res,  const dirichlet_group_t G, const dirichlet_char_t chi1, const dirichlet_char_t chi2, slong prec);
0131 void acb_dirichlet_jacobi_sum_gauss(acb_t res, const dirichlet_group_t G, const dirichlet_char_t chi1, const dirichlet_char_t chi2, slong prec);
0132 void acb_dirichlet_jacobi_sum(acb_t res, const dirichlet_group_t G, const dirichlet_char_t chi1, const dirichlet_char_t chi2, slong prec);
0133 void acb_dirichlet_jacobi_sum_ui(acb_t res, const dirichlet_group_t G, ulong a, ulong b, slong prec);
0134 
0135 void acb_dirichlet_l_euler_product(acb_t res, const acb_t s, const dirichlet_group_t G, const dirichlet_char_t chi, slong prec);
0136 
0137 void acb_dirichlet_l_hurwitz(acb_t res, const acb_t s, const acb_dirichlet_hurwitz_precomp_t precomp,
0138     const dirichlet_group_t G, const dirichlet_char_t chi, slong prec);
0139 
0140 void acb_dirichlet_l(acb_t res, const acb_t s, const dirichlet_group_t G, const dirichlet_char_t chi, slong prec);
0141 
0142 void acb_dirichlet_l_vec_hurwitz(acb_ptr res, const acb_t s, const acb_dirichlet_hurwitz_precomp_t precomp, const dirichlet_group_t G, slong prec);
0143 
0144 void acb_dirichlet_l_jet(acb_ptr res, const acb_t s, const dirichlet_group_t G, const dirichlet_char_t chi, int deflate, slong len, slong prec);
0145 
0146 void acb_dirichlet_l_fmpq_afe(acb_t res, const fmpq_t s, const dirichlet_group_t G, const dirichlet_char_t chi, slong prec);
0147 void acb_dirichlet_l_fmpq(acb_t res, const fmpq_t s, const dirichlet_group_t G, const dirichlet_char_t chi, slong prec);
0148 
0149 void _acb_dirichlet_l_series(acb_ptr res, acb_srcptr s, slong slen,
0150     const dirichlet_group_t G, const dirichlet_char_t chi,
0151     int deflate, slong len, slong prec);
0152 
0153 void acb_dirichlet_l_series(acb_poly_t res, const acb_poly_t s,
0154     const dirichlet_group_t G, const dirichlet_char_t chi,
0155     int deflate, slong len, slong prec);
0156 
0157 void acb_dirichlet_hardy_theta(acb_ptr res, const acb_t t,
0158     const dirichlet_group_t G, const dirichlet_char_t chi,
0159     slong len, slong prec);
0160 
0161 void acb_dirichlet_hardy_z(acb_ptr res, const acb_t t,
0162     const dirichlet_group_t G, const dirichlet_char_t chi,
0163     slong len, slong prec);
0164 
0165 void _acb_dirichlet_hardy_theta_series(acb_ptr res, acb_srcptr s, slong slen, const dirichlet_group_t G, const dirichlet_char_t chi, slong len, slong prec);
0166 void acb_dirichlet_hardy_theta_series(acb_poly_t res, const acb_poly_t s, const dirichlet_group_t G, const dirichlet_char_t chi, slong len, slong prec);
0167 void _acb_dirichlet_hardy_z_series(acb_ptr res, acb_srcptr s, slong slen, const dirichlet_group_t G, const dirichlet_char_t chi, slong len, slong prec);
0168 void acb_dirichlet_hardy_z_series(acb_poly_t res, const acb_poly_t s, const dirichlet_group_t G, const dirichlet_char_t chi, slong len, slong prec);
0169 
0170 void acb_dirichlet_gram_point(arb_t res, const fmpz_t n, const dirichlet_group_t G, const dirichlet_char_t chi, slong prec);
0171 ulong acb_dirichlet_turing_method_bound(const fmpz_t p);
0172 int _acb_dirichlet_definite_hardy_z(arb_t res, const arf_t t, slong *pprec);
0173 void _acb_dirichlet_isolate_gram_hardy_z_zero(arf_t a, arf_t b, const fmpz_t n);
0174 void _acb_dirichlet_isolate_rosser_hardy_z_zero(arf_t a, arf_t b, const fmpz_t n);
0175 void _acb_dirichlet_isolate_turing_hardy_z_zero(arf_t a, arf_t b, const fmpz_t n);
0176 void acb_dirichlet_isolate_hardy_z_zero(arf_t a, arf_t b, const fmpz_t n);
0177 void _acb_dirichlet_refine_hardy_z_zero(arb_t res, const arf_t a, const arf_t b, slong prec);
0178 void acb_dirichlet_hardy_z_zeros(arb_ptr res, const fmpz_t n, slong len, slong prec);
0179 void acb_dirichlet_zeta_zeros(acb_ptr res, const fmpz_t n, slong len, slong prec);
0180 slong acb_dirichlet_platt_zeta_zeros(acb_ptr res, const fmpz_t n, slong len, slong prec);
0181 void _acb_dirichlet_exact_zeta_nzeros(fmpz_t res, const arf_t t);
0182 void acb_dirichlet_zeta_nzeros(arb_t res, const arb_t t, slong prec);
0183 void acb_dirichlet_backlund_s(arb_t res, const arb_t t, slong prec);
0184 void acb_dirichlet_backlund_s_bound(mag_t res, const arb_t t);
0185 void acb_dirichlet_zeta_nzeros_gram(fmpz_t res, const fmpz_t n);
0186 slong acb_dirichlet_backlund_s_gram(const fmpz_t n);
0187 
0188 FLINT_FORCE_INLINE void
0189 acb_dirichlet_hardy_z_zero(arb_t res, const fmpz_t n, slong prec)
0190 {
0191     acb_dirichlet_hardy_z_zeros(res, n, 1, prec);
0192 }
0193 
0194 FLINT_FORCE_INLINE void
0195 acb_dirichlet_zeta_zero(acb_t res, const fmpz_t n, slong prec)
0196 {
0197     acb_dirichlet_zeta_zeros(res, n, 1, prec);
0198 }
0199 
0200 void acb_dirichlet_secondary_zeta(acb_t res, const acb_t s, slong prec);
0201 
0202 void acb_dirichlet_vec_mellin_arb(acb_ptr res, const dirichlet_group_t G, const dirichlet_char_t chi, slong len, const arb_t t, slong n, slong prec);
0203 
0204 /* Platt zeta zeros */
0205 
0206 typedef struct
0207 {
0208     slong len;
0209     arb_ptr p;
0210     arb_struct Xa;
0211     arb_struct Xb;
0212 }
0213 acb_dirichlet_platt_c_precomp_struct;
0214 typedef acb_dirichlet_platt_c_precomp_struct acb_dirichlet_platt_c_precomp_t[1];
0215 
0216 typedef struct
0217 {
0218     arb_struct c1;
0219     arb_struct c2;
0220 }
0221 acb_dirichlet_platt_i_precomp_struct;
0222 typedef acb_dirichlet_platt_i_precomp_struct acb_dirichlet_platt_i_precomp_t[1];
0223 
0224 typedef struct
0225 {
0226     acb_dirichlet_platt_c_precomp_struct pre_c;
0227     acb_dirichlet_platt_i_precomp_struct pre_i;
0228 }
0229 acb_dirichlet_platt_ws_precomp_struct;
0230 typedef acb_dirichlet_platt_ws_precomp_struct acb_dirichlet_platt_ws_precomp_t[1];
0231 
0232 /* Platt C bound */
0233 
0234 void acb_dirichlet_platt_c_precomp_init(acb_dirichlet_platt_c_precomp_t pre,
0235     slong sigma, const arb_t h, ulong k, slong prec);
0236 void acb_dirichlet_platt_c_precomp_clear(acb_dirichlet_platt_c_precomp_t pre);
0237 void acb_dirichlet_platt_c_bound_precomp(arb_t res,
0238     const acb_dirichlet_platt_c_precomp_t pre, slong sigma, const arb_t t0,
0239     const arb_t h, slong k, slong prec);
0240 void acb_dirichlet_platt_c_bound(arb_t res,
0241     slong sigma, const arb_t t0, const arb_t h, slong k, slong prec);
0242 
0243 /* Platt I bound */
0244 
0245 void acb_dirichlet_platt_i_precomp_init(acb_dirichlet_platt_i_precomp_t pre,
0246         slong A, const arb_t H, slong sigma, slong prec);
0247 void acb_dirichlet_platt_i_precomp_clear(acb_dirichlet_platt_i_precomp_t pre);
0248 void acb_dirichlet_platt_i_bound_precomp(arb_t res,
0249     const acb_dirichlet_platt_i_precomp_t pre_i,
0250     const acb_dirichlet_platt_c_precomp_t pre_c,
0251     const arb_t t0, slong A, const arb_t H, slong sigma, slong prec);
0252 void acb_dirichlet_platt_i_bound(arb_t res,
0253     const arb_t t0, slong A, const arb_t H, slong sigma, slong prec);
0254 
0255 /* Platt Gaussian-windowed Whittaker-Shannon interpolation */
0256 
0257 void acb_dirichlet_platt_ws_precomp_init(acb_dirichlet_platt_ws_precomp_t pre,
0258     slong A, const arb_t H, slong sigma, slong prec);
0259 void acb_dirichlet_platt_ws_precomp_clear(acb_dirichlet_platt_ws_precomp_t pre);
0260 void acb_dirichlet_platt_ws_interpolation_precomp(arb_t res, arf_t deriv,
0261     const acb_dirichlet_platt_ws_precomp_t pre, const arb_t t0,
0262     arb_srcptr p, const fmpz_t T, slong A, slong B, slong Ns_max,
0263     const arb_t H, slong sigma, slong prec);
0264 void acb_dirichlet_platt_ws_interpolation(arb_t res, arf_t deriv,
0265     const arb_t t0, arb_srcptr p, const fmpz_t T, slong A, slong B,
0266     slong Ns_max, const arb_t H, slong sigma, slong prec);
0267 void acb_dirichlet_platt_bound_C3(arb_t res, const arb_t t0, slong A,
0268     const arb_t H, slong Ns, slong prec);
0269 
0270 void acb_dirichlet_platt_scaled_lambda(arb_t res, const arb_t t, slong prec);
0271 void acb_dirichlet_platt_scaled_lambda_vec(arb_ptr res, const fmpz_t T,
0272     slong A, slong B, slong prec);
0273 
0274 /* Platt lemma bounds of errors in the DFT grid evaluation of scaled Lambda */
0275 
0276 void acb_dirichlet_platt_beta(arb_t res, const arb_t t, slong prec);
0277 void acb_dirichlet_platt_lemma_32(arb_t out, const arb_t h, const arb_t t0,
0278     const arb_t x, slong prec);
0279 void acb_dirichlet_platt_lemma_A5(arb_t out, slong B, const arb_t h, slong k,
0280     slong prec);
0281 void acb_dirichlet_platt_lemma_A7(arb_t out, slong sigma, const arb_t t0,
0282     const arb_t h, slong k, slong A, slong prec);
0283 void acb_dirichlet_platt_lemma_A9(arb_t out, slong sigma, const arb_t t0,
0284     const arb_t h, slong A, slong prec);
0285 void acb_dirichlet_platt_lemma_A11(arb_t out, const arb_t t0, const arb_t h,
0286     slong B, slong prec);
0287 void acb_dirichlet_platt_lemma_B1(arb_t out, slong sigma, const arb_t t0,
0288     const arb_t h, const fmpz_t J, slong prec);
0289 void acb_dirichlet_platt_lemma_B2(arb_t out, slong K, const arb_t h,
0290     const arb_t xi, slong prec);
0291 
0292 /* Platt DFT grid evaluation of scaled Lambda */
0293 
0294 void acb_dirichlet_platt_multieval(arb_ptr out, const fmpz_t T,
0295     slong A, slong B, const arb_t h, const fmpz_t J, slong K,
0296     slong sigma, slong prec);
0297 void acb_dirichlet_platt_multieval_threaded(arb_ptr out, const fmpz_t T,
0298     slong A, slong B, const arb_t h, const fmpz_t J, slong K,
0299     slong sigma, slong prec);
0300 
0301 /* Platt Hardy Z zeros */
0302 
0303 slong _acb_dirichlet_platt_isolate_local_hardy_z_zeros(
0304     arf_interval_ptr res, const fmpz_t n, slong len,
0305     const fmpz_t T, slong A, slong B,
0306     const arb_t h, const fmpz_t J, slong K, slong sigma_grid,
0307     slong Ns_max, const arb_t H, slong sigma_interp, slong prec);
0308 slong acb_dirichlet_platt_isolate_local_hardy_z_zeros(
0309     arf_interval_ptr res, const fmpz_t n, slong len, slong prec);
0310 slong _acb_dirichlet_platt_local_hardy_z_zeros(
0311     arb_ptr res, const fmpz_t n, slong len,
0312     const fmpz_t T, slong A, slong B,
0313     const arb_t h, const fmpz_t J, slong K, slong sigma_grid,
0314     slong Ns_max, const arb_t H, slong sigma_interp, slong prec);
0315 slong acb_dirichlet_platt_local_hardy_z_zeros(
0316     arb_ptr res, const fmpz_t n, slong len, slong prec);
0317 slong acb_dirichlet_platt_hardy_z_zeros(
0318     arb_ptr res, const fmpz_t n, slong len, slong prec);
0319 
0320 /* Discrete Fourier Transform */
0321 
0322 void acb_dirichlet_dft_index(acb_ptr w, acb_srcptr v, const dirichlet_group_t G, slong prec);
0323 void acb_dirichlet_dft(acb_ptr w, acb_srcptr v, const dirichlet_group_t G, slong prec);
0324 
0325 #ifdef __cplusplus
0326 }
0327 #endif
0328 
0329 #endif