We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 1b8c416 commit 36b43a4Copy full SHA for 36b43a4
src/sage/matrix/matrix_modn_dense_template.pxi
@@ -451,7 +451,13 @@ cdef class Matrix_modn_dense_template(Matrix_dense):
451
else:
452
self._entries = <celement *> check_allocarray(self._nrows * self._ncols, sizeof(celement))
453
454
+ # TODO: it is a bit of a waste to allocate _matrix when ncols=0. Though some
455
+ # of the code expects self._matrix[i] to be valid, even though it points to
456
+ # an empty vector.
457
self._matrix = <celement **> check_allocarray(self._nrows, sizeof(celement*))
458
+ if self._nrows == 0:
459
+ return
460
+
461
cdef Py_ssize_t i
462
self._matrix[0] = self._entries
463
for i in range(self._nrows - 1):
0 commit comments