From c74ddfc98c536dfe690c6692a729647cd7def7e0 Mon Sep 17 00:00:00 2001 From: Fredrik Johansson Date: Wed, 27 Feb 2013 18:31:04 +0100 Subject: [PATCH] remove/rename obsolete code --- doc/source/fmpcb.rst | 5 +- fmpcb.h | 4 +- fmpcb/rfac_ui_bsplit.c | 154 ----------------------------------------- fmpcb/rising_ui.c | 34 +++++++++ 4 files changed, 38 insertions(+), 159 deletions(-) delete mode 100644 fmpcb/rfac_ui_bsplit.c create mode 100644 fmpcb/rising_ui.c diff --git a/doc/source/fmpcb.rst b/doc/source/fmpcb.rst index 218e5b3c..65d8052a 100644 --- a/doc/source/fmpcb.rst +++ b/doc/source/fmpcb.rst @@ -344,10 +344,9 @@ Elementary functions Special functions ------------------------------------------------------------------------------- -.. function:: void fmpcb_rfac_ui_bsplit(fmpcb_t y, const fmpcb_t x, ulong n, long prec) +void fmpcb_rising_ui(fmpcb_t y, const fmpcb_t x, ulong n, long prec) - Sets *x* to the rising factorial `x (x+1) (x+2) \cdots (x+n-1)`, - computed using binary splitting. + Sets *y* to the rising factorial `x (x+1) (x+2) \cdots (x+n-1)`. .. function:: void fmpcb_gamma(fmpcb_t y, const fmpcb_t x, long prec) diff --git a/fmpcb.h b/fmpcb.h index dd08191a..d4de45c3 100644 --- a/fmpcb.h +++ b/fmpcb.h @@ -534,8 +534,6 @@ void fmpcb_sin_pi(fmpcb_t r, const fmpcb_t z, long prec); void fmpcb_pow(fmpcb_t r, const fmpcb_t x, const fmpcb_t y, long prec); -void fmpcb_rfac_ui_bsplit(fmpcb_t y, const fmpcb_t x, ulong n, long prec); - void fmpcb_invroot_newton(fmpcb_t r, const fmpcb_t a, ulong m, const fmpcb_t r0, long startprec, long prec); void fmpcb_root_exp(fmpcb_t r, const fmpcb_t a, long m, long index, long prec); void fmpcb_root_newton(fmpcb_t r, const fmpcb_t a, long m, long index, long prec); @@ -545,6 +543,8 @@ void fmpcb_gamma(fmpcb_t y, const fmpcb_t x, long prec); void fmpcb_rgamma(fmpcb_t y, const fmpcb_t x, long prec); void fmpcb_lgamma(fmpcb_t y, const fmpcb_t x, long prec); +void fmpcb_rising_ui(fmpcb_t y, const fmpcb_t x, ulong n, long prec); + void fmpcb_zeta_series_em_sum(fmpcb_struct * z, const fmpcb_t s, const fmpcb_t a, int deflate, ulong N, ulong M, long d, long prec); void fmpcb_zeta_series_em_choose_param(fmpr_t bound, ulong * N, ulong * M, const fmpcb_t s, const fmpcb_t a, long d, long target, long prec); void fmpcb_zeta_series_em_bound(fmpr_t bound, const fmpcb_t s, const fmpcb_t a, long N, long M, long d, long wp); diff --git a/fmpcb/rfac_ui_bsplit.c b/fmpcb/rfac_ui_bsplit.c deleted file mode 100644 index 4c05eeb9..00000000 --- a/fmpcb/rfac_ui_bsplit.c +++ /dev/null @@ -1,154 +0,0 @@ -/*============================================================================= - - This file is part of ARB. - - ARB is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - ARB is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with ARB; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -=============================================================================*/ -/****************************************************************************** - - Copyright (C) 2012, 2013 Fredrik Johansson - -******************************************************************************/ - -#include "fmpcb.h" - -/* x(x+1)...(x+7) = (28 + 98x + 63x^2 + 14x^3 + x^4)^2 - 16 (7+2x)^2 */ -static void -rfac_eight(fmpcb_t t, const fmpcb_t x, long prec) -{ - if (prec < 768) - { - fmpcb_t u; - long i; - - fmpcb_init(u); - - fmpcb_add_ui(u, x, 1, prec); - fmpcb_mul(t, x, u, prec); - - for (i = 2; i < 8; i++) - { - fmpcb_add_ui(u, u, 1, prec); - fmpcb_mul(t, t, u, prec); - } - - fmpcb_clear(u); - } - else - { - fmpcb_t u, v; - - fmpcb_init(u); - fmpcb_init(v); - - /* t = x^2, v = x^3, u = x^4 */ - fmpcb_mul(t, x, x, prec); - fmpcb_mul(v, x, t, prec); - fmpcb_mul(u, t, t, prec); - - /* u = (28 + ...)^2 */ - fmpcb_addmul_ui(u, v, 14UL, prec); - fmpcb_addmul_ui(u, t, 63UL, prec); - fmpcb_addmul_ui(u, x, 98UL, prec); - fmpcb_add_ui(u, u, 28UL, prec); - fmpcb_mul(u, u, u, prec); - - /* 16 (7+2x)^2 = 784 + 448x + 64x^2 */ - fmpcb_sub_ui(u, u, 784UL, prec); - fmpcb_submul_ui(u, x, 448UL, prec); - fmpcb_mul_2exp_si(t, t, 6); - fmpcb_sub(t, u, t, prec); - - fmpcb_clear(u); - fmpcb_clear(v); - } -} - -/* assumes that the length is a multiple of 8 */ -static void -bsplit_eight(fmpcb_t y, const fmpcb_t x, - ulong a, ulong b, long prec) -{ - if (b - a == 8) - { - fmpcb_t t; - fmpcb_init(t); - fmpcb_add_ui(t, x, a, prec); - rfac_eight(y, t, prec); - fmpcb_clear(t); - } - else - { - ulong m = a + ((b - a) / 16) * 8; - - fmpcb_t L, R; - - fmpcb_init(L); - fmpcb_init(R); - - bsplit_eight(L, x, a, m, prec); - bsplit_eight(R, x, m, b, prec); - fmpcb_mul(y, L, R, prec); - - fmpcb_clear(L); - fmpcb_clear(R); - } -} - -void -fmpcb_rfac_ui_bsplit(fmpcb_t y, const fmpcb_t x, ulong n, long prec) -{ - if (n == 0) - { - fmpcb_one(y); - } - else if (n == 1) - { - fmpcb_set(y, x); - } - else - { - long k, a, wp; - fmpcb_t t, u; - - wp = FMPR_PREC_ADD(prec, FLINT_BIT_COUNT(n)); - - fmpcb_init(t); - fmpcb_init(u); - - if (n >= 8) - { - bsplit_eight(t, x, 0, (n / 8) * 8, wp); - a = (n / 8) * 8; - } - else - { - fmpcb_set(t, x); - a = 1; - } - - for (k = a; k < n; k++) - { - fmpcb_add_ui(u, x, k, wp); - fmpcb_mul(t, t, u, wp); - } - - fmpcb_set(y, t); - - fmpcb_clear(t); - fmpcb_clear(u); - } -} diff --git a/fmpcb/rising_ui.c b/fmpcb/rising_ui.c new file mode 100644 index 00000000..6b42e14f --- /dev/null +++ b/fmpcb/rising_ui.c @@ -0,0 +1,34 @@ +/*============================================================================= + + This file is part of ARB. + + ARB is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + ARB is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with ARB; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +=============================================================================*/ +/****************************************************************************** + + Copyright (C) 2012, 2013 Fredrik Johansson + +******************************************************************************/ + +#include "fmpcb.h" +#include "gamma.h" + +void +fmpcb_rising_ui(fmpcb_t y, const fmpcb_t x, ulong n, long prec) +{ + gamma_rising_fmpcb_ui_bsplit(y, x, n, prec); +} +