@@ -2169,8 +2169,7 @@ cdef class Matrix_mod2_dense(matrix_dense.Matrix_dense): # dense or sparse
2169
2169
2170
2170
EXAMPLES::
2171
2171
2172
- sage: A = Matrix( GF( 2) , [
2173
- ....: [0, 1 ],
2172
+ sage: A = Matrix( GF( 2) , [[0, 1 ],
2174
2173
.... : [1, 0 ]])
2175
2174
sage: r, c = A. doubly_lexical_ordering( )
2176
2175
sage: r
@@ -2183,17 +2182,15 @@ cdef class Matrix_mod2_dense(matrix_dense.Matrix_dense): # dense or sparse
2183
2182
2184
2183
::
2185
2184
2186
- sage: A = Matrix( GF( 2) , [
2187
- ....: [0, 1 ],
2185
+ sage: A = Matrix( GF( 2) , [[0, 1 ],
2188
2186
.... : [1, 0 ]])
2189
2187
sage: r, c = A. doubly_lexical_ordering( inplace=True) ; A
2190
2188
[1 0 ]
2191
2189
[0 1 ]
2192
2190
2193
2191
TESTS:
2194
2192
2195
- sage: A = Matrix( GF( 2) , [
2196
- ....: [1, 1, 0, 0, 0, 0, 0 ],
2193
+ sage: A = Matrix( GF( 2) , [[1, 1, 0, 0, 0, 0, 0 ],
2197
2194
.... : [1, 1, 0, 0, 0, 0, 0 ],
2198
2195
.... : [1, 1, 0, 1, 0, 0, 0 ],
2199
2196
.... : [0, 0, 1, 1, 0, 0, 0 ],
@@ -2245,17 +2242,12 @@ cdef class Matrix_mod2_dense(matrix_dense.Matrix_dense): # dense or sparse
2245
2242
for col in range (i):
2246
2243
parition_i = 0
2247
2244
for row in reversed (range (A._nrows)):
2248
- count1[col][parition_i] += 1 if mzd_read_bit(A._entries, row, col) else 0
2245
+ count1[col][parition_i] += mzd_read_bit(A._entries, row, col)
2249
2246
if row > 0 and partition_rows[row - 1 ]:
2250
2247
parition_i += 1
2251
2248
2252
2249
# calculate largest_col = col s.t. count1[col] is lexicographically largest (0 <= col < i)
2253
- largest_col = 0
2254
- largest_count1 = count1[0 ]
2255
- for col in range (1 , i):
2256
- if count1[col] >= largest_count1:
2257
- largest_col = col
2258
- largest_count1 = count1[col]
2250
+ _, largest_col = max ((c, i) for i, c in enumerate (count1))
2259
2251
2260
2252
# We refine each partition of rows according to the value of A[:][largest_col].
2261
2253
# and also move down rows that satisfy A[row][largest_col] = 1 in each partition.
0 commit comments