Skip to content
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

matroids: Declare function input and return types #38057

Merged
merged 13 commits into from
Jun 9, 2024
4 changes: 3 additions & 1 deletion src/sage/algebras/orlik_solomon.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,9 @@ class OrlikSolomonAlgebra(CombinatorialFreeModule):
14
sage: G = OS.algebra_generators()
sage: M.broken_circuits()
frozenset({frozenset({1, 2, 3})})
SetSystem of 1 sets over 4 elements
sage: M.broken_circuits()[0]
frozenset({1, 2, 3})
sage: G[1] * G[2] * G[3]
OS{0, 1, 2} - OS{0, 1, 3} + OS{0, 2, 3}

Expand Down
2 changes: 1 addition & 1 deletion src/sage/geometry/hyperplane_arrangement/arrangement.py
Original file line number Diff line number Diff line change
Expand Up @@ -1951,7 +1951,7 @@ def skip(b_list):
lhs = matrix(R, d, d)
rhs = vector(R, d)
vertices = set()
for indices in M.independent_r_sets(d):
for indices in M.independent_k_sets(d):
for row, i in enumerate(indices):
lhs[row] = A_list[i]
b_list = [b_list_list[i] for i in indices]
Expand Down
7 changes: 3 additions & 4 deletions src/sage/matroids/advanced.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
r"""
Advanced matroid functionality.
Advanced matroid functionality

This module collects a number of advanced functions which are not directly
available to the end user by default. To import them into the main namespace,
Expand Down Expand Up @@ -49,6 +49,7 @@

- Stefan van Zwam (2013-04-01): initial version
"""

import sage.matroids.matroid
import sage.matroids.basis_exchange_matroid
from .minor_matroid import MinorMatroid
Expand All @@ -63,6 +64,4 @@
from . import lean_matrix
from .extension import LinearSubclasses, MatroidExtensions
from .union_matroid import MatroidUnion, MatroidSum, PartitionMatroid

from sage.misc.lazy_import import lazy_import
lazy_import('sage.matroids.graphic_matroid', 'GraphicMatroid')
from .graphic_matroid import GraphicMatroid
gmou3 marked this conversation as resolved.
Show resolved Hide resolved
2 changes: 0 additions & 2 deletions src/sage/matroids/all.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,5 @@
install_doc(__package__, __doc__)

from sage.misc.lazy_import import lazy_import
# from constructor import Matroid
# import matroids_catalog as matroids
lazy_import('sage.matroids.constructor', 'Matroid')
lazy_import('sage.matroids', 'matroids_catalog', 'matroids')
51 changes: 23 additions & 28 deletions src/sage/matroids/basis_exchange_matroid.pxd
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
from sage.data_structures.bitset cimport *
from sage.data_structures.bitset_base cimport bitset_t, bitset_s

from sage.matroids.matroid cimport Matroid
from sage.matroids.set_system cimport SetSystem
from .matroid cimport Matroid
from .set_system cimport SetSystem

cdef class BasisExchangeMatroid(Matroid):
cdef long _groundset_size, _matroid_rank, _bitset_size
Expand Down Expand Up @@ -38,47 +37,43 @@ cdef class BasisExchangeMatroid(Matroid):

cdef bint _set_current_basis(self, F) noexcept

cpdef groundset(self)
cpdef groundset_list(self)
cpdef frozenset groundset(self)
cpdef list groundset_list(self)
cpdef full_rank(self)
cpdef full_corank(self)

cpdef basis(self)
cpdef _move_current_basis(self, X, Y)

cpdef _max_independent(self, F)
cpdef _rank(self, F)
cpdef _circuit(self, F)
cpdef _fundamental_circuit(self, B, e)
cpdef _closure(self, F)
cpdef frozenset _max_independent(self, frozenset F)
cpdef int _rank(self, frozenset F)
cpdef frozenset _circuit(self, frozenset F)
cpdef frozenset _fundamental_circuit(self, frozenset B, e)
cpdef frozenset _closure(self, frozenset F)

cpdef _max_coindependent(self, F)
cpdef _corank(self, F)
cpdef _cocircuit(self, F)
cpdef _fundamental_cocircuit(self, B, e)
cpdef _coclosure(self, F)
cpdef frozenset _max_coindependent(self, frozenset F)
cpdef int _corank(self, frozenset F)
cpdef frozenset _cocircuit(self, frozenset F)
cpdef frozenset _fundamental_cocircuit(self, frozenset B, e)
cpdef frozenset _coclosure(self, frozenset F)

cpdef _augment(self, X, Y)
cpdef _is_independent(self, F)
cpdef frozenset _augment(self, frozenset X, frozenset Y)
cpdef bint _is_independent(self, frozenset F)

cpdef whitney_numbers2(self)
cpdef list whitney_numbers2(self)
cdef _whitney_numbers2_rec(self, object f_vec, bitset_t* flats, bitset_t* todo, long elt, long rnk)
cpdef flats(self, R)
cdef _flats_rec(self, SetSystem Rflats, long R, bitset_t* flats, bitset_t* todo, long elt, long rnk)
cpdef coflats(self, R)
cdef _coflats_rec(self, SetSystem Rcoflats, long R, bitset_t* coflats, bitset_t* todo, long elt, long cornk)
cdef _flat_element_inv(self, long k)
cdef _flat_element_inv_rec(self, object f_inc, long R, bitset_t* flats, bitset_t* todo, long elt, long i)

cpdef bases_count(self)
cpdef independent_r_sets(self, long r)
cpdef bases(self)
cpdef dependent_r_sets(self, long r)
cpdef nonbases(self)
cpdef SetSystem independent_k_sets(self, long k)
cpdef SetSystem dependent_k_sets(self, long k)

cpdef nonspanning_circuits(self)
cpdef cocircuits(self)
cpdef circuits(self)
cpdef SetSystem nonspanning_circuits(self)
cpdef SetSystem cocircuits(self)
cpdef SetSystem circuits(self, k=*)

cpdef _characteristic_setsystem(self)
cpdef _weak_invariant(self)
Expand All @@ -95,6 +90,6 @@ cdef class BasisExchangeMatroid(Matroid):
cpdef _is_isomorphism(self, other, morphism)
cdef bint __is_isomorphism(self, BasisExchangeMatroid other, morphism) noexcept

cpdef is_valid(self)
cpdef bint is_valid(self)

cdef bint nxksrd(bitset_s *b, long n, long k, bint succ) noexcept
Loading
Loading