#18758: Allow actions of a parent on itself
-------------------------------------+------------------------
Reporter: SimonKing | Owner:
Type: enhancement | Status: new
Priority: major | Milestone: sage-6.8
Component: coercion | Resolution:
Keywords: actions on itself | Merged in:
Authors: | Reviewers:
Report Upstream: N/A | Work issues:
Branch: | Commit:
Dependencies: #18756 | Stopgaps:
-------------------------------------+------------------------
Comment (by SimonKing):
Remark: `Magmas.ElementMethods` does provide a generic multiplication
using `_mul_` (when present) and using coercion otherwise.
Two problems: There is an import statement in the multiplication method,
which, if I recall correctly, is not for free. And it first checks the
presence of a `_mul_` attribute, which also slows things down.
So, it would be interesting to see if the following approach yields faster
code:
- ALL element classes should have generic `__mul__` and `__add__` methods.
Those of `sage.structure.elements.Element` will just rely on coercion,
whereas `ModuleElement` and `RingElement` first try a short-cut via
`_mul_` resp. `_add_`. So, the hierarchy of algebraic base classes would
be reflected in the usage of shortcuts.
- The proposed actions `MagmaStructure` and `AdditiveMagmaStructure`
should test the presence of the attributes `_mul_` resp. `_add_` during
initialisation, ONCE. Henceforth, the presence of the attribute does not
need to be tested any longer.
So, rather than providing a `__mul__` methods, `Magmas()` would provide an
action, and there should be a `__mul__` method for Element instead.
Really, we need to test and get timings.
--
Ticket URL: <http://trac.sagemath.org/ticket/18758#comment:5>
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.