## "Fossies" - the Fresh Open Source Software Archive

### Source code changes of the file "mpmath/libmp/gammazeta.py" betweenmpmath-0.19.tar.gz and mpmath-1.0.0.tar.gz

About: mpmath is a Python library for arbitrary-precision floating-point arithmetic.

gammazeta.py  (mpmath-0.19):gammazeta.py  (mpmath-1.0.0)
skipping to change at line 17 skipping to change at line 17
* The gamma function * The gamma function
* Polygamma functions * Polygamma functions
* Harmonic numbers * Harmonic numbers
* The Riemann zeta function * The Riemann zeta function
* Constants related to these functions * Constants related to these functions
----------------------------------------------------------------------- -----------------------------------------------------------------------
""" """
import math import math
import sys
from .backend import xrange from .backend import xrange
from .backend import MPZ, MPZ_ZERO, MPZ_ONE, MPZ_THREE, gmpy from .backend import MPZ, MPZ_ZERO, MPZ_ONE, MPZ_THREE, gmpy
from .libintmath import list_primes, ifac, ifac2, moebius from .libintmath import list_primes, ifac, ifac2, moebius
from .libmpf import (\ from .libmpf import (\
round_floor, round_ceiling, round_down, round_up, round_floor, round_ceiling, round_down, round_up,
round_nearest, round_fast, round_nearest, round_fast,
lshift, sqrt_fixed, isqrt_fast, lshift, sqrt_fixed, isqrt_fast,
skipping to change at line 1463 skipping to change at line 1464
# Set to something large to disable # Set to something large to disable
ZETASUM_SIEVE_CUTOFF = 10 ZETASUM_SIEVE_CUTOFF = 10
def mpc_zetasum(s, a, n, derivatives, reflect, prec): def mpc_zetasum(s, a, n, derivatives, reflect, prec):
""" """
Fast version of mp._zetasum, assuming s = complex, a = integer. Fast version of mp._zetasum, assuming s = complex, a = integer.
""" """
wp = prec + 10 wp = prec + 10
derivatives = list(derivatives)
have_derivatives = derivatives != [0] have_derivatives = derivatives != [0]
have_one_derivative = len(derivatives) == 1 have_one_derivative = len(derivatives) == 1
# parse s # parse s
sre, sim = s sre, sim = s
critical_line = (sre == fhalf) critical_line = (sre == fhalf)
sre = to_fixed(sre, wp) sre = to_fixed(sre, wp)
sim = to_fixed(sim, wp) sim = to_fixed(sim, wp)
if a > 0 and n > ZETASUM_SIEVE_CUTOFF and not have_derivatives and not if a > 0 and n > ZETASUM_SIEVE_CUTOFF and not have_derivatives \
and not reflect and (n < 4e7 or sys.maxsize > 2**32):
re, im = zetasum_sieved(critical_line, sre, sim, a, n, wp) re, im = zetasum_sieved(critical_line, sre, sim, a, n, wp)
xs = [(from_man_exp(re, -wp, prec, 'n'), from_man_exp(im, -wp, prec, 'n' ))] xs = [(from_man_exp(re, -wp, prec, 'n'), from_man_exp(im, -wp, prec, 'n' ))]
return xs, [] return xs, []
maxd = max(derivatives) maxd = max(derivatives)
if not have_one_derivative: if not have_one_derivative:
derivatives = range(maxd+1) derivatives = range(maxd+1)
# x_d = 0, y_d = 0 # x_d = 0, y_d = 0
xre = [MPZ_ZERO for d in derivatives] xre = [MPZ_ZERO for d in derivatives]
End of changes. 3 change blocks.
2 lines changed or deleted 4 lines changed or added