You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The base class Ring defines base_extend(), but the implementation needs to be overridden in the derived class MPolynomialRing:
sage: sage: P.<x,y,z> = PolynomialRing(QQ,'x, y, z'); P
Multivariate Polynomial Ring in x, y, z over Rational Field
sage: P.base_extend(CC)
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
/home/vbraun/opt/sage-4.5.3/devel/sage-main/<ipython console> in <module>()
/home/vbraun/Sage/sage/local/lib/python2.6/site-packages/sage/rings/ring.so in sage.rings.ring.Ring.base_extend (sage/rings/ring.c:3190)()
TypeError: no base extension defined
The patch implements the override and adds documentation.
I am not quite sure it is the right approach. It seems to me that we have two methods: change_ring that constructs "the same object but over different ring" and base_extend which does the same, but only if there is a natural coercion. Given this description, it seems to me that there should be only one implementation of base_extend in the base class:
def base_extend(self, R):
if R.has_coerce_map(self.base_ring()):
return self.change_ring(R)
else:
raise TypeError("%s cannot be extened to %s!" % (self.base_ring(), R))
and then each derived class should implement change_ring only. (If the detailed error message breaks a lot of doctests I am fine with keeping the current one.) Thoughts?
There is also discrepancy between actual argument names and their description in documentation (base_ring vs. R).
The base
class Ring
definesbase_extend()
, but the implementation needs to be overridden in the derived classMPolynomialRing
:The patch implements the override and adds documentation.
CC: @novoselt @nilesjohnson
Component: commutative algebra
Author: Volker Braun
Issue created by migration from https://trac.sagemath.org/ticket/9902
The text was updated successfully, but these errors were encountered: