Skip to content

Commit

Permalink
Move matroid constructor
Browse files Browse the repository at this point in the history
From `constructor.py` to within the `Matroid` class in `matroid.pyx`.
  • Loading branch information
gmou3 committed Nov 2, 2024
1 parent 1b3f398 commit b4e5485
Show file tree
Hide file tree
Showing 16 changed files with 1,014 additions and 1,114 deletions.
4 changes: 2 additions & 2 deletions src/sage/geometry/hyperplane_arrangement/arrangement.py
Original file line number Diff line number Diff line change
Expand Up @@ -1902,7 +1902,7 @@ def vertices(self, exclude_sandwiched=False):
((0, 0), (0, 8), (8, 0), (8, 8))
"""
import itertools
from sage.matroids.constructor import Matroid
from sage.matroids.matroid import Matroid
R = self.parent().base_ring()
parallels = self._parallel_hyperplanes()
A_list = [parallel[0][1] for parallel in parallels]
Expand Down Expand Up @@ -3202,7 +3202,7 @@ def matroid(self):
if not self.is_central():
raise ValueError("the hyperplane arrangement must be central")
norms = [p.normal() for p in self]
from sage.matroids.constructor import Matroid
from sage.matroids.matroid import Matroid
return Matroid(matrix=matrix(norms).transpose())

def orlik_solomon_algebra(self, base_ring=None, ordering=None, **kwds):
Expand Down
2 changes: 1 addition & 1 deletion src/sage/graphs/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -9350,7 +9350,7 @@ def arboricity(self, certificate=False):
sage: g.arboricity(True) # needs sage.modules
(0, [])
"""
from sage.matroids.constructor import Matroid
from sage.matroids.matroid import Matroid
P = Matroid(self).partition()
if certificate:
return (len(P), [self.subgraph(edges=forest) for forest in P])
Expand Down
2 changes: 1 addition & 1 deletion src/sage/matroids/advanced.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
- :class:`RankMatroid <sage.matroids.rank_matroid.RankMatroid>`
Note that you can construct all of these through the
:func:`Matroid() <sage.matroids.constructor.Matroid>` function, which is
:class:`Matroid() <sage.matroids.matroid.Matroid>` class, which is
available on startup. Using the classes directly can sometimes be useful
for faster code (e.g. if your code calls ``Matroid()`` frequently).
Expand Down
2 changes: 1 addition & 1 deletion src/sage/matroids/all.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
install_doc(__package__, __doc__)

from sage.misc.lazy_import import lazy_import
lazy_import('sage.matroids.constructor', 'Matroid')
lazy_import('sage.matroids.matroid', 'Matroid')
lazy_import('sage.matroids', 'matroids_catalog', 'matroids')
del lazy_import
del install_doc
2 changes: 1 addition & 1 deletion src/sage/matroids/basis_matroid.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Construction
A ``BasisMatroid`` can be created from another matroid, from a list of bases,
or from a list of nonbases. For a full description of allowed inputs, see
:class:`below <sage.matroids.basis_matroid.BasisMatroid>`. It is recommended
to use the :func:`Matroid() <sage.matroids.constructor.Matroid>` function for
to use the :class:`Matroid() <sage.matroids.matroid.Matroid>` class for
easy construction of a ``BasisMatroid``. For direct access to the
``BasisMatroid`` constructor, run::
Expand Down
2 changes: 1 addition & 1 deletion src/sage/matroids/circuit_closures_matroid.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ A ``CircuitClosuresMatroid`` can be created from another matroid or from a
list of circuit-closures. For a full description of allowed inputs, see
:class:`below <sage.matroids.circuit_closures_matroid.CircuitClosuresMatroid>`.
It is recommended to use the
:func:`Matroid() <sage.matroids.constructor.Matroid>` function for a more
:class:`Matroid() <sage.matroids.matroid.Matroid>` class for a more
flexible construction of a ``CircuitClosuresMatroid``. For direct access to
the ``CircuitClosuresMatroid`` constructor, run::
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 @@ -8,8 +8,8 @@ as data.
A ``CircuitsMatroid`` can be created from another matroid or from a list of
circuits. For a full description of allowed inputs, see
:class:`below <sage.matroids.circuits_matroid.CircuitsMatroid>`. It is
recommended to use the :func:`Matroid() <sage.matroids.constructor.Matroid>`
function for a more flexible way of constructing a ``CircuitsMatroid`` and
recommended to use the :class:`Matroid() <sage.matroids.matroid.Matroid>`
class for a more flexible way of constructing a ``CircuitsMatroid`` and
other classes of matroids. For direct access to the ``CircuitsMatroid``
constructor, run::
Expand Down
Loading

0 comments on commit b4e5485

Please sign in to comment.