1 /*
2     Copyright (C) 2016 Fredrik Johansson
3 
4     This file is part of Arb.
5 
6     Arb is free software: you can redistribute it and/or modify it under
7     the terms of the GNU Lesser General Public License (LGPL) as published
8     by the Free Software Foundation; either version 2.1 of the License, or
9     (at your option) any later version.  See <http://www.gnu.org/licenses/>.
10 */
11 
12 #include "acb_hypgeom.h"
13 
14 void
_acb_hypgeom_erfi_series(acb_ptr g,acb_srcptr h,slong hlen,slong len,slong prec)15 _acb_hypgeom_erfi_series(acb_ptr g, acb_srcptr h, slong hlen, slong len, slong prec)
16 {
17     hlen = FLINT_MIN(hlen, len);
18 
19     if (hlen == 1)
20     {
21         acb_hypgeom_erfi(g, h, prec);
22         _acb_vec_zero(g + 1, len - 1);
23     }
24     else
25     {
26         slong k;
27         acb_ptr t = _acb_vec_init(hlen);
28         for (k = 0; k < hlen; k++)
29             acb_mul_onei(t + k, h + k);
30         _acb_hypgeom_erf_series(g, t, hlen, len, prec);
31         for (k = 0; k < len; k++)
32             acb_div_onei(g + k, g + k);
33         _acb_vec_clear(t, hlen);
34     }
35 }
36 
37 void
acb_hypgeom_erfi_series(acb_poly_t g,const acb_poly_t h,slong len,slong prec)38 acb_hypgeom_erfi_series(acb_poly_t g, const acb_poly_t h, slong len, slong prec)
39 {
40     slong hlen = h->length;
41 
42     if (hlen == 0 || len == 0)
43     {
44         acb_poly_zero(g);
45         return;
46     }
47 
48     acb_poly_fit_length(g, len);
49     _acb_hypgeom_erfi_series(g->coeffs, h->coeffs, hlen, len, prec);
50     _acb_poly_set_length(g, len);
51     _acb_poly_normalise(g);
52 }
53 
54