@@ -176,7 +176,7 @@ cdef class BasisExchangeMatroid(Matroid):
176
176
self ._E = groundset
177
177
self ._idx = {}
178
178
cdef long i
179
- for i in xrange (self ._groundset_size):
179
+ for i in range (self ._groundset_size):
180
180
self ._idx[self ._E[i]] = i
181
181
182
182
if basis is not None :
@@ -219,7 +219,7 @@ cdef class BasisExchangeMatroid(Matroid):
219
219
self ._groundset = frozenset (E)
220
220
221
221
self ._idx = {}
222
- for i in xrange (self ._groundset_size):
222
+ for i in range (self ._groundset_size):
223
223
self ._idx[self ._E[i]] = i
224
224
225
225
if self ._weak_partition_var:
@@ -1090,7 +1090,7 @@ cdef class BasisExchangeMatroid(Matroid):
1090
1090
bitset_free(loops)
1091
1091
bitset_free(loop)
1092
1092
bitset_free(active_rows)
1093
- for i in xrange (self .full_rank()):
1093
+ for i in range (self .full_rank()):
1094
1094
bitset_free(comp[i])
1095
1095
sig_free(comp)
1096
1096
return res
@@ -1267,16 +1267,16 @@ cdef class BasisExchangeMatroid(Matroid):
1267
1267
flats = < bitset_t* > sig_malloc((self .full_rank() + 1 ) * sizeof(bitset_t))
1268
1268
todo = < bitset_t* > sig_malloc((self .full_rank() + 1 ) * sizeof(bitset_t))
1269
1269
1270
- for i in xrange (self .full_rank() + 1 ):
1270
+ for i in range (self .full_rank() + 1 ):
1271
1271
bitset_init(flats[i], self ._bitset_size)
1272
1272
bitset_init(todo[i], self ._bitset_size)
1273
- f_vec = [0 for i in xrange (self .full_rank() + 1 )]
1273
+ f_vec = [0 for i in range (self .full_rank() + 1 )]
1274
1274
i = 0
1275
1275
bitset_clear(todo[0 ])
1276
1276
self .__closure(flats[0 ], todo[0 ])
1277
1277
bitset_complement(todo[0 ], flats[0 ])
1278
1278
self ._f_vector_rec(f_vec, flats, todo, 0 , 0 )
1279
- for i in xrange (self .full_rank() + 1 ):
1279
+ for i in range (self .full_rank() + 1 ):
1280
1280
bitset_free(flats[i])
1281
1281
bitset_free(todo[i])
1282
1282
sig_free(flats)
@@ -1340,7 +1340,7 @@ cdef class BasisExchangeMatroid(Matroid):
1340
1340
flats = < bitset_t* > sig_malloc((r + 1 ) * sizeof(bitset_t))
1341
1341
todo = < bitset_t* > sig_malloc((r + 1 ) * sizeof(bitset_t))
1342
1342
1343
- for i in xrange (r + 1 ):
1343
+ for i in range (r + 1 ):
1344
1344
bitset_init(flats[i], self ._bitset_size)
1345
1345
bitset_init(todo[i], self ._bitset_size)
1346
1346
Rflats = SetSystem(self ._E)
@@ -1349,7 +1349,7 @@ cdef class BasisExchangeMatroid(Matroid):
1349
1349
self .__closure(flats[0 ], todo[0 ])
1350
1350
bitset_complement(todo[0 ], flats[0 ])
1351
1351
self ._flats_rec(Rflats, r, flats, todo, 0 , 0 )
1352
- for i in xrange (r + 1 ):
1352
+ for i in range (r + 1 ):
1353
1353
bitset_free(flats[i])
1354
1354
bitset_free(todo[i])
1355
1355
sig_free(flats)
@@ -1415,7 +1415,7 @@ cdef class BasisExchangeMatroid(Matroid):
1415
1415
coflats = < bitset_t* > sig_malloc((r + 1 ) * sizeof(bitset_t))
1416
1416
todo = < bitset_t* > sig_malloc((r + 1 ) * sizeof(bitset_t))
1417
1417
1418
- for i in xrange (r + 1 ):
1418
+ for i in range (r + 1 ):
1419
1419
bitset_init(coflats[i], self ._bitset_size)
1420
1420
bitset_init(todo[i], self ._bitset_size)
1421
1421
Rcoflats = SetSystem(self ._E)
@@ -1424,7 +1424,7 @@ cdef class BasisExchangeMatroid(Matroid):
1424
1424
self .__coclosure(coflats[0 ], todo[0 ])
1425
1425
bitset_complement(todo[0 ], coflats[0 ])
1426
1426
self ._coflats_rec(Rcoflats, r, coflats, todo, 0 , 0 )
1427
- for i in xrange (r + 1 ):
1427
+ for i in range (r + 1 ):
1428
1428
bitset_free(coflats[i])
1429
1429
bitset_free(todo[i])
1430
1430
sig_free(coflats)
@@ -1462,28 +1462,28 @@ cdef class BasisExchangeMatroid(Matroid):
1462
1462
flats = < bitset_t* > sig_malloc((k + 1 ) * sizeof(bitset_t))
1463
1463
todo = < bitset_t* > sig_malloc((k + 1 ) * sizeof(bitset_t))
1464
1464
1465
- for i in xrange (k + 1 ):
1465
+ for i in range (k + 1 ):
1466
1466
bitset_init(flats[i], self ._bitset_size)
1467
1467
bitset_init(todo[i], self ._bitset_size)
1468
- f_inc = [[0 for e in range (self ._groundset_size + 1 )] for i in xrange (k + 1 )]
1468
+ f_inc = [[0 for e in range (self ._groundset_size + 1 )] for i in range (k + 1 )]
1469
1469
i = 0
1470
1470
bitset_clear(todo[0 ])
1471
1471
self .__closure(flats[0 ], todo[0 ])
1472
1472
bitset_complement(todo[0 ], flats[0 ])
1473
1473
self ._flat_element_inv_rec(f_inc, k, flats, todo, 0 , 0 )
1474
- for i in xrange (k + 1 ):
1474
+ for i in range (k + 1 ):
1475
1475
bitset_free(flats[i])
1476
1476
bitset_free(todo[i])
1477
1477
sig_free(flats)
1478
1478
sig_free(todo)
1479
1479
fie = {}
1480
1480
for e in range (self ._groundset_size):
1481
- t = tuple ([f_inc[i][e] for i in xrange (k + 1 )])
1481
+ t = tuple ([f_inc[i][e] for i in range (k + 1 )])
1482
1482
if t in fie:
1483
1483
fie[t].add(self ._E[e])
1484
1484
else :
1485
1485
fie[t] = set ([self ._E[e]])
1486
- f_vec = tuple ([f_inc[i][self ._groundset_size] for i in xrange (k + 1 )])
1486
+ f_vec = tuple ([f_inc[i][self ._groundset_size] for i in range (k + 1 )])
1487
1487
return fie, f_vec
1488
1488
1489
1489
cdef _flat_element_inv_rec(self , object f_inc, long R, bitset_t* flats, bitset_t* todo, long elt, long i):
@@ -1806,7 +1806,7 @@ cdef class BasisExchangeMatroid(Matroid):
1806
1806
if self .__is_independent(self ._input):
1807
1807
bitset_copy(self ._input2, self ._current_basis)
1808
1808
e = bitset_first(self ._current_basis)
1809
- for e in xrange (self ._groundset_size):
1809
+ for e in range (self ._groundset_size):
1810
1810
if not bitset_in(self ._current_basis, e):
1811
1811
self .__fundamental_circuit(self ._output, e)
1812
1812
if e > bitset_first(self ._output):
@@ -1854,7 +1854,7 @@ cdef class BasisExchangeMatroid(Matroid):
1854
1854
if self .__is_independent(self ._input):
1855
1855
bitset_copy(self ._input2, self ._current_basis)
1856
1856
e = bitset_first(self ._current_basis)
1857
- for e in xrange (self ._groundset_size):
1857
+ for e in range (self ._groundset_size):
1858
1858
if not bitset_in(self ._current_basis, e):
1859
1859
self .__fundamental_circuit(self ._output, e)
1860
1860
if e > bitset_first(self ._output):
@@ -2162,7 +2162,7 @@ cdef class BasisExchangeMatroid(Matroid):
2162
2162
Bitpacked version of ``is_isomorphism``.
2163
2163
"""
2164
2164
cdef long i
2165
- morph = [other._idx[morphism[self ._E[i]]] for i in xrange (len (self ))]
2165
+ morph = [other._idx[morphism[self ._E[i]]] for i in range (len (self ))]
2166
2166
bitset_clear(self ._input)
2167
2167
bitset_set_first_n(self ._input, self ._matroid_rank)
2168
2168
repeat = True
@@ -2226,15 +2226,15 @@ cdef class BasisExchangeMatroid(Matroid):
2226
2226
if self .full_rank() != other.full_rank():
2227
2227
return None
2228
2228
if self .full_rank() == 0 or self .full_corank() == 0 :
2229
- return {self .groundset_list()[i]: other.groundset_list()[i] for i in xrange (len (self ))}
2229
+ return {self .groundset_list()[i]: other.groundset_list()[i] for i in range (len (self ))}
2230
2230
2231
2231
if self ._weak_invariant() != other._weak_invariant():
2232
2232
return None
2233
2233
PS = self ._weak_partition()
2234
2234
PO = other._weak_partition()
2235
2235
if len (PS) == len (self ) and len (PO) == len (other):
2236
2236
morphism = {}
2237
- for i in xrange (len (self )):
2237
+ for i in range (len (self )):
2238
2238
morphism[min (PS[i])] = min (PO[i])
2239
2239
if self .__is_isomorphism(other, morphism):
2240
2240
return morphism
@@ -2247,7 +2247,7 @@ cdef class BasisExchangeMatroid(Matroid):
2247
2247
PO = other._strong_partition()
2248
2248
if len (PS) == len (self ) and len (PO) == len (other):
2249
2249
morphism = {}
2250
- for i in xrange (len (self )):
2250
+ for i in range (len (self )):
2251
2251
morphism[min (PS[i])] = min (PO[i])
2252
2252
if self .__is_isomorphism(other, morphism):
2253
2253
return morphism
@@ -2258,7 +2258,7 @@ cdef class BasisExchangeMatroid(Matroid):
2258
2258
PHS = self ._heuristic_partition()
2259
2259
PHO = other._heuristic_partition()
2260
2260
morphism = {}
2261
- for i in xrange (len (self )):
2261
+ for i in range (len (self )):
2262
2262
morphism[min (PHS[i])] = min (PHO[i])
2263
2263
if self .__is_isomorphism(other, morphism):
2264
2264
return morphism
@@ -2327,7 +2327,7 @@ cdef class BasisExchangeMatroid(Matroid):
2327
2327
PO = other._weak_partition()
2328
2328
if len (PS) == len (self ) and len (PO) == len (other):
2329
2329
morphism = {}
2330
- for i in xrange (len (self )):
2330
+ for i in range (len (self )):
2331
2331
morphism[min (PS[i])] = min (PO[i])
2332
2332
return self .__is_isomorphism(other, morphism)
2333
2333
@@ -2337,15 +2337,15 @@ cdef class BasisExchangeMatroid(Matroid):
2337
2337
PO = other._strong_partition()
2338
2338
if len (PS) == len (self ) and len (PO) == len (other):
2339
2339
morphism = {}
2340
- for i in xrange (len (self )):
2340
+ for i in range (len (self )):
2341
2341
morphism[min (PS[i])] = min (PO[i])
2342
2342
return self .__is_isomorphism(other, morphism)
2343
2343
2344
2344
if self ._heuristic_invariant() == other._heuristic_invariant():
2345
2345
PHS = self ._heuristic_partition()
2346
2346
PHO = other._heuristic_partition()
2347
2347
morphism = {}
2348
- for i in xrange (len (self )):
2348
+ for i in range (len (self )):
2349
2349
morphism[min (PHS[i])] = min (PHO[i])
2350
2350
if self .__is_isomorphism(other, morphism):
2351
2351
return True
0 commit comments