File: l_hurwitz.c

package info (click to toggle)
flint-arb 1%3A2.19.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 13,028 kB
  • sloc: ansic: 177,109; sh: 553; makefile: 288; python: 268
file content (90 lines) | stat: -rw-r--r-- 2,196 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
/*
    Copyright (C) 2016 Fredrik Johansson
    Copyright (C) 2016 Pascal Molin

    This file is part of Arb.

    Arb is free software: you can redistribute it and/or modify it under
    the terms of the GNU Lesser General Public License (LGPL) as published
    by the Free Software Foundation; either version 2.1 of the License, or
    (at your option) any later version.  See <http://www.gnu.org/licenses/>.
*/

#include "acb_dirichlet.h"
#include "acb_poly.h"

void
acb_dirichlet_l_hurwitz(acb_t res, const acb_t s,
    const acb_dirichlet_hurwitz_precomp_t precomp,
    const dirichlet_group_t G, const dirichlet_char_t chi, slong prec)
{
    ulong order, chin, mult;
    acb_t t, u, a, w;
    dirichlet_char_t cn;
    acb_dirichlet_roots_t roots;
    int deflate;

    /* remove pole in Hurwitz zeta at s = 1 */
    deflate = 0;
    if (acb_is_one(s))
    {
        if (dirichlet_char_is_principal(G, chi))
        {
            acb_indeterminate(res);
            return;
        }
        deflate = 1;
    }

    dirichlet_char_init(cn, G);
    acb_init(t);
    acb_init(u);
    acb_init(a);
    acb_init(w);

    dirichlet_char_one(cn, G);
    acb_zero(t);

    prec += n_clog(G->phi_q, 2);

    order = dirichlet_order_char(G, chi);
    mult = G->expo / order;
    acb_dirichlet_roots_init(roots, order, dirichlet_group_size(G), prec);

    do {
        chin = dirichlet_pairing_char(G, chi, cn) / mult;

        if (precomp == NULL)
        {
            acb_set_ui(a, cn->n);
            acb_div_ui(a, a, G->q, prec);

            if (deflate == 0)
                acb_hurwitz_zeta(u, s, a, prec);
            else
                _acb_poly_zeta_cpx_series(u, s, a, 1, 1, prec);
        }
        else
        {
            acb_dirichlet_hurwitz_precomp_eval(u, precomp, cn->n, G->q, prec);
        }

        acb_dirichlet_root(w, roots, chin, prec);
        acb_addmul(t, u, w, prec);

    } while (dirichlet_char_next(cn, G) >= 0);

    acb_set_ui(u, G->q);
    acb_neg(a, s);
    acb_pow(u, u, a, prec);
    acb_mul(res, t, u, prec);

    dirichlet_char_clear(cn);

    acb_dirichlet_roots_clear(roots);
    acb_clear(t);
    acb_clear(u);
    acb_clear(a);
    acb_clear(w);
}