@@ -3012,19 +3012,16 @@ cdef class Matrix_modn_dense_template(Matrix_dense):
3012
3012
if nrows == - 1 :
3013
3013
nrows = self ._nrows - row
3014
3014
3015
- # if col != 0 or ncols != self._ncols:
3016
- # return self.matrix_from_rows_and_columns(range(row, row+nrows), range(col, col+ncols))
3017
-
3018
3015
if nrows < 0 or row < 0 or row + nrows > self ._nrows:
3019
3016
raise IndexError (" rows out of range" )
3017
+ if ncols < 0 or col < 0 or col + ncols > self ._ncols:
3018
+ raise IndexError (" columns out of range" )
3020
3019
3021
3020
cdef Matrix_modn_dense_template M = self .new_matrix(nrows = nrows, ncols = ncols)
3022
3021
cdef Py_ssize_t i,r
3023
3022
for i,r in enumerate (range (row, row+ nrows)) :
3024
3023
memcpy(M._entries + (i* ncols), self ._entries+ self ._ncols* r+ col, sizeof(celement)* ncols)
3025
3024
3026
- # cdef Matrix_modn_dense_template M = self.new_matrix(nrows=nrows, ncols=self._ncols)
3027
- # memcpy(M._entries, self._entries+row*ncols, sizeof(celement)*ncols*nrows)
3028
3025
return M
3029
3026
3030
3027
def _matrices_from_rows (self , Py_ssize_t nrows , Py_ssize_t ncols ):
@@ -3087,7 +3084,6 @@ cdef class Matrix_modn_dense_template(Matrix_dense):
3087
3084
[5 4]
3088
3085
[0 7]
3089
3086
"""
3090
- # columns = PySequence_Fast(columns, "columns is not iterable")
3091
3087
cdef Py_ssize_t ncols = len (columns)
3092
3088
3093
3089
# Construct new matrix
@@ -3098,8 +3094,7 @@ cdef class Matrix_modn_dense_template(Matrix_dense):
3098
3094
raise IndexError (" column index out of range" )
3099
3095
for i in range (self ._nrows):
3100
3096
A._matrix[i][j] = self ._matrix[i][col]
3101
-
3102
- # A.set_unsafe(i, j, self.get_unsafe(i, col))
3097
+
3103
3098
return A
3104
3099
3105
3100
def matrix_from_rows (self , rows ):
@@ -3118,7 +3113,6 @@ cdef class Matrix_modn_dense_template(Matrix_dense):
3118
3113
[6 7 0]
3119
3114
[3 4 5]
3120
3115
"""
3121
- # rows = PySequence_Fast(rows, "rows is not iterable")
3122
3116
cdef Py_ssize_t nrows = len (rows)
3123
3117
3124
3118
# Construct new matrix
@@ -3130,8 +3124,6 @@ cdef class Matrix_modn_dense_template(Matrix_dense):
3130
3124
raise IndexError (" row index out of range" )
3131
3125
memcpy(A._entries+ (i* self ._ncols), self ._entries+ (row* self ._ncols), sizeof(celement)* self ._ncols)
3132
3126
3133
- # for j in range(self._ncols):
3134
- # A.set_unsafe(i, j, self.get_unsafe(row, j))
3135
3127
return A
3136
3128
3137
3129
def matrix_from_rows_and_columns (self , rows , columns ):
@@ -3174,9 +3166,6 @@ cdef class Matrix_modn_dense_template(Matrix_dense):
3174
3166
3175
3167
- Didier Deshommes: some Pyrex speedups implemented
3176
3168
"""
3177
- # rows = PySequence_Fast(rows, "rows is not iterable")
3178
- # columns = PySequence_Fast(columns, "columns is not iterable")
3179
-
3180
3169
cdef Py_ssize_t ncols = len (columns)
3181
3170
cdef Py_ssize_t nrows = len (rows)
3182
3171
@@ -3194,7 +3183,6 @@ cdef class Matrix_modn_dense_template(Matrix_dense):
3194
3183
for j, col in enumerate (columns):
3195
3184
A._matrix[i][j] = self ._matrix[row][col]
3196
3185
3197
- # A.set_unsafe(i, j, self.get_unsafe(row, col))
3198
3186
return A
3199
3187
3200
3188
def __bool__ (self ):
0 commit comments