File: zeta_rs_f_coeffs.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 (70 lines) | stat: -rw-r--r-- 1,998 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
/*
    Copyright (C) 2016 Fredrik Johansson

    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_zeta_rs_f_coeffs(acb_ptr c, const arb_t p, slong N, slong prec)
{
    arb_ptr R, I, T, X;
    slong i, len;

    R = _arb_vec_init(N);
    I = _arb_vec_init(N);
    T = _arb_vec_init(N);
    X = _arb_vec_init(2);

    arb_set(X, p);
    arb_one(X + 1);

    /* I, R = sin,cos(pi*(X^2/2 + 3/8)) */
    len = FLINT_MIN(N, 3);
    _arb_poly_mullow(T, X, 2, X, 2, len, prec);
    _arb_vec_scalar_mul_2exp_si(T, T, len, -1);
    arb_set_d(R, 0.375);
    arb_add(T, T, R, prec);
    _arb_poly_sin_cos_pi_series(I, R, T, len, N, prec);

    /* I -= cos(pi*x/2) * sqrt(2) */
    _arb_vec_scalar_mul_2exp_si(X, X, 2, -1);
    _arb_poly_cos_pi_series(T, X, 2, N, prec);
    arb_sqrt_ui((arb_ptr) c, 2, prec);
    _arb_vec_scalar_mul(T, T, N, (arb_ptr) c, prec);
    _arb_vec_sub(I, I, T, N, prec);
    _arb_vec_scalar_mul_2exp_si(X, X, 2, 1);

    /* T = 1 / (2 cos(pi*x)) */
    _arb_poly_cos_pi_series(T, X, 2, N, prec);
    _arb_vec_scalar_mul_2exp_si(T, T, N, 1);
    _arb_poly_inv_series((arb_ptr) c, T, N, N, prec);
    _arb_vec_swap(T, (arb_ptr) c, N);

    /* R, I *= T */
    _arb_poly_mullow((arb_ptr) c, R, N, T, N, N, prec);
    _arb_vec_swap(R, (arb_ptr) c, N);
    _arb_poly_mullow((arb_ptr) c, I, N, T, N, N, prec);
    _arb_vec_swap(I, (arb_ptr) c, N);

    for (i = 0; i < N; i++)
    {
        arb_swap(acb_realref(c + i), R + i);
        arb_swap(acb_imagref(c + i), I + i);
    }

    _acb_poly_inv_borel_transform(c, c, N, prec);

    _arb_vec_clear(R, N);
    _arb_vec_clear(I, N);
    _arb_vec_clear(T, N);
    _arb_vec_clear(X, 2);
}