fix aliasing issue in acb_hypgeom_gamma_lower

This commit is contained in:
Fredrik Johansson 2016-09-06 13:09:02 +02:00
parent 5468d7d31b
commit 043a589e04

View file

@ -14,7 +14,7 @@
void
acb_hypgeom_gamma_lower(acb_t res, const acb_t s, const acb_t z, int regularized, slong prec)
{
acb_t s1, nz, t;
acb_t s1, nz, t, u;
if (!acb_is_finite(s) || !acb_is_finite(z))
{
@ -25,6 +25,7 @@ acb_hypgeom_gamma_lower(acb_t res, const acb_t s, const acb_t z, int regularized
acb_init(s1);
acb_init(nz);
acb_init(t);
acb_init(u);
acb_add_ui(s1, s, 1, prec);
acb_neg(nz, z);
@ -32,17 +33,17 @@ acb_hypgeom_gamma_lower(acb_t res, const acb_t s, const acb_t z, int regularized
if (regularized == 0)
{
/* \gamma(s, z) = s^-1 z^s 1F1(s, 1+s, -z) */
acb_hypgeom_m(res, s, s1, nz, 0, prec);
acb_hypgeom_m(u, s, s1, nz, 0, prec);
acb_pow(t, z, s, prec);
acb_mul(res, res, t, prec);
acb_div(res, res, s, prec);
acb_mul(u, u, t, prec);
acb_div(res, u, s, prec);
}
else if (regularized == 1)
{
/* P(s, z) = z^s \gamma^{*}(s, z) */
acb_hypgeom_m(res, s, s1, nz, 1, prec);
acb_hypgeom_m(u, s, s1, nz, 1, prec);
acb_pow(t, z, s, prec);
acb_mul(res, res, t, prec);
acb_mul(res, u, t, prec);
}
else if (regularized == 2)
{
@ -53,4 +54,6 @@ acb_hypgeom_gamma_lower(acb_t res, const acb_t s, const acb_t z, int regularized
acb_clear(s1);
acb_clear(nz);
acb_clear(t);
acb_clear(u);
}