Skip to content

Commit

Permalink
sagemathgh-37930: Work on CircuitsMatroid
Browse files Browse the repository at this point in the history
    
Various class-specific improvements. Implementation of enumerators (e.g.
`in/dependent_r_sets`) and `_closure`.
(The methods `bases`, `nonbases`, `circuit_closures`, `flats`, etc., are
now much faster.)

The changes in `matroid.pyx` are mostly for consistency's sake
(enumerators returning a `SetSystem`).
    
URL: sagemath#37930
Reported by: gmou3
Reviewer(s): gmou3, Travis Scrimshaw
  • Loading branch information
Release Manager committed May 12, 2024
2 parents 152b21d + fb657df commit 3aa85a8
Show file tree
Hide file tree
Showing 4 changed files with 390 additions and 167 deletions.
14 changes: 7 additions & 7 deletions src/sage/algebras/orlik_terao.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class OrlikTeraoAlgebra(CombinatorialFreeModule):
r"""
An Orlik-Terao algebra.
Let `R` be a commutative ring. Let `M` be a matroid with ground set
Let `R` be a commutative ring. Let `M` be a matroid with groundset
`X` with some fixed ordering and representation `A = (a_x)_{x \in X}`
(so `a_x` is a (column) vector). Let `C(M)` denote the set of circuits
of `M`. Let `P` denote the quotient algebra `R[e_x \mid x \in X] /
Expand Down Expand Up @@ -65,7 +65,7 @@ class OrlikTeraoAlgebra(CombinatorialFreeModule):
- ``R`` -- the base ring
- ``M`` -- the defining matroid
- ``ordering`` -- (optional) an ordering of the ground set
- ``ordering`` -- (optional) an ordering of the groundset
EXAMPLES:
Expand Down Expand Up @@ -164,7 +164,7 @@ def __init__(self, R, M, ordering=None):
self._broken_circuits[frozenset(L[1:])] = L[0]

cat = Algebras(R).FiniteDimensional().Commutative().WithBasis().Graded()
CombinatorialFreeModule.__init__(self, R, M.no_broken_circuits_sets(ordering),
CombinatorialFreeModule.__init__(self, R, list(M.no_broken_circuits_sets(ordering)),
prefix='OT', bracket='{',
sorting_key=self._sort_key,
category=cat)
Expand Down Expand Up @@ -252,7 +252,7 @@ def algebra_generators(self):
r"""
Return the algebra generators of ``self``.
These form a family indexed by the ground set `X` of `M`. For
These form a family indexed by the groundset `X` of `M`. For
each `x \in X`, the `x`-th element is `e_x`.
EXAMPLES::
Expand Down Expand Up @@ -323,7 +323,7 @@ def product_on_basis(self, a, b):
TESTS:
Let us check that `e_{s_1} e_{s_2} \cdots e_{s_k} = e_S` for any
subset `S = \{ s_1 < s_2 < \cdots < s_k \}` of the ground set::
subset `S = \{ s_1 < s_2 < \cdots < s_k \}` of the groundset::
sage: # needs sage.graphs
sage: G = Graph([[1,2],[1,2],[2,3],[3,4],[4,2]], multiedges=True)
Expand Down Expand Up @@ -355,11 +355,11 @@ def product_on_basis(self, a, b):
def subset_image(self, S):
r"""
Return the element `e_S` of ``self`` corresponding to a
subset ``S`` of the ground set of the defining matroid.
subset ``S`` of the groundset of the defining matroid.
INPUT:
- ``S`` -- a frozenset which is a subset of the ground set of `M`
- ``S`` -- a frozenset which is a subset of the groundset of `M`
EXAMPLES::
Expand Down
21 changes: 14 additions & 7 deletions src/sage/matroids/circuits_matroid.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,30 @@ from sage.matroids.matroid cimport Matroid
from sage.matroids.set_system cimport SetSystem

cdef class CircuitsMatroid(Matroid):
cdef frozenset _groundset # _E
cdef int _matroid_rank # _R
cdef SetSystem _C # circuits
cdef frozenset _groundset
cdef int _matroid_rank
cdef set _C # circuits
cdef dict _k_C # k-circuits (k=len)
cdef list _sorted_C_lens
cdef bint _nsc_defined
cpdef groundset(self)
cpdef _rank(self, X)
cpdef full_rank(self)
cpdef _is_independent(self, F)
cpdef _max_independent(self, F)
cpdef _circuit(self, F)
cpdef _is_independent(self, X)
cpdef _max_independent(self, X)
cpdef _circuit(self, X)
cpdef _closure(self, X)

# enumeration
cpdef bases(self)
cpdef nonbases(self)
cpdef independent_r_sets(self, long r)
cpdef dependent_r_sets(self, long r)
cpdef circuits(self, k=*)
cpdef nonspanning_circuits(self)
cpdef no_broken_circuits_sets(self, ordering=*)
cpdef no_broken_circuits_facets(self, ordering=*, reduced=*)
cpdef no_broken_circuits_sets(self, ordering=*, reduced=*)
cpdef broken_circuit_complex(self, ordering=*, reduced=*)

# properties
cpdef girth(self)
Expand Down
Loading

0 comments on commit 3aa85a8

Please sign in to comment.