# HG changeset patch
# User Simon King <simon.king@uni-jena.de>
# Date 1311851937 -7200
# Node ID 1f48bd2c336aba49b4daac3486c901fe0a19fcd1
# Parent 9ea016e211d608f991fd4e84ccf1f171651a764b
#11589: Remove hard-coded and potentially slow creation of zero matrix in Strassen multiplication
diff --git a/sage/matrix/matrix1.pyx b/sage/matrix/matrix1.pyx
a
|
b
|
|
1826 | 1826 | else: |
1827 | 1827 | return MS |
1828 | 1828 | |
1829 | | def new_matrix(self, nrows=None, ncols=None, entries=0, |
| 1829 | def new_matrix(self, nrows=None, ncols=None, entries=None, |
1830 | 1830 | coerce=True, copy=True, sparse=None): |
1831 | 1831 | """ |
1832 | 1832 | Create a matrix in the parent of this matrix with the given number |
diff --git a/sage/matrix/matrix2.pyx b/sage/matrix/matrix2.pyx
a
|
b
|
|
5080 | 5080 | if cutoff <= 0: |
5081 | 5081 | raise ValueError, "cutoff must be at least 1" |
5082 | 5082 | |
5083 | | #output = self.new_matrix(self._nrows, right._ncols) |
5084 | | # the following is a little faster: |
5085 | | if self.is_sparse(): |
5086 | | output = self.matrix_space(self._nrows, right._ncols, sparse = True)(0) |
5087 | | else: |
5088 | | output = self.matrix_space(self._nrows, right._ncols, sparse = False).zero_matrix().__copy__() |
| 5083 | output = self.new_matrix(self._nrows, right._ncols) |
| 5084 | # The following used to be a little faster, but meanwhile |
| 5085 | # the previous line is faster. |
| 5086 | #if self.is_sparse(): |
| 5087 | # output = self.matrix_space(self._nrows, right._ncols, sparse = True)(0) |
| 5088 | #else: |
| 5089 | # output = self.matrix_space(self._nrows, right._ncols, sparse = False).zero_matrix().__copy__() |
5089 | 5090 | |
5090 | 5091 | self_window = self.matrix_window() |
5091 | 5092 | right_window = right.matrix_window() |