small improvement for barnes_g

This commit is contained in:
fredrik 2021-09-23 20:26:00 +02:00
parent 636ca0be39
commit 3d62dc3382
2 changed files with 26 additions and 15 deletions

View file

@ -108,6 +108,10 @@ acb_log_barnes_g(acb_t res, const acb_t z, slong prec)
void void
acb_barnes_g(acb_t res, const acb_t z, slong prec) acb_barnes_g(acb_t res, const acb_t z, slong prec)
{ {
int real;
real = acb_is_real(z);
if (acb_is_int(z)) if (acb_is_int(z))
{ {
if (arb_is_nonpositive(acb_realref(z))) if (arb_is_nonpositive(acb_realref(z)))
@ -126,5 +130,8 @@ acb_barnes_g(acb_t res, const acb_t z, slong prec)
_acb_log_barnes_g_zeta(res, z, prec); _acb_log_barnes_g_zeta(res, z, prec);
acb_exp(res, res, prec); acb_exp(res, res, prec);
if (real)
arb_zero(acb_imagref(res));
} }

View file

@ -691,10 +691,7 @@ _arb_barnes_g(arb_t res, const arb_t x, slong prec)
acb_init(u); acb_init(u);
acb_set_arb(t, x); acb_set_arb(t, x);
acb_barnes_g(u, t, prec); acb_barnes_g(u, t, prec);
if (acb_is_real(u)) arb_set(res, acb_realref(u));
arb_set(res, acb_realref(u));
else
arb_indeterminate(res);
acb_clear(t); acb_clear(t);
acb_clear(u); acb_clear(u);
} }
@ -702,17 +699,24 @@ _arb_barnes_g(arb_t res, const arb_t x, slong prec)
static void static void
_arb_log_barnes_g(arb_t res, const arb_t x, slong prec) _arb_log_barnes_g(arb_t res, const arb_t x, slong prec)
{ {
acb_t t, u; if (!arb_is_positive(x))
acb_init(t); {
acb_init(u);
acb_set_arb(t, x);
acb_log_barnes_g(u, t, prec);
if (acb_is_real(u))
arb_set(res, acb_realref(u));
else
arb_indeterminate(res); arb_indeterminate(res);
acb_clear(t); }
acb_clear(u); else
{
acb_t t, u;
acb_init(t);
acb_init(u);
acb_set_arb(t, x);
acb_log_barnes_g(u, t, prec);
if (acb_is_real(u))
arb_set(res, acb_realref(u));
else
arb_indeterminate(res);
acb_clear(t);
acb_clear(u);
}
} }
DEF_DOUBLE_FUN_1(barnes_g, _arb_barnes_g) DEF_DOUBLE_FUN_1(barnes_g, _arb_barnes_g)
@ -835,7 +839,7 @@ DEF_CDOUBLE_FUN_2(hermite_h, acb_hypgeom_hermite_h)
/* todo: fresnel (with flags) */ /* todo: fresnel (with flags) */
/* todo: functions with multiple outputs */ /* todo: functions with multiple outputs */
/* todo: incomplete gamma, exp integrals... */ /* todo: incomplete gamma, exp integrals... */
/* todo: airy zeros */
/* legendre_p, legendre_q, +roots, spherharm */ /* legendre_p, legendre_q, +roots, spherharm */
/* todo: pfqs */ /* todo: pfqs */