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

Commit

Permalink
Trac #31669: add category of chain complexes to commutative_dga
Browse files Browse the repository at this point in the history
  • Loading branch information
mjungmath committed Apr 18, 2021
1 parent 6988be0 commit 718d354
Showing 1 changed file with 21 additions and 12 deletions.
33 changes: 21 additions & 12 deletions src/sage/algebras/commutative_dga.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@
from sage.misc.inherit_comparison import InheritComparisonClasscallMetaclass
from sage.misc.functional import is_odd, is_even
from sage.misc.misc_c import prod
from sage.categories.chain_complexes import ChainComplexes
from sage.categories.algebras import Algebras
from sage.categories.morphism import Morphism
from sage.categories.modules import Modules
Expand Down Expand Up @@ -545,6 +546,8 @@ def cohomology(self, n):
sorting_key=sorting_keys,
monomial_reverse=True)

homology = cohomology

def _is_nonzero(self):
"""
Return ``True`` iff this morphism is nonzero.
Expand Down Expand Up @@ -837,6 +840,8 @@ def cohomology(self, n, total=False):
sorting_key=sorting_keys,
monomial_reverse=True)

homology = cohomology


###########################################################
# Commutative graded algebras
Expand Down Expand Up @@ -896,7 +901,7 @@ class GCAlgebra(UniqueRepresentation, QuotientRing_nc):
"""
# TODO: This should be a __classcall_private__?
@staticmethod
def __classcall__(cls, base, names=None, degrees=None, R=None, I=None):
def __classcall__(cls, base, names=None, degrees=None, R=None, I=None, category=None):
r"""
Normalize the input for the :meth:`__init__` method and the
unique representation.
Expand Down Expand Up @@ -995,9 +1000,10 @@ def __classcall__(cls, base, names=None, degrees=None, R=None, I=None):
side='twosided')

return super(GCAlgebra, cls).__classcall__(cls, base=base, names=names,
degrees=degrees, R=R, I=I)
degrees=degrees, R=R, I=I,
category=category)

def __init__(self, base, R=None, I=None, names=None, degrees=None):
def __init__(self, base, R=None, I=None, names=None, degrees=None, category=None):
"""
Initialize ``self``.
Expand Down Expand Up @@ -1027,8 +1033,9 @@ def __init__(self, base, R=None, I=None, names=None, degrees=None):
sage: TestSuite(A).run()
"""
self._degrees = tuple(degrees)
cat = Algebras(R.base_ring()).Graded()
QuotientRing_nc.__init__(self, R, I, names, category=cat)
if category is None:
category = Algebras(R.base_ring()).Graded()
QuotientRing_nc.__init__(self, R, I, names, category=category)

def _repr_(self):
"""
Expand Down Expand Up @@ -1660,7 +1667,7 @@ class GCAlgebra_multigraded(GCAlgebra):
sage: c.degree(total=True)
2
"""
def __init__(self, base, degrees, names=None, R=None, I=None):
def __init__(self, base, degrees, names=None, R=None, I=None, category=None):
"""
Initialize ``self``.
Expand All @@ -1674,7 +1681,8 @@ def __init__(self, base, degrees, names=None, R=None, I=None):
sage: TestSuite(C).run()
"""
total_degs = [total_degree(d) for d in degrees]
GCAlgebra.__init__(self, base, R=R, I=I, names=names, degrees=total_degs)
GCAlgebra.__init__(self, base, R=R, I=I, names=names,
degrees=total_degs, category=category)
self._degrees_multi = degrees
self._grading_rank = len(list(degrees[0]))

Expand Down Expand Up @@ -2001,10 +2009,10 @@ def __init__(self, A, differential):
...
ValueError: The given dictionary does not determine a valid differential
"""
cat = Algebras(A.base()).Graded() & ChainComplexes(A.base())
GCAlgebra.__init__(self, A.base(), names=A._names,
degrees=A._degrees,
R=A.cover_ring(),
I=A.defining_ideal())
degrees=A._degrees, R=A.cover_ring(),
I=A.defining_ideal(), category=cat)
self._differential = Differential(self, differential._dic_)
self._minimalmodels = {}
self._numerical_invariants = {}
Expand Down Expand Up @@ -3071,10 +3079,11 @@ def __init__(self, A, differential):
...
ValueError: The differential does not have a well-defined degree
"""
cat = Algebras(A.base()).Graded() & ChainComplexes(A.base())
GCAlgebra_multigraded.__init__(self, A.base(), names=A._names,
degrees=A._degrees_multi,
R=A.cover_ring(),
I=A.defining_ideal())
R=A.cover_ring(), I=A.defining_ideal(),
category=cat)
self._differential = Differential_multigraded(self, differential._dic_)

def _base_repr(self):
Expand Down

0 comments on commit 718d354

Please sign in to comment.