Skip to content

Commit bc80bf9

Browse files
committed
Suggestions by tscrim
1 parent f5d3701 commit bc80bf9

File tree

1 file changed

+21
-19
lines changed

1 file changed

+21
-19
lines changed

src/sage/matroids/matroid.pyx

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1115,9 +1115,9 @@ cdef class Matroid(SageObject):
11151115
if certificate:
11161116
return False, None
11171117
return False
1118-
D = self.dual()
1118+
YY = self.dual().independent_r_sets(cd)
11191119
for X in self.independent_r_sets_iterator(rd):
1120-
for Y in D.independent_r_sets_iterator(cd):
1120+
for Y in YY:
11211121
if X.isdisjoint(Y):
11221122
if N._is_isomorphic(self._minor(contractions=X, deletions=Y)):
11231123
if certificate:
@@ -2317,17 +2317,20 @@ cdef class Matroid(SageObject):
23172317
['b', 'd', 'f', 'g'], ['b', 'e', 'g'], ['c', 'd', 'e', 'g'],
23182318
['c', 'f', 'g'], ['d', 'e', 'f']]
23192319
"""
2320-
if k and k < self.rank() + 2:
2321-
for X in combinations(self.groundset(), k):
2320+
rk = self.rank()
2321+
if k is None:
2322+
start = 0
2323+
stop = rk + 2
2324+
else:
2325+
if k >= rk + 2:
2326+
return
2327+
start = k
2328+
stop = k + 1
2329+
for j in range(start, stop):
2330+
for X in combinations(self.groundset(), j):
23222331
X = frozenset(X)
23232332
if self._is_circuit(X):
23242333
yield X
2325-
elif not k:
2326-
for k in range(self.rank() + 2):
2327-
for X in combinations(self.groundset(), k):
2328-
X = frozenset(X)
2329-
if self._is_circuit(X):
2330-
yield X
23312334

23322335
cpdef nonspanning_circuits(self) noexcept:
23332336
"""
@@ -2769,7 +2772,7 @@ cdef class Matroid(SageObject):
27692772
:meth:`M.independent_sets() <sage.matroids.matroid.Matroid.independent_sets>`
27702773
:meth:`M.bases() <sage.matroids.matroid.Matroid.bases>`
27712774
"""
2772-
res = []
2775+
cdef list res = []
27732776
for X in combinations(self.groundset(), r):
27742777
X = frozenset(X)
27752778
if self._rank(X) == len(X):
@@ -2966,7 +2969,7 @@ cdef class Matroid(SageObject):
29662969
r"""
29672970
Return the `f`-vector of the matroid.
29682971
2969-
The `f`-*vector* is a vector `(f_0, \dots, f_r)`, where `f_i` is the
2972+
The `f`-*vector* is a vector `(f_0, \ldots, f_r)`, where `f_i` is the
29702973
number of independent sets of rank `i`, and `r` is the rank of the
29712974
matroid.
29722975
@@ -2997,8 +3000,8 @@ cdef class Matroid(SageObject):
29973000
Return the Whitney numbers of the first kind of the matroid.
29983001
29993002
The Whitney numbers of the first kind -- here encoded as a vector
3000-
`(w_0=1, ..., w_r)` -- are numbers of alternating sign, where `w_i` is
3001-
the value of the coefficient of the `(r-i)`-th degree term of the
3003+
`(w_0=1, \ldots, w_r)` -- are numbers of alternating sign, where `w_i`
3004+
is the value of the coefficient of the `(r-i)`-th degree term of the
30023005
matroid's characteristic polynomial. Moreover, `|w_i|` is the number of
30033006
`(i-1)`-dimensional faces of the broken circuit complex of the matroid.
30043007
@@ -3026,8 +3029,8 @@ cdef class Matroid(SageObject):
30263029
Return the Whitney numbers of the second kind of the matroid.
30273030
30283031
The Whitney numbers of the second kind are here encoded as a vector
3029-
`(W_0, ..., W_r)`, where `W_i` is the number of flats of rank `i`, and
3030-
`r` is the rank of the matroid.
3032+
`(W_0, \ldots, W_r)`, where `W_i` is the number of flats of rank `i`,
3033+
and `r` is the rank of the matroid.
30313034
30323035
OUTPUT: a list of integers
30333036
@@ -3204,7 +3207,6 @@ cdef class Matroid(SageObject):
32043207
and facets {(1, 3, 5), (2, 3, 5), (2, 4, 5), (3, 4, 5)}
32053208
"""
32063209
if not self.loops():
3207-
32083210
if ordering is None:
32093211
rev_order = sorted(self.groundset(), key=cmp_elements_key, reverse=True)
32103212
else:
@@ -3311,7 +3313,7 @@ cdef class Matroid(SageObject):
33113313
33123314
over all bases `B` of the matroid. Here `e_i` are the standard
33133315
basis vectors of `\RR^n`. An arbitrary labelling of the
3314-
groundset by `{0,\dots,n-1}` is chosen.
3316+
groundset by `{0,\ldots,n-1}` is chosen.
33153317
33163318
.. SEEALSO::
33173319
@@ -3358,7 +3360,7 @@ cdef class Matroid(SageObject):
33583360
33593361
over all independent sets `I` of the matroid. Here `e_i` are
33603362
the standard basis vectors of `\RR^n`. An arbitrary labelling
3361-
of the groundset by `{0,\dots,n-1}` is chosen.
3363+
of the groundset by `{0,\ldots,n-1}` is chosen.
33623364
33633365
.. SEEALSO::
33643366

0 commit comments

Comments
 (0)