-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Also: - rebuild for boost update in sync with brial (same PR) - fixes for numpy 1.24 (already updated) - fixes to support updating giac to 1.9.0.37 - fixes to support updating tachyon 0.99.5 - fix an edge case of python 3.11 integer conversion on 32 bit
- Loading branch information
Showing
6 changed files
with
257 additions
and
1 deletion.
There are no files selected for viewing
75 changes: 75 additions & 0 deletions
75
.../patches/trac-23712-support_tachyon_0.99.2-55c04623a4b7404f5e4f9d152366d53e9c21cfa6.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
From 55c04623a4b7404f5e4f9d152366d53e9c21cfa6 Mon Sep 17 00:00:00 2001 | ||
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy> | ||
Date: Wed, 21 Dec 2022 19:43:02 -0300 | ||
Subject: Trac #23712: support tachyon >= 0.99.2 | ||
|
||
In tachyon 0.99.2 the keyword `focallength` was changed to `focaldist`. | ||
To support it, when running on version >= 0.99.2 we "patch" the model as | ||
constructed by class `sage.plot.plot3d.tachyon.Tachyon`. | ||
|
||
In the future (possibly when tachyon in sage gets upgraded), all the | ||
focallength occurences in sage.plot.plot3d.tachyon can be replaced by | ||
focaldist for consistency with new tachyon, and the logic here can be | ||
reversed (i.e. patch the model when self.version() < '0.99.2') or just | ||
drop support for old versions. | ||
--- | ||
src/sage/interfaces/tachyon.py | 23 +++++++++++++++++++++++ | ||
1 file changed, 23 insertions(+) | ||
|
||
diff --git a/src/sage/interfaces/tachyon.py b/src/sage/interfaces/tachyon.py | ||
index 23671e5..21cc1db 100644 | ||
--- a/src/sage/interfaces/tachyon.py | ||
+++ b/src/sage/interfaces/tachyon.py | ||
@@ -683,12 +683,14 @@ properly. | ||
#***************************************************************************** | ||
|
||
import os | ||
+import re | ||
|
||
from sage.cpython.string import bytes_to_str | ||
from sage.misc.pager import pager | ||
from sage.misc.superseded import deprecation | ||
from sage.misc.temporary_file import tmp_filename | ||
from sage.structure.sage_object import SageObject | ||
+from sage.misc.cachefunc import cached_method | ||
|
||
|
||
class TachyonRT(SageObject): | ||
@@ -799,6 +801,11 @@ class TachyonRT(SageObject): | ||
Parser failed due to an input file syntax error. | ||
Aborting render. | ||
""" | ||
+ if self.version() >= '0.99.2': | ||
+ # this keyword was changed in 0.99.2 | ||
+ model = model.replace( | ||
+ " focallength ", | ||
+ " focaldist ") | ||
modelfile = tmp_filename(ext='.dat') | ||
with open(modelfile, 'w') as file: | ||
file.write(model) | ||
@@ -851,6 +858,22 @@ class TachyonRT(SageObject): | ||
else: | ||
print(r) | ||
|
||
+ @cached_method | ||
+ def version(self): | ||
+ """ | ||
+ Returns the version of the Tachyon raytracer being used. | ||
+ | ||
+ TESTS:: | ||
+ | ||
+ sage: tachyon_rt.version() # not tested | ||
+ 0.98.9 | ||
+ sage: tachyon_rt.version() >= '0.98.9' | ||
+ True | ||
+ """ | ||
+ with os.popen('tachyon') as f: | ||
+ r = f.read() | ||
+ return re.search(r"Version ([\d.]*)", r)[1] | ||
+ | ||
def help(self, use_pager=True): | ||
""" | ||
Deprecated: type 'sage.interfaces.tachyon?' for help | ||
-- | ||
cgit v1.0-1-gd88e | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
commit 1f22dea27235eeb7dd74cab2cee60cffa55fff2a | ||
Author: Gonzalo Tornaría <tornaria@cmat.edu.uy> | ||
Date: Wed Jan 4 22:16:32 2023 -0300 | ||
|
||
complex_plot: fix plot of undefined values | ||
|
||
Undefined values would get some random color. | ||
Rreplace all undefined values by white. | ||
|
||
In numpy 1.24 this avoids a runtime warning (cast of nan to uint8). | ||
|
||
diff --git a/src/sage/plot/complex_plot.pyx b/src/sage/plot/complex_plot.pyx | ||
index 6f0aeab87ae..b77c69b2f77 100644 | ||
--- a/src/sage/plot/complex_plot.pyx | ||
+++ b/src/sage/plot/complex_plot.pyx | ||
@@ -461,6 +461,8 @@ def complex_to_rgb(z_values, contoured=False, tiled=False, | ||
rgb[i, j, 2] = b | ||
|
||
sig_off() | ||
+ nan_indices = np.isnan(rgb).any(-1) # Mask for undefined points | ||
+ rgb[nan_indices] = 1 # Make nan_indices white | ||
return rgb | ||
|
||
|
||
|
||
commit c57458d245f9e24c0283d72d5b97ace0ff011fd6 | ||
Author: Gonzalo Tornaría <tornaria@cmat.edu.uy> | ||
Date: Wed Jan 4 20:25:15 2023 -0300 | ||
|
||
doctest: fixes for numpy 1.24 | ||
|
||
diff --git a/src/sage/misc/persist.pyx b/src/sage/misc/persist.pyx | ||
index 3ac5f1cc2b0..cb1f327c199 100644 | ||
--- a/src/sage/misc/persist.pyx | ||
+++ b/src/sage/misc/persist.pyx | ||
@@ -157,7 +157,7 @@ def load(*filename, compress=True, verbose=True, **kwargs): | ||
....: _ = f.write(code) | ||
sage: load(t) | ||
sage: hello | ||
- <fortran object> | ||
+ <fortran ...> | ||
""" | ||
import sage.repl.load | ||
if len(filename) != 1: | ||
diff --git a/src/sage/plot/histogram.py b/src/sage/plot/histogram.py | ||
index 3bc2b76b58e..388c2d1391d 100644 | ||
--- a/src/sage/plot/histogram.py | ||
+++ b/src/sage/plot/histogram.py | ||
@@ -87,13 +87,8 @@ class Histogram(GraphicPrimitive): | ||
|
||
TESTS:: | ||
|
||
- sage: h = histogram([10,3,5], normed=True)[0] | ||
- doctest:warning...: | ||
- DeprecationWarning: the 'normed' option is deprecated. Use 'density' instead. | ||
- See https://trac.sagemath.org/25260 for details. | ||
+ sage: h = histogram([10,3,5], density=True)[0] | ||
sage: h.get_minmax_data() | ||
- doctest:warning ... | ||
- ...VisibleDeprecationWarning: Passing `normed=True` on non-uniform bins has always been broken, and computes neither the probability density function nor the probability mass function. The result is only correct if the bins are uniform, when density=True will produce the same result anyway. The argument will be removed in a future version of numpy. | ||
{'xmax': 10.0, 'xmin': 3.0, 'ymax': 0.476190476190..., 'ymin': 0} | ||
""" | ||
import numpy | ||
diff --git a/src/sage/repl/ipython_extension.py b/src/sage/repl/ipython_extension.py | ||
index 798671aab42..cad6a47ca8b 100644 | ||
--- a/src/sage/repl/ipython_extension.py | ||
+++ b/src/sage/repl/ipython_extension.py | ||
@@ -405,7 +405,7 @@ class SageMagics(Magics): | ||
....: C END FILE FIB1.F | ||
....: ''') | ||
sage: fib | ||
- <fortran object> | ||
+ <fortran ...> | ||
sage: from numpy import array | ||
sage: a = array(range(10), dtype=float) | ||
sage: fib(a, 10) |
65 changes: 65 additions & 0 deletions
65
...es/trac-34926-fix_tests_with_giac_1.9.0.35-3c98c3c9be2ca04e799fa6baf4ad09f21ed6eb91.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
From f28961e88271c6685f9d7e4697f36affe3bbe65c Mon Sep 17 00:00:00 2001 | ||
From: Antonio Rojas <arojas@archlinux.org> | ||
Date: Fri, 20 Jan 2023 21:36:27 +0100 | ||
Subject: Fix tests with giac 1.9.0.35 | ||
|
||
--- | ||
src/sage/libs/giac/giac.pyx | 3 +-- | ||
src/sage/symbolic/relation.py | 15 +++++---------- | ||
2 files changed, 6 insertions(+), 12 deletions(-) | ||
|
||
diff --git a/src/sage/libs/giac/giac.pyx b/src/sage/libs/giac/giac.pyx | ||
index 4e451db..ccad516 100644 | ||
--- a/src/sage/libs/giac/giac.pyx | ||
+++ b/src/sage/libs/giac/giac.pyx | ||
@@ -374,8 +374,7 @@ def _giac(s): | ||
|
||
sage: x = libgiac('x') | ||
sage: (1+2*sin(3*x)).solve(x).simplify() | ||
- Warning, argument is not an equation, solving 1+2*sin(3*x)=0 | ||
- list[-pi/18,7*pi/18] | ||
+ ...list[-pi/18,7*pi/18] | ||
|
||
sage: libgiac.solve('sin(3*x)>2*sin(x)',x) | ||
Traceback (most recent call last): | ||
diff --git a/src/sage/symbolic/relation.py b/src/sage/symbolic/relation.py | ||
index e9dbc0f..b8896a9 100644 | ||
--- a/src/sage/symbolic/relation.py | ||
+++ b/src/sage/symbolic/relation.py | ||
@@ -935,8 +935,7 @@ def solve(f, *args, **kwds): | ||
|
||
sage: f = (sin(x) - 8*cos(x)*sin(x))*(sin(x)^2 + cos(x)) - (2*cos(x)*sin(x) - sin(x))*(-2*sin(x)^2 + 2*cos(x)^2 - cos(x)) | ||
sage: solve(f, x, algorithm='giac') | ||
- ... | ||
- [-2*arctan(sqrt(2)), 0, 2*arctan(sqrt(2)), pi] | ||
+ ...[-2*arctan(sqrt(2)), 0, 2*arctan(sqrt(2)), pi] | ||
|
||
sage: x, y = SR.var('x,y') | ||
sage: solve([x+y-4,x*y-3],[x,y],algorithm='giac') | ||
@@ -1440,19 +1439,15 @@ def _giac_solver(f, x, solution_dict=False): | ||
EXAMPLES:: | ||
|
||
sage: solve([(2/3)^x-2], [x], algorithm='giac') | ||
- ... | ||
- [[-log(2)/(log(3) - log(2))]] | ||
+ ...[[-log(2)/(log(3) - log(2))]] | ||
sage: solve([(2/3)^x-2], [x], algorithm='giac', solution_dict=True) | ||
- ... | ||
- [{x: -log(2)/(log(3) - log(2))}] | ||
+ ...[{x: -log(2)/(log(3) - log(2))}] | ||
|
||
sage: f = (sin(x) - 8*cos(x)*sin(x))*(sin(x)^2 + cos(x)) - (2*cos(x)*sin(x) - sin(x))*(-2*sin(x)^2 + 2*cos(x)^2 - cos(x)) | ||
sage: solve(f, x, algorithm='giac') | ||
- ... | ||
- [-2*arctan(sqrt(2)), 0, 2*arctan(sqrt(2)), pi] | ||
+ ...[-2*arctan(sqrt(2)), 0, 2*arctan(sqrt(2)), pi] | ||
sage: solve(f, x, algorithm='giac', solution_dict=True) | ||
- ... | ||
- [{x: -2*arctan(sqrt(2))}, {x: 0}, {x: 2*arctan(sqrt(2))}, {x: pi}] | ||
+ ...[{x: -2*arctan(sqrt(2))}, {x: 0}, {x: 2*arctan(sqrt(2))}, {x: pi}] | ||
|
||
sage: x, y = SR.var('x,y') | ||
sage: solve([x+y-7,x*y-10],[x,y],algorithm='giac') | ||
-- | ||
cgit v1.0-1-gd88e | ||
|
38 changes: 38 additions & 0 deletions
38
srcpkgs/sagemath/patches/zz-fix_edge_case_of_integer_check.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
commit d95ccbdc02a63124bd5dd2743a2356c6f873c5b4 | ||
Author: Gonzalo Tornaría <tornaria@cmat.edu.uy> | ||
Date: Wed Jan 4 20:21:51 2023 -0300 | ||
|
||
sage.arith.long: fix edge case of integer_check_py | ||
|
||
diff --git a/src/sage/arith/long.pxd b/src/sage/arith/long.pxd | ||
index 1c9a53387a0..16d13512f68 100644 | ||
--- a/src/sage/arith/long.pxd | ||
+++ b/src/sage/arith/long.pxd | ||
@@ -270,6 +270,17 @@ cdef inline bint integer_check_long_py(x, long* value, int* err): | ||
sage: L += [-x for x in L] + [0, long_min()] | ||
sage: for v in L: | ||
....: assert check_long_py(int(v)) == v | ||
+ sage: check_long_py(int(2^60)) | ||
+ 1152921504606846976 # 64-bit | ||
+ 'Overflow (...)' # 32-bit | ||
+ sage: check_long_py(int(2^61)) | ||
+ 2305843009213693952 # 64-bit | ||
+ 'Overflow (...)' # 32-bit | ||
+ sage: check_long_py(int(2^62)) | ||
+ 4611686018427387904 # 64-bit | ||
+ 'Overflow (...)' # 32-bit | ||
+ sage: check_long_py(int(2^63)) | ||
+ 'Overflow (...)' | ||
sage: check_long_py(int(2^100)) | ||
'Overflow (...)' | ||
sage: check_long_py(int(long_max() + 1)) | ||
@@ -310,6 +321,9 @@ cdef inline bint integer_check_long_py(x, long* value, int* err): | ||
cdef long lead | ||
cdef long lead_2_overflow = (<long>1) << (BITS_IN_LONG - PyLong_SHIFT) | ||
cdef long lead_3_overflow = (<long>1) << (BITS_IN_LONG - 2 * PyLong_SHIFT) | ||
+ if BITS_IN_LONG < 2 * PyLong_SHIFT: | ||
+ # in this case 3 digit is always overflow | ||
+ lead_3_overflow = 0 | ||
if size == 0: | ||
value[0] = 0 | ||
err[0] = 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
pkgname="sage" | ||
site="https://mirrors.mit.edu/sage/src/index.html" |