Commit e125cfc2 authored by Julien Puydt's avatar Julien Puydt

New upstream version 2.11.1

parent c56d7ba3
......@@ -16,9 +16,9 @@ make -j4 > /dev/null 2>&1
make install
cd ..
wget https://github.com/wbhart/flint2/archive/trunk.tar.gz
tar -xf trunk.tar.gz
cd flint2-trunk
wget http://flintlib.org/flint-2.5.2.tar.gz
tar -xf flint-2.5.2.tar.gz
cd flint-2.5.2
./configure --with-gmp=$HOME/deps --with-mpfr=$HOME/deps --prefix=$HOME/deps --disable-static
make -j4 > /dev/null 2>&1
make install
......
......@@ -15,6 +15,7 @@ AT=@
BUILD_DIRS = fmpr arf mag arb arb_mat arb_poly arb_calc acb acb_mat acb_poly \
acb_calc acb_hypgeom acb_elliptic acb_modular dirichlet acb_dirichlet \
arb_hypgeom bernoulli hypgeom fmpz_extras bool_mat partitions dlog \
arb_fmpz_poly \
$(EXTRA_BUILD_DIRS)
TEMPLATE_DIRS =
......@@ -171,7 +172,7 @@ install: library
cp -a $(shell ls $(ARB_LIBNAME)*) "$(DESTDIR)$(PREFIX)/$(LIBDIR)"; \
fi
$(AT)if [ "$(ARB_STATIC)" -eq "1" ]; then \
cp libarb.a $(DESTDIR)$(PREFIX)/lib; \
cp libarb.a $(DESTDIR)$(PREFIX)/$(LIBDIR); \
fi
cp $(HEADERS) $(DESTDIR)$(PREFIX)/include
$(AT)if [ ! -z $(EXT_HEADERS) ]; then \
......
......@@ -391,6 +391,13 @@ acb_get_rad_ubound_arf(arf_t u, const acb_t z, slong prec)
arf_mul_2exp_si(u, u, 1);
}
ACB_INLINE void
acb_union(acb_t res, const acb_t x, const acb_t y, slong prec)
{
arb_union(acb_realref(res), acb_realref(x), acb_realref(y), prec);
arb_union(acb_imagref(res), acb_imagref(x), acb_imagref(y), prec);
}
void acb_arg(arb_t r, const acb_t z, slong prec);
void acb_sgn(acb_t res, const acb_t z, slong prec);
......@@ -673,6 +680,7 @@ void acb_log1p(acb_t r, const acb_t z, slong prec);
void acb_exp(acb_t r, const acb_t z, slong prec);
void acb_exp_pi_i(acb_t r, const acb_t z, slong prec);
void acb_exp_invexp(acb_t r, acb_t s, const acb_t z, slong prec);
void acb_expm1(acb_t r, const acb_t z, slong prec);
void acb_sin(acb_t r, const acb_t z, slong prec);
void acb_cos(acb_t r, const acb_t z, slong prec);
......@@ -733,6 +741,7 @@ void acb_tan_pi(acb_t r, const acb_t z, slong prec);
void acb_cot_pi(acb_t r, const acb_t z, slong prec);
void acb_sinc(acb_t res, const acb_t z, slong prec);
void acb_sinc_pi(acb_t res, const acb_t z, slong prec);
void acb_pow_arb(acb_t z, const acb_t x, const arb_t y, slong prec);
void acb_pow(acb_t r, const acb_t x, const acb_t y, slong prec);
......@@ -782,6 +791,14 @@ void acb_polylog_si(acb_t w, slong s, const acb_t z, slong prec);
void acb_agm1(acb_t m, const acb_t z, slong prec);
void acb_agm1_cpx(acb_ptr m, const acb_t z, slong len, slong prec);
#define ACB_LAMBERTW_LEFT 2
#define ACB_LAMBERTW_MIDDLE 4
void acb_lambertw_asymp(acb_t res, const acb_t z, const fmpz_t k, slong L, slong M, slong prec);
int acb_lambertw_check_branch(const acb_t w, const fmpz_t k, slong prec);
void acb_lambertw_bound_deriv(mag_t res, const acb_t z, const acb_t ez1, const fmpz_t k);
void acb_lambertw(acb_t res, const acb_t z, const fmpz_t k, int flags, slong prec);
ACB_INLINE void
acb_sqr(acb_t res, const acb_t val, slong prec)
{
......
/*
Copyright (C) 2017 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.h"
void
acb_expm1(acb_t res, const acb_t z, slong prec)
{
if (acb_is_real(z))
{
arb_expm1(acb_realref(res), acb_realref(z), prec);
arb_zero(acb_imagref(res));
}
else if (arf_cmpabs_2exp_si(arb_midref(acb_realref(z)), -3) <= 0 &&
arf_cmpabs_2exp_si(arb_midref(acb_imagref(z)), -3) <= 0 &&
arf_cmpabs_2exp_si(arb_midref(acb_realref(z)), -3) <= 0 &&
arf_cmpabs_2exp_si(arb_midref(acb_imagref(z)), -3) <= 0)
{
arf_srcptr midmax;
slong extra;
if (arf_cmpabs(arb_midref(acb_realref(z)), arb_midref(acb_imagref(z))) >= 0)
midmax = arb_midref(acb_realref(z));
else
midmax = arb_midref(acb_imagref(z));
if (arf_cmpabs_2exp_si(arb_midref(acb_realref(z)), -prec - 100) > 0)
{
extra = -ARF_EXP(midmax);
extra = FLINT_MIN(extra, prec + 100);
extra = FLINT_MAX(extra, 0);
acb_exp(res, z, prec + extra + 4);
acb_sub_ui(res, res, 1, prec);
}
else
{
/* lazy solution: e^z-1 = 4 (sinh(z/4)+cosh(z/4))^2 sinh(z/4) cosh(z/4) */
acb_t t, u;
acb_init(t);
acb_init(u);
acb_mul_2exp_si(t, z, -2);
acb_sinh_cosh(t, u, t, prec + 4);
acb_add(res, t, u, prec + 4);
acb_mul(res, res, res, prec + 4);
acb_mul(t, t, u, prec + 4);
acb_mul(res, res, t, prec);
acb_mul_2exp_si(res, res, 2);
acb_clear(t);
acb_clear(u);
}
}
else
{
acb_exp(res, z, prec + 4);
acb_sub_ui(res, res, 1, prec);
}
}
This diff is collapsed.
/*
Copyright (C) 2017 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.h"
void
acb_lambertw_asymp(acb_t res, const acb_t z, const fmpz_t k, slong L, slong M, slong prec)
{
acb_t L1, L2, sigma, tau, s, c, u;
slong l, m;
fmpz_t t;
fmpz * sc;
/* For k = 0, the asymptotic expansion is not valid near 0. */
/* (It is sufficient to look at the midpoint as a test here.) */
if (fmpz_is_zero(k) && arf_cmpabs_2exp_si(arb_midref(acb_realref(z)), 0) < 0
&& arf_cmpabs_2exp_si(arb_midref(acb_imagref(z)), 0) < 0)
{
acb_indeterminate(res);
return;
}
acb_init(L1);
acb_init(L2);
acb_init(sigma);
acb_init(tau);
acb_init(s);
acb_init(c);
acb_init(u);
fmpz_init(t);
acb_const_pi(L2, prec);
acb_mul_2exp_si(L2, L2, 1);
acb_mul_fmpz(L2, L2, k, prec);
acb_mul_onei(L2, L2);
acb_log(L1, z, prec);
acb_add(L1, L1, L2, prec);
acb_log(L2, L1, prec);
acb_inv(sigma, L1, prec);
acb_mul(tau, L2, sigma, prec);
acb_zero(s);
/* Stirling numbers */
sc = _fmpz_vec_init(L);
acb_one(u);
for (m = 1; m < M; m++)
{
if (m == 1)
{
for (l = 0; l < L; l++)
fmpz_one(sc + l);
}
else
{
for (l = 0; l < L; l++)
{
fmpz_mul_ui(sc + l, sc + l, m + l - 1);
if (l > 0)
fmpz_add(sc + l, sc + l, sc + l - 1);
}
}
acb_zero(c);
/* todo: precompute powers instead of horner */
for (l = L - 1; l >= 0; l--)
{
acb_mul(c, c, sigma, prec);
if (l % 2)
acb_sub_fmpz(c, c, sc + l, prec);
else
acb_add_fmpz(c, c, sc + l, prec);
}
acb_mul(u, u, tau, prec);
acb_div_ui(u, u, m, prec);
acb_addmul(s, c, u, prec);
}
_fmpz_vec_clear(sc, L);
acb_sub(s, s, L2, prec);
acb_add(s, s, L1, prec);
{
mag_t m4s, m4t, one, q, r;
mag_init(m4s);
mag_init(m4t);
mag_init(one);
mag_init(q);
mag_init(r);
acb_get_mag(m4s, sigma);
mag_mul_2exp_si(m4s, m4s, 2);
acb_get_mag(m4t, tau);
mag_mul_2exp_si(m4t, m4t, 2);
mag_one(one);
mag_sub_lower(q, one, m4s);
mag_sub_lower(r, one, m4t);
mag_mul(q, q, r);
mag_pow_ui(r, m4s, L);
mag_mul(r, r, m4t);
mag_pow_ui(m4t, m4t, M);
mag_add(r, r, m4t);
mag_div(q, r, q);
acb_add_error_mag(s, q);
mag_clear(m4s);
mag_clear(m4t);
mag_clear(one);
mag_clear(q);
mag_clear(r);
}
acb_set(res, s);
acb_clear(sigma);
acb_clear(tau);
acb_clear(s);
acb_clear(c);
acb_clear(L1);
acb_clear(L2);
acb_clear(u);
fmpz_clear(t);
}
/*
Copyright (C) 2017 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.h"
void
acb_lambertw_bound_deriv(mag_t res, const acb_t z, const acb_t ez1, const fmpz_t k)
{
mag_t t, u, v;
mag_init(t);
mag_init(u);
mag_init(v);
if (fmpz_is_zero(k))
{
acb_get_mag(t, z);
/* |z| <= 64 */
if (mag_cmp_2exp_si(t, 6) < 0)
{
/* 2.25 / sqrt(|t|) / sqrt(1+|t|), t = |ez+1| */
acb_get_mag_lower(t, ez1);
mag_one(u);
mag_add_lower(u, u, t);
mag_mul_lower(t, t, u);
mag_rsqrt(t, t);
if (arb_is_positive(acb_realref(ez1)))
{
mag_mul_ui(t, t, 135); /* x0.9375 for small improvement */
mag_mul_2exp_si(t, t, -6);
}
else
{
mag_mul_ui(t, t, 9);