#10667: Morphisms and Objects of Categories
----------------------------------+-----------------------------------------
Reporter: SimonKing | Owner: nthiery
Type: enhancement | Status: needs_work
Priority: major | Milestone: sage-5.0
Component: categories | Keywords: objects morphisms
containment
Work_issues: Cartesian products | Upstream: N/A
Reviewer: | Author: Simon King
Merged: | Dependencies: #9138, #11115, #11780
----------------------------------+-----------------------------------------
Comment(by SimonKing):
Replying to [comment:52 nthiery]:
> I am glad that UniqueRepresentation works well :-)
I am not 100% certain that they work well. At least for getting the tests
of elliptic curves pass, we probably need #11670 (uniqueness of number
fields). And note that (currently) I only introduce `UniqueRepresentation`
to homsets of rings. I did not try to have it for all parents.
> Agreed, the more unique parents, the better. But you don't have to fix
> all of Sage misfeatures in just this patch :-)
But all that were uncovered by new tests introduced with this patch.
> Besides, I am still not yet sure that we want to strictly enforce 100%
> unique parents. There might be occasional exceptions -- I don't know,
> things like temporarily created parents or what not -- where we might
> want to not have uniqueness.
Why would one not want uniqueness for temporarily created parents? When
the same parent is frequently created, then it is more efficient to just
use a cache. Or are you concerned that one creates too many different
parents that will stay in cache forever?
> Ok. I could see other use cases. Should this be a method of
> UniqueRepresentation -- of course still for internal use ?
No, what I just wrote can't be a method of `UniqueRepresentation`. Here is
the purpose of what I wrote: Let X be a ring;
`X._remove_from_homset_cache()` removes `Hom(X,Y)` and `Hom(Y,X)` from
cache, for any ring `Y`.
Hence, it is not `X.__class__.__classcall__.cache` that is cleared, but
`X.category().hom_category().parent_class.__classcall__.cache`. And an
item is removed from the cache not if X is the value of that item, but if
X appears in the key of the item.
But I think it would be a good idea to add a `X._reduce_from_cache()`
method to `UniqueRepresentation`: It would remove any item of
`X.__class__.__classcall__.cache` whose value is (equal to) X, and then it
would try `X._reduce_from_homset_cache()` as well (which would of course
only be available for rings).
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/10667#comment:53>
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.