Skip to content

Commit

Permalink
gh-36053: cython-lint : add note about unused imports
Browse files Browse the repository at this point in the history
    
<!-- ^^^^^
Please provide a concise, informative and self-explanatory title.
Don't put issue numbers in there, do this in the PR body below.
For example, instead of "Fixes #1234" use "Introduce new method to
calculate 1+1"
-->
<!-- Describe your changes here in detail -->

removing some unused imports, following suggestions of cython-lint

<!-- Why is this change required? What problem does it solve? -->
<!-- If this PR resolves an open issue, please link to it here. For
example "Fixes #12345". -->
<!-- If your change requires a documentation PR, please link it
appropriately. -->

### 📝 Checklist

<!-- Put an `x` in all the boxes that apply. -->
<!-- If your change requires a documentation PR, please link it
appropriately -->
<!-- If you're unsure about any of these, don't hesitate to ask. We're
here to help! -->
<!-- Feel free to remove irrelevant items. -->

- [x] The title is concise, informative, and self-explanatory.
- [x] The description explains in detail what this PR is about.
- [ ] I have linked a relevant issue or discussion.
- [ ] I have created tests covering the changes.
- [ ] I have updated the documentation accordingly.

### ⌛ Dependencies

<!-- List all open PRs that this PR logically depends on
- #12345: short description why this is a dependency
- #34567: ...
-->

<!-- If you're unsure about any of these, don't hesitate to ask. We're
here to help! -->
    
URL: #36053
Reported by: Frédéric Chapoton
Reviewer(s): Frédéric Chapoton, Matthias Köppe
  • Loading branch information
Release Manager committed Aug 26, 2023
2 parents 6e19d23 + 193e644 commit e678d52
Showing 1 changed file with 21 additions and 13 deletions.
34 changes: 21 additions & 13 deletions src/sage/libs/mpmath/ext_libmp.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ Faster versions of some key functions in mpmath.libmp
from .ext_impl cimport *
from sage.libs.gmp.all cimport *

# the next line is used by mpmath
from .ext_impl import exp_fixed, cos_sin_fixed, log_int_fixed

# Note: not thread-safe
Expand All @@ -12,6 +13,7 @@ cdef MPF tmp2
MPF_init(&tmp1)
MPF_init(&tmp2)


def mpf_add(tuple x, tuple y, int prec=0, str rnd='d'):
cdef MPopts opts
MPF_set_tuple(&tmp1, x)
Expand All @@ -21,6 +23,7 @@ def mpf_add(tuple x, tuple y, int prec=0, str rnd='d'):
MPF_add(&tmp1, &tmp1, &tmp2, opts)
return MPF_to_tuple(&tmp1)


def mpf_sub(tuple x, tuple y, int prec=0, str rnd='d'):
cdef MPopts opts
MPF_set_tuple(&tmp1, x)
Expand All @@ -30,6 +33,7 @@ def mpf_sub(tuple x, tuple y, int prec=0, str rnd='d'):
MPF_sub(&tmp1, &tmp1, &tmp2, opts)
return MPF_to_tuple(&tmp1)


def mpf_mul(tuple x, tuple y, int prec=0, str rnd='d'):
cdef MPopts opts
MPF_set_tuple(&tmp1, x)
Expand All @@ -39,6 +43,7 @@ def mpf_mul(tuple x, tuple y, int prec=0, str rnd='d'):
MPF_mul(&tmp1, &tmp1, &tmp2, opts)
return MPF_to_tuple(&tmp1)


def mpf_div(tuple x, tuple y, int prec, str rnd='d'):
cdef MPopts opts
MPF_set_tuple(&tmp1, x)
Expand All @@ -48,9 +53,10 @@ def mpf_div(tuple x, tuple y, int prec, str rnd='d'):
MPF_div(&tmp1, &tmp1, &tmp2, opts)
return MPF_to_tuple(&tmp1)


def mpf_sqrt(tuple x, int prec, str rnd='d'):
"""
Computes sqrt(x) with mpf value tuples.
Compute sqrt(x) with mpf value tuples.
EXAMPLES::
Expand All @@ -59,7 +65,6 @@ def mpf_sqrt(tuple x, int prec, str rnd='d'):
sage: y = mpf_sqrt(x, 53, 'n')
sage: to_float(y)
1.4142135623730951
"""
if x[0]:
import mpmath.libmp as libmp
Expand All @@ -71,9 +76,10 @@ def mpf_sqrt(tuple x, int prec, str rnd='d'):
MPF_sqrt(&tmp1, &tmp1, opts)
return MPF_to_tuple(&tmp1)


def mpf_log(tuple x, int prec, str rnd='d'):
"""
Computes log(x) with mpf value tuples.
Compute log(x) with mpf value tuples.
EXAMPLES::
Expand All @@ -82,7 +88,6 @@ def mpf_log(tuple x, int prec, str rnd='d'):
sage: y = mpf_log(x, 53, 'n')
sage: to_float(y)
0.6931471805599453
"""
if x[0]:
import mpmath.libmp as libmp
Expand All @@ -94,9 +99,10 @@ def mpf_log(tuple x, int prec, str rnd='d'):
MPF_log(&tmp1, &tmp1, opts)
return MPF_to_tuple(&tmp1)


def mpf_exp(tuple x, int prec, str rnd='d'):
"""
Computes exp(x) with mpf value tuples.
Compute exp(x) with mpf value tuples.
EXAMPLES::
Expand All @@ -105,7 +111,6 @@ def mpf_exp(tuple x, int prec, str rnd='d'):
sage: z = mpf_exp(x, 53, 'n')
sage: to_float(z)
7.38905609893065
"""
cdef MPopts opts
MPF_set_tuple(&tmp1, x)
Expand All @@ -114,9 +119,10 @@ def mpf_exp(tuple x, int prec, str rnd='d'):
MPF_exp(&tmp1, &tmp1, opts)
return MPF_to_tuple(&tmp1)


def mpf_cos(tuple x, int prec, str rnd='d'):
"""
Computes cos(x) with mpf value tuples.
Compute cos(x) with mpf value tuples.
EXAMPLES::
Expand All @@ -125,7 +131,6 @@ def mpf_cos(tuple x, int prec, str rnd='d'):
sage: y = mpf_cos(x, 53, 'n')
sage: to_float(y)
0.5403023058681398
"""
cdef MPopts opts
MPF_set_tuple(&tmp1, x)
Expand All @@ -134,9 +139,10 @@ def mpf_cos(tuple x, int prec, str rnd='d'):
MPF_cos(&tmp1, &tmp1, opts)
return MPF_to_tuple(&tmp1)


def mpf_sin(tuple x, int prec, str rnd='d'):
"""
Computes sin(x) with mpf value tuples.
Compute sin(x) with mpf value tuples.
EXAMPLES::
Expand All @@ -145,7 +151,6 @@ def mpf_sin(tuple x, int prec, str rnd='d'):
sage: y = mpf_sin(x, 53, 'n')
sage: to_float(y)
0.8414709848078965
"""
cdef MPopts opts
MPF_set_tuple(&tmp1, x)
Expand All @@ -154,9 +159,10 @@ def mpf_sin(tuple x, int prec, str rnd='d'):
MPF_sin(&tmp1, &tmp1, opts)
return MPF_to_tuple(&tmp1)


def mpc_sqrt(tuple z, int prec, str rnd='d'):
"""
Computes sqrt(z) with mpc value tuples.
Compute sqrt(z) with mpc value tuples.
EXAMPLES::
Expand All @@ -176,9 +182,10 @@ def mpc_sqrt(tuple z, int prec, str rnd='d'):
MPF_complex_sqrt(&tmp1, &tmp2, &tmp1, &tmp2, opts)
return MPF_to_tuple(&tmp1), MPF_to_tuple(&tmp2)


def mpc_exp(tuple z, int prec, str rnd='d'):
"""
Computes exp(z) with mpc value tuples.
Compute exp(z) with mpc value tuples.
EXAMPLES::
Expand All @@ -198,9 +205,10 @@ def mpc_exp(tuple z, int prec, str rnd='d'):
MPF_complex_exp(&tmp1, &tmp2, &tmp1, &tmp2, opts)
return MPF_to_tuple(&tmp1), MPF_to_tuple(&tmp2)


def mpf_pow(tuple x, tuple y, int prec, str rnd='d'):
"""
Computes x ^ y with mpf value tuples.
Compute x ^ y with mpf value tuples.
EXAMPLES::
Expand Down

0 comments on commit e678d52

Please sign in to comment.