Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
CombinatorialPolyhedralSets: Add element methods dim/dimension, subca…
Browse files Browse the repository at this point in the history
…tegory Finite with parent method dimension
  • Loading branch information
mkoeppe committed Aug 9, 2021
1 parent 6728fdc commit ced1988
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions src/sage/categories/combinatorial_polyhedral_sets.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@
# https://www.gnu.org/licenses/
# ****************************************************************************

from sage.misc.abstract_method import abstract_method
from sage.misc.cachefunc import cached_method
from .category_singleton import Category_singleton
from .category_with_axiom import CategoryWithAxiom
from .sets_cat import Sets

class CombinatorialPolyhedralSets(Category_singleton):
Expand Down Expand Up @@ -47,3 +49,38 @@ def super_categories(self):
[Category of sets]
"""
return [Sets()]

class ParentMethods:

pass


class ElementMethods:

@abstract_method
def dimension(self):
r"""
Return the dimension of the combinatorial polyhedron.
"""

def dim(self):
r"""
Return the dimension of the combinatorial polyhedron.
This is an alias for meth:`dimension`.
"""
return self.dimension()

class Finite(CategoryWithAxiom):
"""
Category of finite sets of combinatorial polyhedra.
"""

class ParentMethods:

@cached_method
def dimension(self):
r"""
Return the maximum dimension of the combinatorial polyhedra in ``self``.
"""
return max(c.dimension for c in self)

0 comments on commit ced1988

Please sign in to comment.