#15618: Use the correct categories for coercion and conversion maps
-------------------------------------+-------------------------------------
Reporter: pbruin | Owner:
Type: defect | Status: needs_review
Priority: major | Milestone: sage-6.4
Component: coercion | Resolution:
Keywords: conversion map | Merged in:
Authors: Peter Bruin | Reviewers:
Report Upstream: N/A | Work issues:
Branch: | Commit:
u/pbruin/15618-DefaultConvertMap | 54a6ecae11f902b11ad651c67af021af6ed2da21
Dependencies: #16401, #16402, | Stopgaps:
#17364 |
-------------------------------------+-------------------------------------
Comment (by pbruin):
Replying to [comment:32 nbruin]:
> Just this line:
> {{{
> if
category.is_subcategory(FiniteDimensionalAlgebrasWithBasis(self.base_ring()))
> }}}
> is a memory leak:
[...]
> Admittedly:
> {{{
> sage: FiniteDimensionalAlgebra(GF(3), [Matrix([[1, 0], [0, 1]]),
Matrix([[0, 1], [0, 0]])]).category()
> Category of finite dimensional algebras with basis over Finite Field of
size 3
> }}}
> so the memory leak already exists for `FiniteDimensionalAlgebra` in
general. However, since you're introducing the line here, you should
probably argue why you're not making the problem worse and/or open a
ticket about the memory leak in general.
This change is necessary because otherwise we get errors if the provided
`category` (which is `SetsWithPartialMaps()` in some cases) is not a
subcategory of `FiniteDimensionalAlgebrasWithBasis(self.base_ring())`.
Logically, the choice whether the homset should be of type
`FiniteDimensionalAlgebraHomset` should depend on the category, not vice
versa.
This ticket does not make the memory leak (much) worse, because in most
cases `B` will be a `FiniteDimensionalAlgebra` anyway, in which case the
same category is constructed.
I also tested (using your example and in addition constructing
`A.coerce_map_from(GF(p))` for each `A` in the loop) that the current
branch does not cause additional memory leaks, and that the existing leak
is fixed by #17360 both before and after applying my branch. Thus the
alternative branch (comment:31) doesn't seem to be needed.
--
Ticket URL: <http://trac.sagemath.org/ticket/15618#comment:39>
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/d/optout.