Skip to content

Commit

Permalink
sagemath: patch for scipy 1.12.
Browse files Browse the repository at this point in the history
See: sagemath/sage#37123

Also apply a few minor fixes.
  • Loading branch information
tornaria committed Jan 22, 2024
1 parent 33657b9 commit cd2f090
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 5 deletions.
1 change: 1 addition & 0 deletions srcpkgs/sagemath/files/sage_conf.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# configuration for sage on void linux
SAGE_SHARE = "/usr/share/sagemath"
GAP_SHARE_DIR = "/usr/share/gap"
JMOL_DIR = "/usr/share/jmol"
15 changes: 15 additions & 0 deletions srcpkgs/sagemath/patches/36862-giac_1.9.0-73.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
diff --git a/src/sage/calculus/calculus.py b/src/sage/calculus/calculus.py
index dfaafb4353f..8d62ade24c8 100644
--- a/src/sage/calculus/calculus.py
+++ b/src/sage/calculus/calculus.py
@@ -568,8 +568,8 @@ def symbolic_sum(expression, v, a, b, algorithm='maxima', hold=False):

An example of this summation with Giac::

- sage: symbolic_sum(1/(1+k^2), k, -oo, oo, algorithm='giac')
- (pi*e^(2*pi) - pi*e^(-2*pi))/(e^(2*pi) + e^(-2*pi) - 2)
+ sage: symbolic_sum(1/(1+k^2), k, -oo, oo, algorithm='giac').factor()
+ pi*(e^(2*pi) + 1)/((e^pi + 1)*(e^pi - 1))

The same summation is solved by SymPy::

26 changes: 26 additions & 0 deletions srcpkgs/sagemath/patches/37123-scipy_1.12.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
diff --git a/src/sage/matrix/matrix_double_dense.pyx b/src/sage/matrix/matrix_double_dense.pyx
index 5d19067f2ed..97e50fb2616 100644
--- a/src/sage/matrix/matrix_double_dense.pyx
+++ b/src/sage/matrix/matrix_double_dense.pyx
@@ -867,7 +867,7 @@ cdef class Matrix_double_dense(Matrix_numpy_dense):
# set cutoff as RDF element
if eps == 'auto':
if scipy is None: import scipy
- eps = 2*max(self._nrows, self._ncols)*scipy.finfo(float).eps*sv[0]
+ eps = 2*max(self._nrows, self._ncols)*numpy.finfo(float).eps*sv[0]
eps = RDF(eps)
# locate non-zero entries
rank = 0
diff --git a/src/sage/numerical/optimize.py b/src/sage/numerical/optimize.py
index 708d440a205..9f973c6bd69 100644
--- a/src/sage/numerical/optimize.py
+++ b/src/sage/numerical/optimize.py
@@ -426,7 +426,7 @@ def minimize(func, x0, gradient=None, hessian=None, algorithm="default",
hess = func.hessian()
hess_fast = [ [fast_callable(a, vars=var_names, domain=float) for a in row] for row in hess]
hessian = lambda p: [[a(*p) for a in row] for row in hess_fast]
- from scipy import dot
+ from numpy import dot
hessian_p = lambda p,v: dot(numpy.array(hessian(p)),v)
min = optimize.fmin_ncg(f, [float(_) for _ in x0], fprime=gradient,
fhess=hessian, fhess_p=hessian_p, disp=verbose, **args)
7 changes: 6 additions & 1 deletion srcpkgs/sagemath/patches/get_patches
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ get_pr() {
# run from patches dir
cd $(dirname "$0")

# needs review
# all merged in 10.3.beta6 or before
get_pr 35848 "flintlib 3.0"
get_pr 36769 "fix jmol detect"
get_pr 36862 "giac 1.9.0-73"
get_pr 37004 "fix save_session when cython changes"

# positive review
get_pr 37123 "scipy 1.12"
8 changes: 4 additions & 4 deletions srcpkgs/sagemath/template
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Template file for 'sagemath'
pkgname=sagemath
version=10.2
revision=1
revision=2
build_wrksrc=pkgs/sagemath-standard
build_style=python3-module
_bindir=/usr/lib/sagemath/$version/bin
Expand All @@ -15,7 +15,7 @@ makedepends="boost-devel brial-devel cliquer-devel ecl eclib-devel
mpfr-devel ntl-devel openblas-devel pari-devel planarity-devel python3-cypari2
python3-cysignals python3-devel python3-gmpy2 python3-memory_allocator
python3-numpy rankwidth-devel singular symmetrica-devel"
depends="eclib-devel fflas-ffpack flintlib-devel gcc-fortran gd-devel
depends="eclib-devel fflas-ffpack flintlib-devel gcc-fortran meson gd-devel
gfan giac gsl-devel gzip libpng-devel linbox-devel m4ri-devel maxima-ecl
mpfr-devel nauty ntl-devel palp pari-devel pari-elldata-small pari-galdata
pari-galpol-small pari-seadata-small pkg-config python3-Cython python3-cypari2
Expand All @@ -26,15 +26,15 @@ depends="eclib-devel fflas-ffpack flintlib-devel gcc-fortran gd-devel
python3-sympy python3-traitlets sage-data-combinatorial_designs
sage-data-conway_polynomials sage-data-elliptic_curves sage-data-graphs
sage-data-polytopes_db sympow tachyon threejs-sage"
checkdepends="$depends pythran python3-Sphinx meson"
checkdepends="$depends pythran python3-Sphinx"
short_desc="Open source mathematics software"
maintainer="Gonzalo Tornaría <tornaria@cmat.edu.uy>"
license="GPL-2.0-or-later"
homepage="https://www.sagemath.org/"
changelog="https://github.com/sagemath/sage/releases"
distfiles="https://github.com/sagemath/sage/archive/refs/tags/$version.tar.gz"
checksum=e7125f13495e1068edab73735aca7f9b2c655688096e9d109e628c023e76411f
nocross="due to ntl (eclib), fflas-ffpack, givaro, linbox, sympow, maxima"
nocross="due to ntl (eclib, singular), fflas-ffpack, givaro, linbox, sympow, maxima"

post_patch() {
# git tree needs bootstrapping
Expand Down

0 comments on commit cd2f090

Please sign in to comment.