#15947: Weaken types for _rmul_ and _lmul_
-------------------------------+------------------------
Reporter: tscrim | Owner: tscrim
Type: enhancement | Status: new
Priority: major | Milestone: sage-6.2
Component: coercion | Resolution:
Keywords: | Merged in:
Authors: | Reviewers:
Report Upstream: N/A | Work issues:
Branch: | Commit:
Dependencies: | Stopgaps:
-------------------------------+------------------------
Changes (by tscrim):
* cc: nthiery, nbruin, vbraun, SimonKing (added)
* author: Travis Scrimshaw =>
Comment:
The problem begins with `_rmul_()` and `_lmul_()` in (cython)
matrices/vectors/etc. take a `RingElement` as an argument. The issue is
that not all elements in rings inherit from `RingElement` (in fact, the
category framework says we shouldn't have to do this). So the `_lmul_()`
and `_rmul_()` error out and subsequently the attempt for coercion.
However, more and more I'm convincing myself that my proposal is not the
way to do things unless we want `Element` to have a default `_mul_`. Yet
we want to potentially let the categories give such an implementation. I'm
not quite sure what the best course of action is. Thoughts?
The problem can be seen with the following:
{{{
sage: m = SymmetricFunctions(QQ).m()
sage: M = matrix(m, [[m[1], m[2]],[m[1,1], m[1]]])
sage: M
[ m[1] m[2]]
[m[1, 1] m[1]]
sage: m[1,1] * M
---------------------------------------------------------------------------
TypeError Traceback (most recent call
last)
<ipython-input-5-e031e70d2f91> in <module>()
----> 1 m[Integer(1),Integer(1)] * M
/home/travis/sage/local/lib/python2.7/site-
packages/sage/categories/algebras.pyc in __mul__(self, right)
203 from sage.structure.element import get_coercion_model
204 import operator
--> 205 return get_coercion_model().bin_op(self, right,
operator.mul)
206
207 # __imul__ = __mul__
/home/travis/sage/local/lib/python2.7/site-
packages/sage/structure/coerce.so in
sage.structure.coerce.CoercionModel_cache_maps.bin_op
(sage/structure/coerce.c:8374)()
/home/travis/sage/local/lib/python2.7/site-
packages/sage/structure/coerce.so in
sage.structure.coerce.CoercionModel_cache_maps.bin_op
(sage/structure/coerce.c:8262)()
TypeError: unsupported operand parent(s) for '*': 'Symmetric Functions
over Rational Field in the monomial basis' and 'Full MatrixSpace of 2 by 2
dense matrices over Symmetric Functions over Rational Field in the
monomial basis'
}}}
So converting things to use `CombinatorialFreeModule` from old parents (in
particular, `FreeAlgebra`) breaks things that use to work.
--
Ticket URL: <http://trac.sagemath.org/ticket/15947#comment:1>
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.