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

Commit

Permalink
Remove category, merge method degree_on_basis into the class
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthias Koeppe committed Jun 6, 2020
1 parent 7ae0c7e commit 37aae77
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 58 deletions.
52 changes: 0 additions & 52 deletions src/sage/categories/polyhedra_modules.py

This file was deleted.

50 changes: 44 additions & 6 deletions src/sage/geometry/polyhedron/modules/formal_polyhedra_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
from sage.combinat.free_module import CombinatorialFreeModule
from sage.modules.with_basis.subquotient import SubmoduleWithBasis, QuotientModuleWithBasis
from sage.categories.graded_modules_with_basis import GradedModulesWithBasis
from sage.categories.polyhedra_modules import PolyhedraModules

class FormalPolyhedraModule(CombinatorialFreeModule):
r"""
Expand All @@ -18,12 +17,12 @@ class FormalPolyhedraModule(CombinatorialFreeModule):
INPUT:
- ``base_ring`` - base ring of the module; unrelated to the
base ring of the polyhedra
- ``base_ring`` -- base ring of the module; unrelated to the
base ring of the polyhedra
- ``dimension`` - the ambient dimension of the polyhedra
- ``dimension`` -- the ambient dimension of the polyhedra
- ``basis`` - the basis
- ``basis`` -- the basis
EXAMPLES::
Expand Down Expand Up @@ -86,7 +85,7 @@ def __classcall__(cls, base_ring, dimension, basis, category=None):
if isinstance(basis, list):
basis = tuple(basis)
if category is None:
category = PolyhedraModules(base_ring) & GradedModulesWithBasis(base_ring)
category = GradedModulesWithBasis(base_ring)
return super(FormalPolyhedraModule, cls).__classcall__(cls,
base_ring=base_ring,
dimension=dimension,
Expand All @@ -98,3 +97,42 @@ def __init__(self, base_ring, dimension, basis, category):
Construct a free module generated by the polyhedra in ``basis``.
"""
super(FormalPolyhedraModule, self).__init__(base_ring, basis, prefix="", category=category)

def degree_on_basis(self, m):
r"""
The degree of an element of the basis is defined as the dimension of the polyhedron.
INPUT:
- ``m`` -- an element of the basis (a polyhedron)
EXAMPLES::
sage: from sage.geometry.polyhedron.modules.formal_polyhedra_module import FormalPolyhedraModule
sage: def closed_interval(a,b): return Polyhedron(vertices=[[a], [b]])
sage: I01 = closed_interval(0, 1); I01.rename("conv([0], [1])")
sage: I11 = closed_interval(1, 1); I11.rename("{[1]}")
sage: I12 = closed_interval(1, 2); I12.rename("conv([1], [2])")
sage: I02 = closed_interval(0, 2); I02.rename("conv([0], [2])")
sage: M = FormalPolyhedraModule(QQ, 1, basis=[I01, I11, I12, I02])
We can extract homogeneous components::
sage: O = M(I01) + M(I11) + M(I12)
sage: O.homogeneous_component(0)
[{[1]}]
sage: O.homogeneous_component(1)
[conv([0], [1])] + [conv([1], [2])]
We note that modulo the linear relations of polyhedra, this is only a filtration,
not a grading, as the following example shows.
sage: X = M(I01) + M(I12) - M(I02)
sage: X.degree()
1
sage: Y = M(I11)
sage: Y.degree()
0
"""
return m.dimension()

0 comments on commit 37aae77

Please sign in to comment.