-
-
Notifications
You must be signed in to change notification settings - Fork 512
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
using numpy 2.0 #38242
Comments
here is one more numpy 2.0 issue to be fixed, in
|
the following allows docs to build --- a/src/sage/plot/complex_plot.pyx
+++ b/src/sage/plot/complex_plot.pyx
@@ -1290,7 +1290,7 @@ def rgb_to_hls(rgb):
l = (rgb_max + rgb_min)/2.0 # lightness
hls = np.zeros_like(rgb)
- delta = rgb.ptp(-1)
+ delta = np.ptp(rgb, -1)
s = np.zeros_like(delta)
ipos = delta > 0 there are many doctest errors related to the new default display format for numpy numbers; --- a/src/doc/en/thematic_tutorials/numerical_sage/numpy.rst
+++ b/src/doc/en/thematic_tutorials/numerical_sage/numpy.rst
@@ -7,6 +7,8 @@ import it.
::
sage: import numpy
+ sage: if int(numpy.version.short_version[0]) > 1:
+ ....: numpy.set_printoptions(legacy="1.25") # to ensure numpy 2.0 compatibility
The basic object of computation in NumPy is an array. It is simple to
create an array. --- a/src/sage/calculus/interpolators.pyx
+++ b/src/sage/calculus/interpolators.pyx
@@ -27,6 +27,9 @@ Development supported by NSF award No. 0702939.
import numpy as np
cimport numpy as np
+if int(np.version.short_version[0]) > 1:
+ np.set_printoptions(legacy="1.25")
+
from math import pi
cdef double TWOPI = 2*pi
diff --git a/src/sage/calculus/riemann.pyx b/src/sage/calculus/riemann.pyx
index 6ec80d89aa7..c09d93c4260 100644
--- a/src/sage/calculus/riemann.pyx
+++ b/src/sage/calculus/riemann.pyx
@@ -44,6 +44,9 @@ from sage.calculus.integration import numerical_integral
import numpy as np
cimport numpy as np
+if int(np.version.short_version[0]) > 1:
+ np.set_printoptions(legacy="1.25")
+
from math import pi
from math import sin
from math import cos |
This will fix sagemath#38242 Basically, most of the problems are with numpy switching to a different way to display its data, showing type. We either use a compatibility version, or add ellipses in doctests. ### 📝 Checklist <!-- Put an `x` in all the boxes that apply. --> - [x ] The title is concise and informative. - [x ] The description explains in detail what this PR is about. - [x ] I have linked a relevant issue or discussion. - [x ] I have created tests covering the changes. - [ ] I have updated the documentation and checked the documentation preview. ### ⌛ Dependencies <!-- List all open PRs that this PR logically depends on. For example, --> <!-- - sagemath#12345: short description why this is a dependency --> <!-- - sagemath#34567: ... --> URL: sagemath#38250 Reported by: Dima Pasechnik Reviewer(s):
Problem Description
it's released, and used by scipy
Proposed Solution
various things to be done. The 1st is due to flint headers, which use
I
in function declarations, and if you includecomplex.h
, you get problems. Fix is easy, and proposed in flintlib/flint#2027There are also deprecations to be dealt with, e.g.
Alternatives Considered
n/a
Additional Information
No response
Is there an existing issue for this?
The text was updated successfully, but these errors were encountered: