Hi! sage: M1 = MatrixSpace(GF(46301),4,4) sage: M2 = MatrixSpace(ZZ.quo(46301),4,4) sage: m1 = M1.random_element() sage: m2 = M2.random_element() sage: parent(m1*m2) is M2 True
We have sage: M1.has_coerce_map_from(M2) True but sage: M2.has_coerce_map_from(M1) False So, I think we should rather have that parent(m1*m2) is M1, right? First of all, m1 and m2 have a __mul__ method, that should instead be a _mul_ method (single underscore), according to the coercion model. Then, the right parent would be chosen automatically. But since the __mul__ method also covers the case of matrix times vector etc, the existing __mul__ method should be split into a _mul_ method and a _act_on_ method. Do people agree that this should be changed? Alternatively, one could modify the have_same_parents function that is used in the current __mul__ method (and many other methods of m1), so that coercion is taken into account. But I think the first solution is cleaner. Cheers, Simon -- To post to this group, send an email to sage-devel@googlegroups.com To unsubscribe from this group, send an email to sage-devel+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URL: http://www.sagemath.org