Skip to content

Commit f28b6c2

Browse files
author
Marie BONBOIRE
committed
correct submatrix
1 parent c9a2550 commit f28b6c2

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/sage/matrix/matrix_modn_dense_template.pxi

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3017,11 +3017,12 @@ cdef class Matrix_modn_dense_template(Matrix_dense):
30173017
if ncols < 0 or col < 0 or col + ncols > self._ncols:
30183018
raise IndexError("columns out of range")
30193019

3020+
cdef Matrix_modn_dense_template M = self.new_matrix(nrows=nrows, ncols=ncols)
3021+
30203022
if col == 0 and ncols == self._ncols:
3021-
cdef Matrix_modn_dense_template M = self.new_matrix(nrows=nrows, ncols=self._ncols)
30223023
memcpy(M._entries, self._entries+row*ncols, sizeof(celement)*ncols*nrows)
3024+
return M
30233025

3024-
cdef Matrix_modn_dense_template M = self.new_matrix(nrows=nrows, ncols=ncols)
30253026
cdef Py_ssize_t i,r
30263027
for i,r in enumerate(range(row, row+nrows)) :
30273028
memcpy(M._entries + (i*ncols), self._entries+self._ncols*r+col, sizeof(celement)*ncols)

0 commit comments

Comments
 (0)