Skip to content

micro details in pyx files in matroids #39971

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 29, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/sage/matroids/graphic_matroid.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -650,7 +650,7 @@ cdef class GraphicMatroid(Matroid):
DS_vertices = DisjointSet_of_hashables(all_vertices)
for u, v, l in not_our_edges:
DS_vertices.union(u, v)
return len(X) - (DS_vertices.number_of_subsets() - Integer(1))
return len(X) - (DS_vertices.number_of_subsets() - 1)

cpdef bint _is_circuit(self, frozenset X) noexcept:
"""
Expand Down Expand Up @@ -1699,9 +1699,9 @@ cdef class GraphicMatroid(Matroid):
# If a vertex has degree 1, or 2, or 3, we already handled it.
for u in vertices:
if G.degree(u) > 3:
elts_incident = [l for (_, _, l) in G.edges_incident(u)]
elts_incident = [l for _, _, l in G.edges_incident(u)]
x = elts_incident.pop()
for i in range(1, (len(elts_incident) - Integer(1))):
for i in range(1, len(elts_incident) - 1):
groups = combinations(elts_incident, i)
for g in groups:
g = list(g)
Expand Down
10 changes: 5 additions & 5 deletions src/sage/matroids/lean_matrix.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -208,9 +208,9 @@ cdef class LeanMatrix:
sage: A.base_ring()
Traceback (most recent call last):
...
NotImplementedError: subclasses need to implement this.
NotImplementedError: subclasses need to implement this
"""
raise NotImplementedError("subclasses need to implement this.")
raise NotImplementedError("subclasses need to implement this")

cpdef characteristic(self):
"""
Expand Down Expand Up @@ -357,7 +357,7 @@ cdef class LeanMatrix:
and compatible dimensions.
"""
cdef LeanMatrix A = type(self)(self.nrows(), other.ncols())
cdef i, j, k
cdef long i, j, k
for i in range(self.nrows()):
for j in range(other.ncols()):
for k in range(self.ncols()):
Expand Down Expand Up @@ -487,9 +487,9 @@ cdef class LeanMatrix:
sage: A == loads(dumps(A)) # indirect doctest
Traceback (most recent call last):
...
NotImplementedError: subclasses need to implement this.
NotImplementedError: subclasses need to implement this
"""
raise NotImplementedError("subclasses need to implement this.")
raise NotImplementedError("subclasses need to implement this")

cdef shifting_all(self, P_rows, P_cols, Q_rows, Q_cols, int m):
r"""
Expand Down
8 changes: 4 additions & 4 deletions src/sage/matroids/linear_matroid.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -878,8 +878,8 @@ cdef class LinearMatroid(BasisExchangeMatroid):
try:
if GF2_not_defined:
GF2 = GF(2)
GF2_zero = GF2(0)
GF2_one = GF2(1)
GF2_zero = GF2.zero()
GF2_one = GF2.one()
GF2_not_defined = False
except ImportError:
pass
Expand Down Expand Up @@ -3099,8 +3099,8 @@ cdef class BinaryMatroid(LinearMatroid):
global GF2, GF2_zero, GF2_one, GF2_not_defined
if GF2_not_defined:
GF2 = GF(2)
GF2_zero = GF2(0)
GF2_one = GF2(1)
GF2_zero = GF2.zero()
GF2_one = GF2.one()
GF2_not_defined = False

# Setup representation; construct displayed basis
Expand Down
4 changes: 2 additions & 2 deletions src/sage/matroids/matroid.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -7933,8 +7933,8 @@ cdef class Matroid(SageObject):
a = x
b = y
R = ZZ['x, y']
x, y = R._first_ngens(2)
T = R(0)
x, y = R.gens()
T = R.zero()
for B in self.bases_iterator():
T += x ** len(self._internal(B)) * y ** len(self._external(B))
if a is not None and b is not None:
Expand Down
Loading