Ticket #11334: trac_11334-suppressdivide.patch

File trac_11334-suppressdivide.patch, 1.3 KB (added by fbissey, 7 years ago)

suppress divide warnings in riemann.pyx

  • sage/calculus/riemann.pyx

    # HG changeset patch
    # User Francois Bissey <francois.bissey@canterbury.ac.nz>
    # Date 1365112687 -46800
    # Node ID f6e101eff48b8342f838c4f886543edc7812fa0e
    # Parent  aa1ed8fd83e0ad4cfad16c339843aaafba4a9991
    trac 11334: suppressing divide warning in riemann.pyx
    
    diff --git a/sage/calculus/riemann.pyx b/sage/calculus/riemann.pyx
    a b  
    250250        g = -sadp * hconj
    251251        normalized_dp=dp/adp
    252252        C = I / N * sadp # equivalent to -TWOPI / N * 1 / (TWOPI * I) * sadp
    253         olderr = np.geterr()['invalid'] # checks the current error handling
    254         np.seterr(invalid='ignore')
     253        errinvalid = np.geterr()['invalid'] # checks the current error handling for invalid
     254        errdivide = np.geterr()['divide'] # checks the current error handling for divide
     255        np.seterr(divide='ignore',invalid='ignore')
    255256        K = np.array(
    256257            [C * sadp[t] *
    257258             (normalized_dp/(cp-cp[t]) - (normalized_dp[t]/(cp-cp[t])).conjugate())
    258259              for t in np.arange(NB)], dtype=np.complex128)
    259         np.seterr(invalid=olderr) # resets the error handling
     260        np.seterr(divide=errdivide,invalid=errinvalid) # resets the error handling
    260261        for i in xrange(NB):
    261262            K[i, i] = 1
    262263        phi = np.linalg.solve(K, g) / NB * TWOPI  # Nystrom