Skip to content

Commit

Permalink
Change SetSystem representation
Browse files Browse the repository at this point in the history
  • Loading branch information
gmou3 committed Apr 29, 2024
1 parent c4363fc commit f1dc325
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/sage/matroids/basis_exchange_matroid.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -1923,7 +1923,7 @@ cdef class BasisExchangeMatroid(Matroid):
sage: M = matroids.catalog.N1()
sage: M._characteristic_setsystem()
Iterator over a system of subsets
SetSystem of 23 sets over 10 elements
sage: len(M._characteristic_setsystem())
23
"""
Expand Down
4 changes: 2 additions & 2 deletions src/sage/matroids/circuits_matroid.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,7 @@ cdef class CircuitsMatroid(Matroid):
sage: from sage.matroids.circuits_matroid import CircuitsMatroid
sage: M = CircuitsMatroid(matroids.Uniform(2, 4))
sage: M.circuits()
Iterator over a system of subsets
SetSystem of 4 sets over 4 elements
sage: list(M.circuits(0))
[]
sage: sorted(M.circuits(3), key=str)
Expand Down Expand Up @@ -544,7 +544,7 @@ cdef class CircuitsMatroid(Matroid):
sage: from sage.matroids.circuits_matroid import CircuitsMatroid
sage: M = CircuitsMatroid(matroids.Uniform(2, 4))
sage: M.nonspanning_circuits()
Iterator over a system of subsets
SetSystem of 0 sets over 4 elements
"""
cdef list NSC = []
for i in self._k_C:
Expand Down
12 changes: 6 additions & 6 deletions src/sage/matroids/set_system.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ cdef class SetSystem:
sage: M = matroids.catalog.Fano()
sage: M.circuits()
Iterator over a system of subsets
SetSystem of 14 sets over 7 elements
To access the sets in this structure, simply iterate over them. The
simplest way must be::
Expand Down Expand Up @@ -75,7 +75,7 @@ cdef class SetSystem:
sage: from sage.matroids.set_system import SetSystem
sage: S = SetSystem([1, 2, 3, 4], [[1, 2], [3, 4], [1, 2, 4]])
sage: S
Iterator over a system of subsets
SetSystem of 3 sets over 4 elements
"""
cdef long i
if not isinstance(groundset, tuple):
Expand Down Expand Up @@ -110,7 +110,7 @@ cdef class SetSystem:
sage: from sage.matroids.set_system import SetSystem
sage: S = SetSystem([1, 2, 3, 4], [[1, 2], [3, 4], [1, 2, 4]])
sage: S
Iterator over a system of subsets
SetSystem of 3 sets over 4 elements
sage: sorted(S[1])
[3, 4]
sage: for s in S: print(sorted(s))
Expand Down Expand Up @@ -138,7 +138,7 @@ cdef class SetSystem:
sage: from sage.matroids.set_system import SetSystem
sage: S = SetSystem([1, 2, 3, 4], [[1, 2], [3, 4], [1, 2, 4]])
sage: S
Iterator over a system of subsets
SetSystem of 3 sets over 4 elements
sage: len(S)
3
"""
Expand Down Expand Up @@ -196,9 +196,9 @@ cdef class SetSystem:
sage: from sage.matroids.set_system import SetSystem
sage: S = SetSystem([1, 2, 3, 4], [[1, 2], [3, 4], [1, 2, 4]])
sage: repr(S) # indirect doctest
'Iterator over a system of subsets'
'SetSystem of 3 sets over 4 elements'
"""
return "Iterator over a system of subsets"
return f'SetSystem of {self._len} sets over {self._groundset_size} elements'

cdef copy(self):
cdef SetSystem S
Expand Down
2 changes: 1 addition & 1 deletion src/sage/matroids/union_matroid.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ cdef class MatroidUnion(Matroid):
{}
Matroid of rank 1 on 2 elements with 2 bases
sage: M.bases()
Iterator over a system of subsets
SetSystem of 2 sets over 5 elements
sage: list(M.circuits())
[frozenset({3, 4})]
Expand Down
2 changes: 1 addition & 1 deletion src/sage/matroids/utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def setprint(X):
sage: from sage.matroids.advanced import setprint
sage: M = matroids.catalog.Fano().delete('efg')
sage: M.bases()
Iterator over a system of subsets
SetSystem of 3 sets over 4 elements
sage: setprint(M.bases())
[{'a', 'b', 'c'}, {'a', 'b', 'd'}, {'a', 'c', 'd'}]
Expand Down

0 comments on commit f1dc325

Please sign in to comment.