#11935: Make parent/element classes independent of base rings
----------------------------------------------------------------+-----------
Reporter: SimonKing |
Owner: nthiery
Type: enhancement |
Status: needs_work
Priority: major |
Milestone: sage-4.8
Component: categories |
Keywords: parent class, element class, category
Work_issues: Fix doctest in covariant functorial construction |
Upstream: N/A
Reviewer: |
Author: Simon King
Merged: |
Dependencies: #9138 #11900 #11943
----------------------------------------------------------------+-----------
Comment(by SimonKing):
The patch is not yet ready for publication, but in `L =
EllipticCurve('960d1').prove_BSD()` I see a speedup of nearly 25% compared
with #11900+#11943!
So, according to your suggestion, I add a _parent_class_from_bases and
_element_class_from_bases to Category, and use it for categories over base
and for bimodules.
However, there is a slight problem: You can not simply define
`parent_class = _parent_class_from_bases` if you want to have a real lazy
attribute. Namely, `parent_class` would believe that its name is
`_parent_class_from_bases`:
{{{
sage: class Foo(object):
....: @lazy_attribute
....: def _bar(self):
....: return 5
....: bar = _bar
....:
sage: f = Foo
sage: f.bar.__name__
'_bar'
}}}
In particular, it is not as fast as it should be. With the not-submitted
patch:
{{{
sage: C = Modules(GF(3),dispatch=False)
sage: %timeit p = C.parent_class
625 loops, best of 3: 69.4 µs per loop
sage: %timeit p = C._parent_class_from_bases
625 loops, best of 3: 440 ns per loop
}}}
But it might be possible to work around.
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/11935#comment:25>
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 post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sage-trac?hl=en.