#15303: Coercion discovery fails to be transitive
----------------------------+-------------------------
Reporter: nbruin | Owner:
Type: defect | Status: new
Priority: major | Milestone: sage-5.13
Component: coercion | Resolution:
Keywords: | Merged in:
Authors: | Reviewers:
Report Upstream: N/A | Work issues:
Branch: | Commit:
Dependencies: | Stopgaps:
----------------------------+-------------------------
Comment (by SimonKing):
I was thinking about "versioning" of the coercion graph as well. Perhaps
it would be worth trying.
The idea would be: We have one global variable, say, `cdef unsigned int
coerce_graph_version`. Whenever we create a node that is neither a sink
nor a source in the coerce graph, we increment the variable. This would be
cheap, a simple test in `.register_coercion()` and
`.register_embedding()`.
Instead of storing `None` when a coercion can not be found, we store the
current version. Hence, if we do `mor = self._coerce_from_hash[P]`, a
simple `isinstance(mor,int)` (or a faster version from the Python API that
tests if the type of `mor` is ''exactly'' `int`) will tell us whether the
absence of a coercion was cached. If `mor==coerce_graph_version` then we
know that the cached absence of a coercion is reliable. Otherwise, we need
to test.
Would this really be soooo expensive? I don't think so. Of course, it
depends on how often we create non-sink non-source nodes---and I doubt
that the combined use of `.register_embedding()` and
`.register_coercion()` (which is the only way to create non-sink non-
source) will happen very often.
So, I'd say we simply try.
--
Ticket URL: <http://trac.sagemath.org/ticket/15303#comment:4>
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.