#14793: Unique representation for homsets
-------------------------------+--------------------------------------------
Reporter: nthiery | Owner: nthiery
Type: enhancement | Status: new
Priority: major | Milestone: sage-5.12
Component: categories | Resolution:
Keywords: | Work issues:
Report Upstream: N/A | Reviewers:
Authors: Simon King | Merged in:
Dependencies: | Stopgaps:
-------------------------------+--------------------------------------------
Comment (by SimonKing):
If I recall correctly, people do explicitly not want to use a cache (such
as: `UniqueRepresentation`) on modular symbols. They have some cache, but
make a point of being able to disable it.
Here is a minimal example, that fails when using a proper `__reduce__`
method for homsets:
{{{
sage:
sage.modular.hecke.morphism.is_HeckeModuleMorphism_matrix(ModularSymbols(6).hecke_operator(7).matrix_form().hecke_module_morphism())
True
sage: M = ModularSymbols(6)
sage: t = M.Hom(M)(matrix(QQ,3,3,srange(9)), name="spam"); t
Hecke module morphism spam defined by the matrix
[0 1 2]
[3 4 5]
[6 7 8]
Domain: Modular Symbols space of dimension 3 for Gamma_0(6) of
weight ...
Codomain: Modular Symbols space of dimension 3 for Gamma_0(6)
of weight ...
sage: t == loads(dumps(t))
True
}}}
The first line actually is important. With the first line, we get this
error in the last line:
{{{
Traceback (most recent call last)
<ipython-input-11-a4f55210dece> in <module>()
----> 1 t == loads(dumps(t))
/home/simon/SAGE/prerelease/sage-5.10.rc1/local/lib/python2.7/site-
packages/sage/structure/sage_object.so in sage.structure.sage_object.loads
(build/cythonized/sage/structure/sage_object.c:11044)()
/home/simon/SAGE/prerelease/sage-5.10.rc1/local/lib/python2.7/site-
packages/sage/categories/homset.pyc in Hom(X, Y, category)
289
290 # Determines the category
--> 291 cat_X = X.category()
292 cat_Y = Y.category()
293 if category is None:
/home/simon/SAGE/prerelease/sage-5.10.rc1/local/lib/python2.7/site-
packages/sage/modules/module.so in sage.modules.module.Module_old.category
(build/cythonized/sage/modules/module.c:1501)()
/home/simon/SAGE/prerelease/sage-5.10.rc1/local/lib/python2.7/site-
packages/sage/misc/classcall_metaclass.so in
sage.misc.classcall_metaclass.ClasscallMetaclass.__call__
(build/cythonized/sage/misc/classcall_metaclass.c:1224)()
/home/simon/SAGE/prerelease/sage-5.10.rc1/local/lib/python2.7/site-
packages/sage/categories/modules.pyc in __classcall_private__(cls,
base_ring, dispatch)
106 if base_ring in _Fields:
107 return VectorSpaces(base_ring, check=False)
--> 108 result = super(Modules, cls).__classcall__(cls, base_ring)
109 result._reduction[2]['dispatch'] = False
110 return result
/home/simon/SAGE/prerelease/sage-5.10.rc1/local/lib/python2.7/site-
packages/sage/categories/category.pyc in __classcall__(cls, *args,
**options)
466 if isinstance(cls, DynamicMetaclass):
467 cls = cls.__base__
--> 468 return super(Category, cls).__classcall__(cls, *args,
**options)
469
470 def __init__(self, s=None):
/home/simon/SAGE/prerelease/sage-5.10.rc1/local/lib/python2.7/site-
packages/sage/misc/cachefunc.so in
sage.misc.cachefunc.WeakCachedFunction.__call__
(build/cythonized/sage/misc/cachefunc.c:5394)()
/home/simon/SAGE/prerelease/sage-5.10.rc1/local/lib/python2.7/site-
packages/sage/structure/unique_representation.pyc in __classcall__(cls,
*args, **options)
445
446 """
--> 447 instance = typecall(cls, *args, **options)
448 assert isinstance( instance, cls )
449 if instance.__class__.__reduce__ ==
CachedRepresentation.__reduce__:
/home/simon/SAGE/prerelease/sage-5.10.rc1/local/lib/python2.7/site-
packages/sage/misc/classcall_metaclass.so in
sage.misc.classcall_metaclass.typecall
(build/cythonized/sage/misc/classcall_metaclass.c:1586)()
/home/simon/SAGE/prerelease/sage-5.10.rc1/local/lib/python2.7/site-
packages/sage/categories/category_types.pyc in __init__(self, base, name)
324 def __init__(self, base, name=None):
325 from sage.categories.rings import Rings
--> 326 assert base in Rings(), "base must be a ring"
327 Category_over_base.__init__(self, base, name)
328
<type 'str'>: (<type 'exceptions.AttributeError'>,
AttributeError('ModularSymbolsAmbient_wt2_g0_with_category' object has no
attribute '_HeckeModule_generic__level',))
}}}
Hooray, we have a reproducible failure.
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/14793#comment:10>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/groups/opt_out.