summaryrefslogtreecommitdiff
path: root/gnu/packages/patches/sage-update-eclib.patch
blob: 2303005878ac3274a2f08a87afd94c65df59eac3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
From 6dfc26b805d2fb0cafa60f0d778db3d68188b724 Mon Sep 17 00:00:00 2001
From: John Cremona <[email protected]>
Date: Wed, 13 Nov 2024 14:46:51 +0000
Subject: [PATCH 1/4] #38960-eclib-upgrade-20241112

---
 build/pkgs/eclib/SPKG.rst            | 2 +-
 build/pkgs/eclib/checksums.ini       | 4 ++--
 build/pkgs/eclib/package-version.txt | 2 +-
 build/pkgs/eclib/spkg-configure.m4   | 2 +-
 4 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/build/pkgs/eclib/SPKG.rst b/build/pkgs/eclib/SPKG.rst
index 5627fdcb57c..ac8b27b3606 100644
--- a/build/pkgs/eclib/SPKG.rst
+++ b/build/pkgs/eclib/SPKG.rst
@@ -30,5 +30,5 @@ Upstream Contact
 -  Author: John Cremona
 -  Email: [email protected]
 -  Website:
-   http://homepages.warwick.ac.uk/staff/J.E.Cremona/mwrank/index.html
+   https://johncremona.github.io/mwrank/index.html
 -  Repository: https://github.com/JohnCremona/eclib
diff --git a/build/pkgs/eclib/checksums.ini b/build/pkgs/eclib/checksums.ini
index fde4faaee15..b046783341d 100644
--- a/build/pkgs/eclib/checksums.ini
+++ b/build/pkgs/eclib/checksums.ini
@@ -1,4 +1,4 @@
 tarball=eclib-VERSION.tar.bz2
-sha1=3028ac95e1b76699f5f9e871ac706cda363ab842
-sha256=32d116a3e359b0de4f6486c2bb6188bb8b553c8b833f618cc2596484e8b6145a
+sha1=749e4fda3660006a9459f129148d05ba482daa29
+sha256=30765c27ca1420141f83517897119d0185fea9b31132392170ddae40b060e46f
 upstream_url=https://github.com/JohnCremona/eclib/releases/download/vVERSION/eclib-VERSION.tar.bz2
diff --git a/build/pkgs/eclib/package-version.txt b/build/pkgs/eclib/package-version.txt
index 190b92f716b..353869c3cba 100644
--- a/build/pkgs/eclib/package-version.txt
+++ b/build/pkgs/eclib/package-version.txt
@@ -1 +1 @@
-20231212
+20241112
diff --git a/build/pkgs/eclib/spkg-configure.m4 b/build/pkgs/eclib/spkg-configure.m4
index ba5c22fa090..23771dad1bd 100644
--- a/build/pkgs/eclib/spkg-configure.m4
+++ b/build/pkgs/eclib/spkg-configure.m4
@@ -1,7 +1,7 @@
 SAGE_SPKG_CONFIGURE([eclib], [
   SAGE_SPKG_DEPCHECK([ntl pari flint], [
     dnl use existing eclib only if the version reported by pkg-config is recent enough
-    m4_pushdef([SAGE_ECLIB_VER],["20231212"])
+    m4_pushdef([SAGE_ECLIB_VER],["20241112"])
     PKG_CHECK_MODULES([ECLIB], [eclib >= SAGE_ECLIB_VER], [
       AC_CACHE_CHECK([for mwrank version == SAGE_ECLIB_VER], [ac_cv_path_MWRANK], [
         AC_PATH_PROGS_FEATURE_CHECK([MWRANK], [mwrank], [

From d38cb48c67c7565572064fd29748c1e8da3b3271 Mon Sep 17 00:00:00 2001
From: John Cremona <[email protected]>
Date: Tue, 19 Nov 2024 13:51:49 +0000
Subject: [PATCH 2/4] #38960 fix eclib interface after upgrade

---
 src/sage/libs/eclib/__init__.pxd | 4 ++--
 src/sage/libs/eclib/mat.pyx      | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/sage/libs/eclib/__init__.pxd b/src/sage/libs/eclib/__init__.pxd
index d44d4fba865..84d1fc92275 100644
--- a/src/sage/libs/eclib/__init__.pxd
+++ b/src/sage/libs/eclib/__init__.pxd
@@ -55,7 +55,7 @@ cdef extern from "eclib/matrix.h":
     cdef cppclass mat:
         mat()
         mat(mat m)
-        scalar* get_entries()
+        vector[scalar] get_entries()
         scalar sub(long, long)
         long nrows()
         long ncols()
@@ -67,7 +67,7 @@ cdef extern from "eclib/smatrix.h":
     cdef cppclass smat:
         smat()
         smat(smat m)
-        scalar* get_entries()
+        vector[scalar] get_entries()
         scalar sub(long, long)
         long nrows()
         long ncols()
diff --git a/src/sage/libs/eclib/mat.pyx b/src/sage/libs/eclib/mat.pyx
index bfdeb6ae5c1..e7abe369b2b 100644
--- a/src/sage/libs/eclib/mat.pyx
+++ b/src/sage/libs/eclib/mat.pyx
@@ -10,7 +10,7 @@ from sage.rings.integer_ring import ZZ
 from sage.matrix.matrix_integer_sparse cimport Matrix_integer_sparse
 from sage.matrix.matrix_integer_dense cimport Matrix_integer_dense
 from sage.rings.integer cimport Integer
-
+from libcpp.vector cimport vector
 
 cdef class Matrix:
     """
@@ -213,7 +213,7 @@ cdef class Matrix:
         """
         cdef long n = self.nrows()
         cdef long i, j, k
-        cdef scalar* v = <scalar*> self.M.get_entries()   # coercion needed to deal with const
+        cdef vector[scalar] v = <vector[scalar]> self.M.get_entries()   # coercion needed to deal with const
 
         cdef Matrix_integer_dense Td
         cdef Matrix_integer_sparse Ts

From 4f2cb3f7a943aefd05d4baf7b5845a6fc3dba779 Mon Sep 17 00:00:00 2001
From: John Cremona <[email protected]>
Date: Wed, 4 Dec 2024 08:35:58 +0000
Subject: [PATCH 3/4] #38960 simplify eclib interface

---
 src/sage/libs/eclib/__init__.pxd |  2 --
 src/sage/libs/eclib/mat.pyx      | 18 +++++++-----------
 2 files changed, 7 insertions(+), 13 deletions(-)

diff --git a/src/sage/libs/eclib/__init__.pxd b/src/sage/libs/eclib/__init__.pxd
index 84d1fc92275..2673af0613f 100644
--- a/src/sage/libs/eclib/__init__.pxd
+++ b/src/sage/libs/eclib/__init__.pxd
@@ -55,7 +55,6 @@ cdef extern from "eclib/matrix.h":
     cdef cppclass mat:
         mat()
         mat(mat m)
-        vector[scalar] get_entries()
         scalar sub(long, long)
         long nrows()
         long ncols()
@@ -67,7 +66,6 @@ cdef extern from "eclib/smatrix.h":
     cdef cppclass smat:
         smat()
         smat(smat m)
-        vector[scalar] get_entries()
         scalar sub(long, long)
         long nrows()
         long ncols()
diff --git a/src/sage/libs/eclib/mat.pyx b/src/sage/libs/eclib/mat.pyx
index e7abe369b2b..5dbb39faa0e 100644
--- a/src/sage/libs/eclib/mat.pyx
+++ b/src/sage/libs/eclib/mat.pyx
@@ -10,7 +10,6 @@ from sage.rings.integer_ring import ZZ
 from sage.matrix.matrix_integer_sparse cimport Matrix_integer_sparse
 from sage.matrix.matrix_integer_dense cimport Matrix_integer_dense
 from sage.rings.integer cimport Integer
-from libcpp.vector cimport vector
 
 cdef class Matrix:
     """
@@ -212,8 +211,7 @@ cdef class Matrix:
             <class 'sage.matrix.matrix_integer_dense.Matrix_integer_dense'>
         """
         cdef long n = self.nrows()
-        cdef long i, j, k
-        cdef vector[scalar] v = <vector[scalar]> self.M.get_entries()   # coercion needed to deal with const
+        cdef long i, j
 
         cdef Matrix_integer_dense Td
         cdef Matrix_integer_sparse Ts
@@ -221,21 +219,19 @@ cdef class Matrix:
         # Ugly code...
         if sparse:
             Ts = MatrixSpace(ZZ, n, sparse=sparse).zero_matrix().__copy__()
-            k = 0
             for i from 0 <= i < n:
                 for j from 0 <= j < n:
-                    if v[k]:
-                        Ts.set_unsafe(i, j, Integer(v[k]))
-                    k += 1
+                    Mij = Integer(self.M.sub(i+1,j+1));
+                    if Mij:
+                        Ts.set_unsafe(i, j, Mij)
             return Ts
         else:
             Td = MatrixSpace(ZZ, n, sparse=sparse).zero_matrix().__copy__()
-            k = 0
             for i from 0 <= i < n:
                 for j from 0 <= j < n:
-                    if v[k]:
-                        Td.set_unsafe(i, j, Integer(v[k]))
-                    k += 1
+                    Mij = Integer(self.M.sub(i+1,j+1));
+                    if Mij:
+                        Td.set_unsafe(i, j, Mij)
             return Td
 
 

From 8754c7052084043209c8332d3d1154c26c25ae91 Mon Sep 17 00:00:00 2001
From: John Cremona <[email protected]>
Date: Wed, 4 Dec 2024 09:20:07 +0000
Subject: [PATCH 4/4] #38960: fix lint issue

---
 src/sage/libs/eclib/mat.pyx | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/sage/libs/eclib/mat.pyx b/src/sage/libs/eclib/mat.pyx
index 5dbb39faa0e..989d9d1a70c 100644
--- a/src/sage/libs/eclib/mat.pyx
+++ b/src/sage/libs/eclib/mat.pyx
@@ -221,7 +221,7 @@ cdef class Matrix:
             Ts = MatrixSpace(ZZ, n, sparse=sparse).zero_matrix().__copy__()
             for i from 0 <= i < n:
                 for j from 0 <= j < n:
-                    Mij = Integer(self.M.sub(i+1,j+1));
+                    Mij = Integer(self.M.sub(i+1,j+1))
                     if Mij:
                         Ts.set_unsafe(i, j, Mij)
             return Ts
@@ -229,7 +229,7 @@ cdef class Matrix:
             Td = MatrixSpace(ZZ, n, sparse=sparse).zero_matrix().__copy__()
             for i from 0 <= i < n:
                 for j from 0 <= j < n:
-                    Mij = Integer(self.M.sub(i+1,j+1));
+                    Mij = Integer(self.M.sub(i+1,j+1))
                     if Mij:
                         Td.set_unsafe(i, j, Mij)
             return Td