Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

complex_field.py complex_number.pyx -> complex_mpfr.pyx #24483

Closed
videlec opened this issue Jan 7, 2018 · 72 comments
Closed

complex_field.py complex_number.pyx -> complex_mpfr.pyx #24483

videlec opened this issue Jan 7, 2018 · 72 comments

Comments

@videlec
Copy link
Contributor

videlec commented Jan 7, 2018

In order to uniformize, simplify and in view of #17713 we merge the two files complex_field.py, complex_number.pyx into a unique complex_mpfr.pyx.

follow-up: #24489

CC: @mjungmath @fchapoton

Component: basic arithmetic

Author: Vincent Delecroix

Branch: 897416c

Reviewer: Michael Jung

Issue created by migration from https://trac.sagemath.org/ticket/24483

@videlec videlec added this to the sage-8.2 milestone Jan 7, 2018
@videlec
Copy link
Contributor Author

videlec commented Jan 7, 2018

Changed upstream from Not yet reported upstream; Will do shortly. to Reported upstream. No feedback yet.

@videlec

This comment has been minimized.

@videlec
Copy link
Contributor Author

videlec commented Jan 7, 2018

Commit: 31c7e67

@videlec
Copy link
Contributor Author

videlec commented Jan 7, 2018

comment:2

Let us see about doctests


New commits:

11724f724483: merge complex_number/complex_field into complex_mpfr
e314fbe24483: fix interpreters
808d0bd24483: fix imports
31c7e6724483: patch for pynac

@videlec
Copy link
Contributor Author

videlec commented Jan 7, 2018

Branch: u/vdelecroix/24483

@videlec
Copy link
Contributor Author

videlec commented Jan 7, 2018

Author: Vincent Delecroix

@videlec
Copy link
Contributor Author

videlec commented Jan 7, 2018

comment:3

patchbot not happy if Author is not given...

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jan 7, 2018

Changed commit from 31c7e67 to aaab91c

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jan 7, 2018

Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:

aaab91c24483: patch for pynac

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jan 8, 2018

Changed commit from aaab91c to f69c629

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jan 8, 2018

Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:

a439e6f24483: fix imports and doctests
f69c62924483: patch for pynac

@videlec

This comment has been minimized.

@videlec

This comment has been minimized.

@videlec

This comment has been minimized.

@jdemeyer
Copy link

jdemeyer commented Jan 8, 2018

comment:9

Can we just do the renaming without deprecation for now? That way, we wouldn't need the fix the Pynac. If possible, I would like to avoid Sage-specific patches to upstream projects.

@videlec
Copy link
Contributor Author

videlec commented Jan 8, 2018

comment:10

Replying to @jdemeyer:

Can we just do the renaming without deprecation for now? That way, we wouldn't need the fix the Pynac. If possible, I would like to avoid Sage-specific patches to upstream projects.

The whole point is precisely to start a deprecation... though for ease of review I can move the deprecation in another ticket. Would that be better?

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jan 8, 2018

Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:

6f2d6a224483: merge complex_number/complex_field into complex_mpfr
17092ed24483: fix interpreters
74b6eab24483: fix imports and doctests

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jan 8, 2018

Changed commit from f69c629 to 74b6eab

@videlec
Copy link
Contributor Author

videlec commented Jan 8, 2018

comment:12

All right. The import of ComplexField from sage.rings.complex_field is not deprecated anymore...

@videlec

This comment has been minimized.

@rwst
Copy link

rwst commented Jan 8, 2018

Changed upstream from Reported upstream. No feedback yet. to Fixed upstream, in a later stable release.

@rwst
Copy link

rwst commented Jan 9, 2018

Changed upstream from Fixed upstream, in a later stable release. to none

@rwst
Copy link

rwst commented Jan 9, 2018

Dependencies: #24497

@videlec
Copy link
Contributor Author

videlec commented Jan 9, 2018

comment:16

Great! Thanks Ralf. I will put back the deprecation.

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Oct 11, 2020

Changed commit from 26f2789 to 03ee540

@videlec
Copy link
Contributor Author

videlec commented Oct 11, 2020

comment:40

Replying to @mjungmath:

I can try. I just noticed minor things.

[...]

Thank you. I moved around the late_import. The remaining cache global variable is used in the function just after. It makes sense to keep it there as it is not used anywhere else in the code.

@mjungmath
Copy link

comment:41

The global variable LOG_TEN_TWO_PLUS_EPSILON can also be shifted to create_ComplexNumber since this is the only place where it is used.

Besides, this constant is already defined in sage.arith.constants, but with a slightly different value it seems. However, this value is imported in sage.rings.complex_interval and sage.rings.real_mpfi, i.e. everywhere else, but for the very same purpose. If it doesn't affect the code too much, one can import this value from there as well for the sake of unification.

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Oct 11, 2020

Changed commit from 03ee540 to 897416c

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Oct 11, 2020

Branch pushed to git repo; I updated commit sha1. New commits:

897416c24483: import LOG_TEN_TWO_PLUS_EPSILON from sage.arith.constants

@videlec
Copy link
Contributor Author

videlec commented Oct 11, 2020

comment:43

Replying to @mjungmath:

The global variable LOG_TEN_TWO_PLUS_EPSILON can also be shifted to create_ComplexNumber since this is the only place where it is used.

Besides, this constant is already defined in sage.arith.constants, but with a slightly different value it seems. However, this value is imported in sage.rings.complex_interval and sage.rings.real_mpfi, i.e. everywhere else, but for the very same purpose. If it doesn't affect the code too much, one can import this value from there as well for the sake of unification.

True. Fixed in the last commit.

@mjungmath
Copy link

comment:44

I think, this would be it from my side. When patchbot turns green, I can give a positive review.

@mjungmath
Copy link

comment:45

Replying to @videlec:

Got one doctest failure

sage -t src/sage/misc/citation.pyx
**********************************************************************
File "src/sage/misc/citation.pyx", line 87, in sage.misc.citation.get_systems
Failed example:
    get_systems('((a+1)^2).expand()')
Expected:
    ['MPFR', 'ginac']
Got:
    ['ginac']
**********************************************************************
1 item had failures:
   1 of  11 in sage.misc.citation.get_systems
    [13 tests, 1 failure, 1.75 s]

Is it worth to investigate why this (former) "spurious" output is gone now?

@videlec
Copy link
Contributor Author

videlec commented Oct 11, 2020

comment:46

This was a pretty bad doctest. It is removed in my commits

diff --git a/src/sage/misc/citation.pyx b/src/sage/misc/citation.pyx
index 2de53c1..847f357 100644
--- a/src/sage/misc/citation.pyx
+++ b/src/sage/misc/citation.pyx
@@ -40,7 +40,7 @@ systems['NTL'] = ['sage.libs.ntl',
 systems['FLINT'] = ['_flint']
 systems['GMP'] = ['sage.rings.integer.Integer']
 systems['MPFR'] = ['sage.rings.real_mpfr',
-                   'sage.rings.complex_number']
+                   'sage.rings.complex_mpfr']
 systems['MPFI'] = ['sage.rings.real_mpfi',
                    'sage.rings.complex_interval']
 systems['M4RI'] = ['sage.matrix.matrix_mod2_dense']
@@ -80,15 +80,6 @@ def get_systems(cmd):
         sage: I = R.ideal(x^2+y^2, z^2+y)
         sage: get_systems('I.primary_decomposition()')
         ['Singular']
-
-    Here we get a spurious ``MPFR`` because some coercions need to be
-    initialized. The second time it is gone::
-
-        sage: a = var('a')
-        sage: get_systems('((a+1)^2).expand()')
-        ['MPFR', 'ginac']
-        sage: get_systems('((a+1)^2).expand()')
-        ['ginac']
     """
     import cProfile, pstats, re

@mjungmath
Copy link

comment:47

Replying to @videlec:

This was a pretty bad doctest. It is removed in my commits

diff --git a/src/sage/misc/citation.pyx b/src/sage/misc/citation.pyx
index 2de53c1..847f357 100644
--- a/src/sage/misc/citation.pyx
+++ b/src/sage/misc/citation.pyx
@@ -40,7 +40,7 @@ systems['NTL'] = ['sage.libs.ntl',
 systems['FLINT'] = ['_flint']
 systems['GMP'] = ['sage.rings.integer.Integer']
 systems['MPFR'] = ['sage.rings.real_mpfr',
-                   'sage.rings.complex_number']
+                   'sage.rings.complex_mpfr']
 systems['MPFI'] = ['sage.rings.real_mpfi',
                    'sage.rings.complex_interval']
 systems['M4RI'] = ['sage.matrix.matrix_mod2_dense']
@@ -80,15 +80,6 @@ def get_systems(cmd):
         sage: I = R.ideal(x^2+y^2, z^2+y)
         sage: get_systems('I.primary_decomposition()')
         ['Singular']
-
-    Here we get a spurious ``MPFR`` because some coercions need to be
-    initialized. The second time it is gone::
-
-        sage: a = var('a')
-        sage: get_systems('((a+1)^2).expand()')
-        ['MPFR', 'ginac']
-        sage: get_systems('((a+1)^2).expand()')
-        ['ginac']
     """
     import cProfile, pstats, re

Thanks. Removing the test seems sensible. However, I just ask myself why this ticket has that effect. Perhaps it is worth to investigate it?

@videlec
Copy link
Contributor Author

videlec commented Oct 11, 2020

comment:48

It might be complicated to track down precisely... with no reward as far as I can see.

@mjungmath
Copy link

comment:49

Patchbot morally green. LGTM.

@videlec
Copy link
Contributor Author

videlec commented Oct 11, 2020

comment:50

Thank you!

@mjungmath
Copy link

Reviewer: Michael Jung

@vbraun
Copy link
Member

vbraun commented Oct 31, 2020

Changed branch from u/vdelecroix/24483 to 897416c

@mezzarobba
Copy link
Member

comment:53

Hi Vincent,

What would you think of keeping files complex_field.py and complex_number.pyx that import * from the new location for a while, in the interest of backward compatibility?

@mezzarobba
Copy link
Member

Changed commit from 897416c to none

@videlec
Copy link
Contributor Author

videlec commented Nov 2, 2020

comment:54

Definitely (with deprecated lazy imports)!

@videlec
Copy link
Contributor Author

videlec commented Nov 2, 2020

comment:55

Could you open a ticket?

@mezzarobba
Copy link
Member

comment:56

#30857

mkoeppe added a commit to mkoeppe/sage that referenced this issue Sep 21, 2023
mkoeppe added a commit to mkoeppe/sage that referenced this issue Sep 21, 2023
vbraun pushed a commit to vbraun/sage that referenced this issue Sep 23, 2023
, sagemath#24483, sagemath#24371, sagemath#24511, sagemath#25848, sagemath#26105, sagemath#28481, sagemath#29010, sagemath#29412, sagemath#30332, sagemath#30372, sagemath#31345, sagemath#32375, sagemath#32606, sagemath#32610, sagemath#32612, sagemath#32641, sagemath#32660, sagemath#32750, sagemath#32869, sagemath#33602

    
<!-- ^^^^^
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 sagemath#1234" use "Introduce new method to
calculate 1+1"
-->
<!-- Describe your changes here in detail -->

<!-- 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 sagemath#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.
- [ ] The description explains in detail what this PR is about.
- [x] 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
- sagemath#12345: short description why this is a dependency
- sagemath#34567: ...
-->

<!-- If you're unsure about any of these, don't hesitate to ask. We're
here to help! -->
    
URL: sagemath#36307
Reported by: Matthias Köppe
Reviewer(s):
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants