Skip to content

Commit 6b01180

Browse files
committed
slightly optimize code
1 parent c70956c commit 6b01180

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/sage/matrix/matrix_mod2_dense.pyx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2264,10 +2264,11 @@ cdef class Matrix_mod2_dense(matrix_dense.Matrix_dense): # dense or sparse
22642264
count1 = [[0]*partition_num for _ in range(i)]
22652265
for col in range(i):
22662266
parition_i = 0
2267-
for row in reversed(range(A._nrows)):
2267+
for row in reversed(range(1, A._nrows)):
22682268
count1[col][parition_i] += mzd_read_bit(A._entries, row, col)
2269-
if row > 0 and partition_rows[row - 1]:
2269+
if partition_rows[row - 1]:
22702270
parition_i += 1
2271+
count1[col][parition_i] += mzd_read_bit(A._entries, 0, col) # special case of row == 0
22712272

22722273
# calculate largest_col = col s.t. count1[col] is lexicographically largest (0 <= col < i)
22732274
_, largest_col = max((c, i) for i, c in enumerate(count1))

0 commit comments

Comments
 (0)