Ticket #10963: trac_10963-more_functorial_constructions-graded-modules-fix-nt.patch

File trac_10963-more_functorial_constructions-graded-modules-fix-nt.patch, 2.8 KB (added by nthiery, 7 years ago)
  • sage/categories/graded_modules.py

    # HG changeset patch
    # User Nicolas M. Thiery <nthiery@users.sf.net>
    # Date 1383074059 -3600
    #      Tue Oct 29 20:14:19 2013 +0100
    # Node ID e374533eb4a23dfff21146ffe4834ae93ca70769
    # Parent  599ab9a6bd8d8015fb6c6247fcfbd27912c9f0d3
    #10963: More functorial constructions (fix graded modules with basis)
    
    diff --git a/sage/categories/graded_modules.py b/sage/categories/graded_modules.py
    a b class GradedModules(GradedModulesCategor 
    134134        sage: TestSuite(GradedModules(ZZ)).run()
    135135    """
    136136
     137    def extra_super_categories(self):
     138        r"""
     139        Adds VectorSpaces to the super categories of ``self`` if the base ring is a field
     140
     141        EXAMPLES::
     142
     143            sage: Modules(QQ).Graded().extra_super_categories()
     144            [Category of vector spaces over Rational Field]
     145            sage: Modules(ZZ).Graded().extra_super_categories()
     146            []
     147
     148        This makes sure that ``Modules(QQ).Graded()`` returns an
     149        instance of :class:`GradedModules` and not a join category of
     150        an instance of this class and of ``VectorSpaces(QQ)``::
     151
     152            sage: type(Modules(QQ).Graded())
     153            <class 'sage.categories.graded_modules.GradedModules_with_category'>
     154
     155        .. TODO::
     156
     157            Get rid of this workaround once there is a more systematic
     158            approach for the alias ``Modules(QQ)`` -> ``VectorSpaces(QQ)``.
     159            Probably the later should be a category with axiom, and
     160            covariant constructions should play well with axioms.
     161        """
     162        from sage.categories.modules import Modules
     163        from sage.categories.fields import Fields
     164        base_ring = self.base_ring()
     165        if base_ring in Fields:
     166            return [Modules(base_ring)]
     167        else:
     168            return []
     169
    137170    class SubcategoryMethods:
    138171
    139172        @cached_method
  • sage/misc/c3_controlled.pyx

    diff --git a/sage/misc/c3_controlled.pyx b/sage/misc/c3_controlled.pyx
    a b For a typical category, few bases, if an 
    324324    sage: x.all_bases_len()
    325325    83
    326326    sage: x.all_bases_controlled_len()
    327     92
     327    90
    328328
    329329The following can be used to search through the Sage named categories
    330330for any that requires the addition of some bases; currently none!::
    for any that requires the addition of so 
    336336     Category of fields,
    337337     Category of finite dimensional algebras with basis over Rational Field,
    338338     Category of finite dimensional hopf algebras with basis over Rational Field,
    339      Category of graded algebras over Rational Field,
    340      Category of graded algebras with basis over Rational Field,
    341339     Category of graded hopf algebras with basis over Rational Field,
    342340     Category of hopf algebras with basis over Rational Field]
    343341