void-packages/srcpkgs/sagemath/patches/numpy_2.1a.patch

29 lines
1.0 KiB
Diff

commit 241dc39bd0ba1c056f88bee46a0345d59093eaff
Author: Gonzalo Tornaría <tornaria@cmat.edu.uy>
Date: Mon Aug 19 23:25:32 2024 -0300
add copy parameter to numpy (needed for v2.1)
diff --git a/src/sage/matrix/matrix1.pyx b/src/sage/matrix/matrix1.pyx
index c38df5412f0..f587cef651a 100644
--- a/src/sage/matrix/matrix1.pyx
+++ b/src/sage/matrix/matrix1.pyx
@@ -671,7 +671,7 @@ cdef class Matrix(Matrix0):
entries = [[sib(v, 2) for v in row] for row in self.rows()]
return sib.name('matrix')(self.base_ring(), entries)
- def numpy(self, dtype=None):
+ def numpy(self, dtype=None, copy=True):
"""
Return the Numpy matrix associated to this matrix.
@@ -732,7 +732,7 @@ cdef class Matrix(Matrix0):
(3, 4)
"""
import numpy
- A = numpy.matrix(self.list(), dtype=dtype)
+ A = numpy.matrix(self.list(), dtype=dtype, copy=copy)
return numpy.resize(A,(self.nrows(), self.ncols()))
# Define the magic "__array__" function so that numpy.array(m) can convert