summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeroen Demeyer <jdemeyer@cage.ugent.be>2017-06-06 20:33:11 +0200
committerJeroen Demeyer <jdemeyer@cage.ugent.be>2017-06-06 22:28:03 +0200
commit8f294308f8b85b233ffdc9df3f20c404ee6431c9 (patch)
tree1ec485bb841f1a370a2ccd62d48ab3e0fc4e7cac
parentUpdated SageMath version to 8.0.beta9 (diff)
_lmul_ and _rmul_: scalar should be Element instead of RingElement
-rw-r--r--src/sage/algebras/letterplace/free_algebra_element_letterplace.pxd5
-rw-r--r--src/sage/algebras/letterplace/free_algebra_element_letterplace.pyx4
-rw-r--r--src/sage/algebras/quatalg/quaternion_algebra_element.pyx4
-rw-r--r--src/sage/interfaces/gap.py5
-rw-r--r--src/sage/matrix/matrix0.pyx5
-rw-r--r--src/sage/matrix/matrix_cyclo_dense.pyx2
-rw-r--r--src/sage/matrix/matrix_gf2e_dense.pyx2
-rw-r--r--src/sage/matrix/matrix_gfpn_dense.pyx2
-rw-r--r--src/sage/matrix/matrix_integer_dense.pyx3
-rw-r--r--src/sage/matrix/matrix_integer_sparse.pyx2
-rw-r--r--src/sage/matrix/matrix_modn_dense_template.pxi2
-rw-r--r--src/sage/matrix/matrix_rational_dense.pyx2
-rw-r--r--src/sage/matrix/matrix_rational_sparse.pyx2
-rw-r--r--src/sage/matrix/matrix_sparse.pyx2
-rw-r--r--src/sage/modular/pollack_stevens/dist.pyx2
-rw-r--r--src/sage/modules/free_module_element.pyx8
-rw-r--r--src/sage/modules/vector_double_dense.pyx5
-rw-r--r--src/sage/modules/vector_integer_dense.pyx4
-rw-r--r--src/sage/modules/vector_mod2_dense.pyx2
-rw-r--r--src/sage/modules/vector_modn_dense.pyx2
-rw-r--r--src/sage/modules/vector_rational_dense.pyx5
-rw-r--r--src/sage/modules/with_basis/indexed_element.pxd4
-rw-r--r--src/sage/modules/with_basis/indexed_element.pyx4
-rw-r--r--src/sage/numerical/linear_functions.pyx2
-rw-r--r--src/sage/numerical/linear_tensor_element.pyx4
-rw-r--r--src/sage/quivers/algebra_elements.pyx4
-rw-r--r--src/sage/rings/laurent_series_ring_element.pyx4
-rw-r--r--src/sage/rings/number_field/number_field_element_quadratic.pyx11
-rw-r--r--src/sage/rings/polynomial/laurent_polynomial.pyx8
-rw-r--r--src/sage/rings/polynomial/multi_polynomial_libsingular.pyx2
-rw-r--r--src/sage/rings/polynomial/pbori.pyx2
-rw-r--r--src/sage/rings/polynomial/plural.pyx2
-rw-r--r--src/sage/rings/polynomial/polynomial_element.pyx8
-rw-r--r--src/sage/rings/polynomial/polynomial_integer_dense_flint.pyx7
-rw-r--r--src/sage/rings/polynomial/polynomial_integer_dense_ntl.pyx8
-rw-r--r--src/sage/rings/polynomial/polynomial_modn_dense_ntl.pyx10
-rw-r--r--src/sage/rings/polynomial/polynomial_rational_flint.pyx4
-rw-r--r--src/sage/rings/polynomial/polynomial_real_mpfr_dense.pyx2
-rw-r--r--src/sage/rings/polynomial/polynomial_template.pxi2
-rw-r--r--src/sage/rings/polynomial/polynomial_zz_pex.pyx2
-rw-r--r--src/sage/rings/polynomial/skew_polynomial_element.pyx4
-rw-r--r--src/sage/rings/power_series_mpoly.pyx4
-rw-r--r--src/sage/rings/power_series_pari.pyx4
-rw-r--r--src/sage/rings/power_series_poly.pyx4
-rw-r--r--src/sage/structure/coerce_actions.pyx31
-rw-r--r--src/sage/structure/element.pxd4
-rw-r--r--src/sage/structure/element.pyx4
47 files changed, 106 insertions, 109 deletions
diff --git a/src/sage/algebras/letterplace/free_algebra_element_letterplace.pxd b/src/sage/algebras/letterplace/free_algebra_element_letterplace.pxd
index 1304fd5..fa7df06 100644
--- a/src/sage/algebras/letterplace/free_algebra_element_letterplace.pxd
+++ b/src/sage/algebras/letterplace/free_algebra_element_letterplace.pxd
@@ -7,12 +7,9 @@
#
###############################################################################
-cdef class FreeAlgebraElement_letterplace
-
-from sage.structure.element cimport AlgebraElement, ModuleElement, RingElement, Element
+from sage.structure.element cimport AlgebraElement, ModuleElement, Element
from sage.rings.polynomial.multi_polynomial_libsingular cimport MPolynomialRing_libsingular, MPolynomial_libsingular
from sage.algebras.letterplace.free_algebra_letterplace cimport FreeAlgebra_letterplace
cdef class FreeAlgebraElement_letterplace(AlgebraElement):
cdef MPolynomial_libsingular _poly
-
diff --git a/src/sage/algebras/letterplace/free_algebra_element_letterplace.pyx b/src/sage/algebras/letterplace/free_algebra_element_letterplace.pyx
index 219c355..9e29154 100644
--- a/src/sage/algebras/letterplace/free_algebra_element_letterplace.pyx
+++ b/src/sage/algebras/letterplace/free_algebra_element_letterplace.pyx
@@ -555,7 +555,7 @@ cdef class FreeAlgebraElement_letterplace(AlgebraElement):
right._poly = A._current_ring(right._poly)
return FreeAlgebraElement_letterplace(self._parent,self._poly-right._poly,check=False)
- cpdef _lmul_(self, RingElement right):
+ cpdef _lmul_(self, Element right):
"""
Multiplication from the right with an element of the base ring.
@@ -569,7 +569,7 @@ cdef class FreeAlgebraElement_letterplace(AlgebraElement):
"""
return FreeAlgebraElement_letterplace(self._parent,self._poly._lmul_(right),check=False)
- cpdef _rmul_(self, RingElement left):
+ cpdef _rmul_(self, Element left):
"""
Multiplication from the left with an element of the base ring.
diff --git a/src/sage/algebras/quatalg/quaternion_algebra_element.pyx b/src/sage/algebras/quatalg/quaternion_algebra_element.pyx
index a891280..09d59c2 100644
--- a/src/sage/algebras/quatalg/quaternion_algebra_element.pyx
+++ b/src/sage/algebras/quatalg/quaternion_algebra_element.pyx
@@ -524,7 +524,7 @@ cdef class QuaternionAlgebraElement_abstract(AlgebraElement):
"""
return ~self.reduced_norm() * self.conjugate()
- cpdef _rmul_(self, RingElement left):
+ cpdef _rmul_(self, Element left):
"""
Return left*self, where left is in the base ring.
@@ -538,7 +538,7 @@ cdef class QuaternionAlgebraElement_abstract(AlgebraElement):
"""
return self.__class__(self._parent, (left*self[0], left*self[1], left*self[2], left*self[3]), check=False)
- cpdef _lmul_(self, RingElement right):
+ cpdef _lmul_(self, Element right):
"""
Return self*right, where right is in the base ring.
diff --git a/src/sage/interfaces/gap.py b/src/sage/interfaces/gap.py
index 4699c54..a828699 100644
--- a/src/sage/interfaces/gap.py
+++ b/src/sage/interfaces/gap.py
@@ -185,6 +185,7 @@ from sage.misc.superseded import deprecation
from sage.misc.cachefunc import cached_method
from sage.docs.instancedoc import instancedoc
from sage.interfaces.tab_completion import ExtraTabCompletion
+from sage.structure.element import ModuleElement
import re
import os
import pexpect
@@ -963,8 +964,10 @@ class Gap_generic(ExtraTabCompletion, Expect):
return self('%s.%s' % (record.name(), name))
+# We need to inherit from ModuleElement to support
+# sage.structure.coerce_actions.ModuleAction
@instancedoc
-class GapElement_generic(ExtraTabCompletion, ExpectElement):
+class GapElement_generic(ModuleElement, ExtraTabCompletion, ExpectElement):
r"""
Generic interface to the GAP3/GAP4 interpreters.
diff --git a/src/sage/matrix/matrix0.pyx b/src/sage/matrix/matrix0.pyx
index 762cb64..7ca5c00 100644
--- a/src/sage/matrix/matrix0.pyx
+++ b/src/sage/matrix/matrix0.pyx
@@ -4830,8 +4830,7 @@ cdef class Matrix(sage.structure.element.Matrix):
"""
return self.change_ring(self._base_ring.quotient_ring(p))
-
- cpdef _rmul_(self, RingElement left):
+ cpdef _rmul_(self, Element left):
"""
EXAMPLES::
@@ -4868,7 +4867,7 @@ cdef class Matrix(sage.structure.element.Matrix):
ans.set_unsafe(r, c, x * self.get_unsafe(r, c))
return ans
- cpdef _lmul_(self, RingElement right):
+ cpdef _lmul_(self, Element right):
"""
EXAMPLES:
diff --git a/src/sage/matrix/matrix_cyclo_dense.pyx b/src/sage/matrix/matrix_cyclo_dense.pyx
index e598561..b54fa78 100644
--- a/src/sage/matrix/matrix_cyclo_dense.pyx
+++ b/src/sage/matrix/matrix_cyclo_dense.pyx
@@ -559,7 +559,7 @@ cdef class Matrix_cyclo_dense(matrix_dense.Matrix_dense):
A._matrix = self._matrix - (<Matrix_cyclo_dense>right)._matrix
return A
- cpdef _lmul_(self, RingElement right):
+ cpdef _lmul_(self, Element right):
"""
Multiply a dense cyclotomic matrix by a scalar.
diff --git a/src/sage/matrix/matrix_gf2e_dense.pyx b/src/sage/matrix/matrix_gf2e_dense.pyx
index 5de99b5..43bf47b 100644
--- a/src/sage/matrix/matrix_gf2e_dense.pyx
+++ b/src/sage/matrix/matrix_gf2e_dense.pyx
@@ -633,7 +633,7 @@ cdef class Matrix_gf2e_dense(matrix_dense.Matrix_dense):
sig_off()
return ans
- cpdef _lmul_(self, RingElement right):
+ cpdef _lmul_(self, Element right):
"""
Return ``a*B`` for ``a`` an element of the base field.
diff --git a/src/sage/matrix/matrix_gfpn_dense.pyx b/src/sage/matrix/matrix_gfpn_dense.pyx
index ef8a070..345474e 100644
--- a/src/sage/matrix/matrix_gfpn_dense.pyx
+++ b/src/sage/matrix/matrix_gfpn_dense.pyx
@@ -1112,7 +1112,7 @@ cdef class Matrix_gfpn_dense(Matrix_dense):
raise ValueError("The matrix must not be empty")
return self._lmul_(self._base_ring(-1))
- cpdef _lmul_(self, RingElement right):
+ cpdef _lmul_(self, Element right):
"""
EXAMPLES::
diff --git a/src/sage/matrix/matrix_integer_dense.pyx b/src/sage/matrix/matrix_integer_dense.pyx
index 9c374e1..2bf7dad 100644
--- a/src/sage/matrix/matrix_integer_dense.pyx
+++ b/src/sage/matrix/matrix_integer_dense.pyx
@@ -871,8 +871,7 @@ cdef class Matrix_integer_dense(Matrix_dense):
sig_off()
return M
-
- cpdef _lmul_(self, RingElement right):
+ cpdef _lmul_(self, Element right):
"""
EXAMPLES::
diff --git a/src/sage/matrix/matrix_integer_sparse.pyx b/src/sage/matrix/matrix_integer_sparse.pyx
index bd4e0a0..4f9cadc 100644
--- a/src/sage/matrix/matrix_integer_sparse.pyx
+++ b/src/sage/matrix/matrix_integer_sparse.pyx
@@ -184,7 +184,7 @@ cdef class Matrix_integer_sparse(Matrix_sparse):
# def _multiply_classical(left, matrix.Matrix _right):
# def _list(self):
- cpdef _lmul_(self, RingElement right):
+ cpdef _lmul_(self, Element right):
"""
EXAMPLES::
diff --git a/src/sage/matrix/matrix_modn_dense_template.pxi b/src/sage/matrix/matrix_modn_dense_template.pxi
index 5b12c64..092600d 100644
--- a/src/sage/matrix/matrix_modn_dense_template.pxi
+++ b/src/sage/matrix/matrix_modn_dense_template.pxi
@@ -865,7 +865,7 @@ cdef class Matrix_modn_dense_template(Matrix_dense):
sig_off()
return M
- cpdef _lmul_(self, RingElement left):
+ cpdef _lmul_(self, Element left):
"""
EXAMPLES::
diff --git a/src/sage/matrix/matrix_rational_dense.pyx b/src/sage/matrix/matrix_rational_dense.pyx
index 96000f3..a72b88d 100644
--- a/src/sage/matrix/matrix_rational_dense.pyx
+++ b/src/sage/matrix/matrix_rational_dense.pyx
@@ -422,7 +422,7 @@ cdef class Matrix_rational_dense(Matrix_dense):
# * _dict -- sparse dictionary of underlying elements (need not be a copy)
########################################################################
- cpdef _lmul_(self, RingElement right):
+ cpdef _lmul_(self, Element right):
"""
EXAMPLES::
diff --git a/src/sage/matrix/matrix_rational_sparse.pyx b/src/sage/matrix/matrix_rational_sparse.pyx
index ab32ec8..db36524 100644
--- a/src/sage/matrix/matrix_rational_sparse.pyx
+++ b/src/sage/matrix/matrix_rational_sparse.pyx
@@ -331,7 +331,7 @@ cdef class Matrix_rational_sparse(Matrix_sparse):
# def _list(self):
# TODO
-## cpdef _lmul_(self, RingElement right):
+## cpdef _lmul_(self, Element right):
## """
## EXAMPLES:
## sage: a = matrix(QQ,2,range(6))
diff --git a/src/sage/matrix/matrix_sparse.pyx b/src/sage/matrix/matrix_sparse.pyx
index 4cd99ca..1b42c00 100644
--- a/src/sage/matrix/matrix_sparse.pyx
+++ b/src/sage/matrix/matrix_sparse.pyx
@@ -294,7 +294,7 @@ cdef class Matrix_sparse(matrix.Matrix):
return left.new_matrix(left._nrows, right._ncols, entries=e, coerce=False, copy=False)
- cpdef _lmul_(self, RingElement right):
+ cpdef _lmul_(self, Element right):
"""
Left scalar multiplication. Internal usage only.
diff --git a/src/sage/modular/pollack_stevens/dist.pyx b/src/sage/modular/pollack_stevens/dist.pyx
index fdb40b8..aecd4a8 100644
--- a/src/sage/modular/pollack_stevens/dist.pyx
+++ b/src/sage/modular/pollack_stevens/dist.pyx
@@ -996,7 +996,7 @@ cdef class Dist_vector(Dist):
"""
return self._addsub(<Dist_vector>_right, True)
- cpdef _lmul_(self, RingElement right):
+ cpdef _lmul_(self, Element right):
r"""
Scalar product of a distribution with a ring element that coerces into the base ring.
diff --git a/src/sage/modules/free_module_element.pyx b/src/sage/modules/free_module_element.pyx
index 91873f2..c3f9363 100644
--- a/src/sage/modules/free_module_element.pyx
+++ b/src/sage/modules/free_module_element.pyx
@@ -4158,7 +4158,7 @@ cdef class FreeModuleElement_generic_dense(FreeModuleElement):
v = [(<RingElement> a[i])._sub_(<RingElement> b[i]) for i in range(left._degree)]
return left._new_c(v)
- cpdef _rmul_(self, RingElement left):
+ cpdef _rmul_(self, Element left):
"""
EXAMPLES::
@@ -4172,7 +4172,7 @@ cdef class FreeModuleElement_generic_dense(FreeModuleElement):
v = [left * x for x in self._entries]
return self._new_c(v)
- cpdef _lmul_(self, RingElement right):
+ cpdef _lmul_(self, Element right):
"""
EXAMPLES::
@@ -4608,7 +4608,7 @@ cdef class FreeModuleElement_generic_sparse(FreeModuleElement):
v[i] = -a
return left._new_c(v)
- cpdef _lmul_(self, RingElement right):
+ cpdef _lmul_(self, Element right):
"""
EXAMPLES::
@@ -4624,7 +4624,7 @@ cdef class FreeModuleElement_generic_sparse(FreeModuleElement):
v[i] = prod
return self._new_c(v)
- cpdef _rmul_(self, RingElement left):
+ cpdef _rmul_(self, Element left):
"""
EXAMPLES::
diff --git a/src/sage/modules/vector_double_dense.pyx b/src/sage/modules/vector_double_dense.pyx
index 716ba31..39fc297 100644
--- a/src/sage/modules/vector_double_dense.pyx
+++ b/src/sage/modules/vector_double_dense.pyx
@@ -359,7 +359,7 @@ cdef class Vector_double_dense(FreeModuleElement):
return self._new(_left._vector_numpy * _right._vector_numpy)
- cpdef _rmul_(self, RingElement left):
+ cpdef _rmul_(self, Element left):
"""
Multiply a scalar and vector
@@ -375,8 +375,7 @@ cdef class Vector_double_dense(FreeModuleElement):
return self._new(self._python_dtype(left)*self._vector_numpy)
-
- cpdef _lmul_(self, RingElement right):
+ cpdef _lmul_(self, Element right):
"""
Multiply a scalar and vector
diff --git a/src/sage/modules/vector_integer_dense.pyx b/src/sage/modules/vector_integer_dense.pyx
index f921da4..45529a9 100644
--- a/src/sage/modules/vector_integer_dense.pyx
+++ b/src/sage/modules/vector_integer_dense.pyx
@@ -282,7 +282,7 @@ cdef class Vector_integer_dense(free_module_element.FreeModuleElement):
mpz_mul(z._entries[i], self._entries[i], r._entries[i])
return z
- cpdef _rmul_(self, RingElement left):
+ cpdef _rmul_(self, Element left):
cdef Vector_integer_dense z
cdef Integer a
a = left
@@ -292,7 +292,7 @@ cdef class Vector_integer_dense(free_module_element.FreeModuleElement):
mpz_mul(z._entries[i], self._entries[i], a.value)
return z
- cpdef _lmul_(self, RingElement right):
+ cpdef _lmul_(self, Element right):
cdef Vector_integer_dense z
cdef Integer a
a = right
diff --git a/src/sage/modules/vector_mod2_dense.pyx b/src/sage/modules/vector_mod2_dense.pyx
index 910a71b..31ea3e1 100644
--- a/src/sage/modules/vector_mod2_dense.pyx
+++ b/src/sage/modules/vector_mod2_dense.pyx
@@ -404,7 +404,7 @@ cdef class Vector_mod2_dense(free_module_element.FreeModuleElement):
z._entries.rows[0][i] = (self._entries.rows[0][i] & r._entries.rows[0][i])
return z
- cpdef _lmul_(self, RingElement left):
+ cpdef _lmul_(self, Element left):
"""
EXAMPLES::
diff --git a/src/sage/modules/vector_modn_dense.pyx b/src/sage/modules/vector_modn_dense.pyx
index 230e208..23897c2 100644
--- a/src/sage/modules/vector_modn_dense.pyx
+++ b/src/sage/modules/vector_modn_dense.pyx
@@ -308,7 +308,7 @@ cdef class Vector_modn_dense(free_module_element.FreeModuleElement):
z._entries[i] = (self._entries[i] * r._entries[i]) % self._p
return z
- cpdef _lmul_(self, RingElement left):
+ cpdef _lmul_(self, Element left):
cdef Vector_modn_dense z
cdef mod_int a = ivalue(left)
diff --git a/src/sage/modules/vector_rational_dense.pyx b/src/sage/modules/vector_rational_dense.pyx
index 6b78320..a54c4e6 100644
--- a/src/sage/modules/vector_rational_dense.pyx
+++ b/src/sage/modules/vector_rational_dense.pyx
@@ -314,7 +314,7 @@ cdef class Vector_rational_dense(free_module_element.FreeModuleElement):
mpq_mul(z._entries[i], self._entries[i], r._entries[i])
return z
- cpdef _rmul_(self, RingElement left):
+ cpdef _rmul_(self, Element left):
cdef Vector_rational_dense z
cdef Rational a
if isinstance(left, Rational):
@@ -331,8 +331,7 @@ cdef class Vector_rational_dense(free_module_element.FreeModuleElement):
mpq_mul(z._entries[i], self._entries[i], a.value)
return z
-
- cpdef _lmul_(self, RingElement right):
+ cpdef _lmul_(self, Element right):
cdef Vector_rational_dense z
cdef Rational a
if isinstance(right, Rational):
diff --git a/src/sage/modules/with_basis/indexed_element.pxd b/src/sage/modules/with_basis/indexed_element.pxd
index c29caa2..e4825c8 100644
--- a/src/sage/modules/with_basis/indexed_element.pxd
+++ b/src/sage/modules/with_basis/indexed_element.pxd
@@ -7,6 +7,6 @@ cdef class IndexedFreeModuleElement(Element):
cpdef dict monomial_coefficients(self, bint copy=*)
cpdef _coefficient_fast(self, m)
- cpdef _lmul_(self, RingElement right)
- cpdef _rmul_(self, RingElement left)
+ cpdef _lmul_(self, Element right)
+ cpdef _rmul_(self, Element left)
diff --git a/src/sage/modules/with_basis/indexed_element.pyx b/src/sage/modules/with_basis/indexed_element.pyx
index 7e93a8b..b0ce589 100644
--- a/src/sage/modules/with_basis/indexed_element.pyx
+++ b/src/sage/modules/with_basis/indexed_element.pyx
@@ -816,7 +816,7 @@ cdef class IndexedFreeModuleElement(Element):
scal(scalar, self._monomial_coefficients,
factor_on_left=not self_on_left))
- cpdef _lmul_(self, RingElement right):
+ cpdef _lmul_(self, Element right):
"""
For backward compatibility.
@@ -828,7 +828,7 @@ cdef class IndexedFreeModuleElement(Element):
"""
return self._acted_upon_(right, True)
- cpdef _rmul_(self, RingElement left):
+ cpdef _rmul_(self, Element left):
"""
For backward compatibility.
diff --git a/src/sage/numerical/linear_functions.pyx b/src/sage/numerical/linear_functions.pyx
index 72b30c1..898066c 100644
--- a/src/sage/numerical/linear_functions.pyx
+++ b/src/sage/numerical/linear_functions.pyx
@@ -957,7 +957,7 @@ cdef class LinearFunction(LinearFunctionOrConstraint):
P = self.parent()
return P(e)
- cpdef _lmul_(self, RingElement b):
+ cpdef _lmul_(self, Element b):
r"""
Multiplication by scalars
diff --git a/src/sage/numerical/linear_tensor_element.pyx b/src/sage/numerical/linear_tensor_element.pyx
index 127e94c..3d0200d 100644
--- a/src/sage/numerical/linear_tensor_element.pyx
+++ b/src/sage/numerical/linear_tensor_element.pyx
@@ -22,7 +22,7 @@ Here is an example of a linear function tensored with a vector space::
from cpython.object cimport *
from sage.misc.fast_methods cimport hash_by_id
-from sage.structure.element cimport ModuleElement, RingElement
+from sage.structure.element cimport ModuleElement, Element
from sage.numerical.linear_functions cimport LinearFunction, is_LinearFunction
@@ -331,7 +331,7 @@ cdef class LinearTensor(ModuleElement):
result[key] = self._f.get(key, 0) - coeff
return self.parent()(result)
- cpdef _lmul_(self, RingElement b):
+ cpdef _lmul_(self, Element b):
r"""
Return multiplication by scalar.
diff --git a/src/sage/quivers/algebra_elements.pyx b/src/sage/quivers/algebra_elements.pyx
index 289044e..81979ea 100644
--- a/src/sage/quivers/algebra_elements.pyx
+++ b/src/sage/quivers/algebra_elements.pyx
@@ -1203,7 +1203,7 @@ cdef class PathAlgebraElement(RingElement):
## (scalar) multiplication
- cpdef _lmul_(self, RingElement right):
+ cpdef _lmul_(self, Element right):
"""
EXAMPLES::
@@ -1234,7 +1234,7 @@ cdef class PathAlgebraElement(RingElement):
return self._new_(outnxt)
return self._new_(out)
- cpdef _rmul_(self, RingElement left):
+ cpdef _rmul_(self, Element left):
"""
EXAMPLES::
diff --git a/src/sage/rings/laurent_series_ring_element.pyx b/src/sage/rings/laurent_series_ring_element.pyx
index 52c87e0..fc128c4 100644
--- a/src/sage/rings/laurent_series_ring_element.pyx
+++ b/src/sage/rings/laurent_series_ring_element.pyx
@@ -696,10 +696,10 @@ cdef class LaurentSeries(AlgebraElement):
self.__u * right.__u,
self.__n + right.__n)
- cpdef _rmul_(self, RingElement c):
+ cpdef _rmul_(self, Element c):
return LaurentSeries(self._parent, self.__u._rmul_(c), self.__n)
- cpdef _lmul_(self, RingElement c):
+ cpdef _lmul_(self, Element c):
return LaurentSeries(self._parent, self.__u._lmul_(c), self.__n)
def __pow__(_self, r, dummy):
diff --git a/src/sage/rings/number_field/number_field_element_quadratic.pyx b/src/sage/rings/number_field/number_field_element_quadratic.pyx
index 6c92df0..e6767ec 100644
--- a/src/sage/rings/number_field/number_field_element_quadratic.pyx
+++ b/src/sage/rings/number_field/number_field_element_quadratic.pyx
@@ -1193,8 +1193,7 @@ cdef class NumberFieldElement_quadratic(NumberFieldElement_absolute):
res._reduce_c_()
return res
-
- cpdef _rmul_(self, RingElement _c):
+ cpdef _rmul_(self, Element _c):
"""
EXAMPLES:
sage: K.<a> = NumberField(x^2+43)
@@ -1209,8 +1208,7 @@ cdef class NumberFieldElement_quadratic(NumberFieldElement_absolute):
res._reduce_c_()
return res
-
- cpdef _lmul_(self, RingElement _c):
+ cpdef _lmul_(self, Element _c):
"""
EXAMPLES:
sage: K.<a> = NumberField(x^2+43)
@@ -2188,7 +2186,7 @@ cdef class OrderElement_quadratic(NumberFieldElement_quadratic):
return self._parent.number_field()
# We must override these since the basering is now ZZ not QQ.
- cpdef _rmul_(self, RingElement _c):
+ cpdef _rmul_(self, Element _c):
"""
EXAMPLES:
sage: K.<a> = NumberField(x^2-27)
@@ -2206,8 +2204,7 @@ cdef class OrderElement_quadratic(NumberFieldElement_quadratic):
res._reduce_c_()
return res
-
- cpdef _lmul_(self, RingElement _c):
+ cpdef _lmul_(self, Element _c):
"""
EXAMPLES:
sage: K.<a> = NumberField(x^2+43)
diff --git a/src/sage/rings/polynomial/laurent_polynomial.pyx b/src/sage/rings/polynomial/laurent_polynomial.pyx
index 1204e62..5727d6e 100644
--- a/src/sage/rings/polynomial/laurent_polynomial.pyx
+++ b/src/sage/rings/polynomial/laurent_polynomial.pyx
@@ -790,7 +790,7 @@ cdef class LaurentPolynomial_univariate(LaurentPolynomial_generic):
self.__u * right.__u,
self.__n + right.__n)
- cpdef _rmul_(self, RingElement c):
+ cpdef _rmul_(self, Element c):
"""
EXAMPLES::
@@ -801,7 +801,7 @@ cdef class LaurentPolynomial_univariate(LaurentPolynomial_generic):
"""
return LaurentPolynomial_univariate(self._parent, self.__u._rmul_(c), self.__n)
- cpdef _lmul_(self, RingElement c):
+ cpdef _lmul_(self, Element c):
"""
EXAMPLES::
@@ -2303,7 +2303,7 @@ cdef class LaurentPolynomial_mpair(LaurentPolynomial_generic):
ans._poly = -self._poly
return ans
- cpdef _lmul_(self, RingElement right):
+ cpdef _lmul_(self, Element right):
"""
Returns self * right where right is in self's base ring.
@@ -2320,7 +2320,7 @@ cdef class LaurentPolynomial_mpair(LaurentPolynomial_generic):
ans._poly = self._poly * right
return ans
- cpdef _rmul_(self, RingElement left):
+ cpdef _rmul_(self, Element left):
"""
Returns left*self where left is in self's base ring.
diff --git a/src/sage/rings/polynomial/multi_polynomial_libsingular.pyx b/src/sage/rings/polynomial/multi_polynomial_libsingular.pyx
index ea51f00..07c42f7 100644
--- a/src/sage/rings/polynomial/multi_polynomial_libsingular.pyx
+++ b/src/sage/rings/polynomial/multi_polynomial_libsingular.pyx
@@ -2271,7 +2271,7 @@ cdef class MPolynomial_libsingular(sage.rings.polynomial.multi_polynomial.MPolyn
_ring)
return new_MP((<MPolynomial_libsingular>left)._parent, _p)
- cpdef _lmul_(self, RingElement left):
+ cpdef _lmul_(self, Element left):
"""
Multiply self with a base ring element.
diff --git a/src/sage/rings/polynomial/pbori.pyx b/src/sage/rings/polynomial/pbori.pyx
index 1d3fc80..500ddae 100644
--- a/src/sage/rings/polynomial/pbori.pyx
+++ b/src/sage/rings/polynomial/pbori.pyx
@@ -3032,7 +3032,7 @@ cdef class BooleanPolynomial(MPolynomial):
"""
return left._add_(right)
- cpdef _lmul_(self, RingElement left):
+ cpdef _lmul_(self, Element left):
"""
EXAMPLES::
diff --git a/src/sage/rings/polynomial/plural.pyx b/src/sage/rings/polynomial/plural.pyx
index d92f117..c381d5f 100644
--- a/src/sage/rings/polynomial/plural.pyx
+++ b/src/sage/rings/polynomial/plural.pyx
@@ -1510,7 +1510,7 @@ cdef class NCPolynomial_plural(RingElement):
_ring)
return new_NCP((<NCPolynomialRing_plural>left._parent), _p)
- cpdef _lmul_(self, RingElement left):
+ cpdef _lmul_(self, Element left):
"""
Multiply ``self`` with a base ring element.
diff --git a/src/sage/rings/polynomial/polynomial_element.pyx b/src/sage/rings/polynomial/polynomial_element.pyx
index 00e4f94..28ba1d4 100644
--- a/src/sage/rings/polynomial/polynomial_element.pyx
+++ b/src/sage/rings/polynomial/polynomial_element.pyx
@@ -368,7 +368,7 @@ cdef class Polynomial(CommutativeAlgebraElement):
return point(z, *args, **kwds)
raise NotImplementedError("plotting of polynomials over %s not implemented"%R)
- cpdef _lmul_(self, RingElement left):
+ cpdef _lmul_(self, Element left):
"""
Multiply self on the left by a scalar.
@@ -388,7 +388,7 @@ cdef class Polynomial(CommutativeAlgebraElement):
return self._parent.zero()
return self.parent()(left) * self
- cpdef _rmul_(self, RingElement right):
+ cpdef _rmul_(self, Element right):
"""
Multiply self on the right by a scalar.
@@ -9786,7 +9786,7 @@ cdef class Polynomial_generic_dense(Polynomial):
else:
return self._new_c(low + high, self._parent)
- cpdef _rmul_(self, RingElement c):
+ cpdef _rmul_(self, Element c):
if not self.__coeffs:
return self
if c._parent is not (<Element>self.__coeffs[0])._parent:
@@ -9798,7 +9798,7 @@ cdef class Polynomial_generic_dense(Polynomial):
res.__normalize()
return res
- cpdef _lmul_(self, RingElement c):
+ cpdef _lmul_(self, Element c):
if not self.__coeffs:
return self
if c._parent is not (<Element>self.__coeffs[0])._parent:
diff --git a/src/sage/rings/polynomial/polynomial_integer_dense_flint.pyx b/src/sage/rings/polynomial/polynomial_integer_dense_flint.pyx
index 9a4f10f..bf0bbce 100644
--- a/src/sage/rings/polynomial/polynomial_integer_dense_flint.pyx
+++ b/src/sage/rings/polynomial/polynomial_integer_dense_flint.pyx
@@ -44,7 +44,7 @@ from sage.misc.long cimport pyobject_to_long
from sage.libs.flint.fmpz_poly cimport *
from sage.rings.polynomial.polynomial_element cimport Polynomial
-from sage.structure.element cimport ModuleElement, RingElement
+from sage.structure.element cimport ModuleElement, Element
from sage.structure.element import coerce_binop
from sage.libs.ntl.ntl_ZZX cimport ntl_ZZX
@@ -948,7 +948,7 @@ cdef class Polynomial_integer_dense_flint(Polynomial):
sig_off()
return x
- cpdef _lmul_(self, RingElement right):
+ cpdef _lmul_(self, Element right):
r"""
Returns self multiplied by right, where right is a scalar (integer).
@@ -966,8 +966,7 @@ cdef class Polynomial_integer_dense_flint(Polynomial):
sig_off()
return x
-
- cpdef _rmul_(self, RingElement right):
+ cpdef _rmul_(self, Element right):
r"""
Returns self multiplied by right, where right is a scalar (integer).
diff --git a/src/sage/rings/polynomial/polynomial_integer_dense_ntl.pyx b/src/sage/rings/polynomial/polynomial_integer_dense_ntl.pyx
index 2b0ed0c..7b610e9 100644
--- a/src/sage/rings/polynomial/polynomial_integer_dense_ntl.pyx
+++ b/src/sage/rings/polynomial/polynomial_integer_dense_ntl.pyx
@@ -40,7 +40,7 @@ from cysignals.signals cimport sig_on, sig_off
include "sage/libs/ntl/decl.pxi"
from sage.rings.polynomial.polynomial_element cimport Polynomial
-from sage.structure.element cimport ModuleElement, RingElement
+from sage.structure.element cimport ModuleElement, Element
from sage.rings.integer_ring import IntegerRing
from sage.rings.integer_ring cimport IntegerRing_class
@@ -681,8 +681,7 @@ cdef class Polynomial_integer_dense_ntl(Polynomial):
(<Polynomial_integer_dense_ntl>right).__poly)
return x
-
- cpdef _lmul_(self, RingElement right):
+ cpdef _lmul_(self, Element right):
r"""
Returns self multiplied by right, where right is a scalar (integer).
@@ -701,8 +700,7 @@ cdef class Polynomial_integer_dense_ntl(Polynomial):
ZZX_mul_ZZ(x.__poly, self.__poly, _right)
return x
-
- cpdef _rmul_(self, RingElement right):
+ cpdef _rmul_(self, Element right):
r"""
Returns self multiplied by right, where right is a scalar (integer).
diff --git a/src/sage/rings/polynomial/polynomial_modn_dense_ntl.pyx b/src/sage/rings/polynomial/polynomial_modn_dense_ntl.pyx
index 457327c..7605efc 100644
--- a/src/sage/rings/polynomial/polynomial_modn_dense_ntl.pyx
+++ b/src/sage/rings/polynomial/polynomial_modn_dense_ntl.pyx
@@ -232,7 +232,7 @@ cdef class Polynomial_dense_mod_n(Polynomial):
"""
return self.parent()(self.__poly * (<Polynomial_dense_mod_n>right).__poly, construct=True)
- cpdef _lmul_(self, RingElement c):
+ cpdef _lmul_(self, Element c):
try:
return self.parent()(ZZ_pX([c], self.parent().modulus()) * self.__poly, construct=True)
except RuntimeError as msg: # should this really be a TypeError
@@ -760,7 +760,7 @@ cdef class Polynomial_dense_modn_ntl_zz(Polynomial_dense_mod_n):
if do_sig: sig_off()
return r
- cpdef _rmul_(self, RingElement c):
+ cpdef _rmul_(self, Element c):
"""
TESTS::
@@ -776,7 +776,7 @@ cdef class Polynomial_dense_modn_ntl_zz(Polynomial_dense_mod_n):
if do_sig: sig_off()
return r
- cpdef _lmul_(self, RingElement c):
+ cpdef _lmul_(self, Element c):
"""
TESTS::
@@ -1308,7 +1308,7 @@ cdef class Polynomial_dense_modn_ntl_ZZ(Polynomial_dense_mod_n):
if do_sig: sig_off()
return r
- cpdef _rmul_(self, RingElement c):
+ cpdef _rmul_(self, Element c):
"""
TESTS::
@@ -1325,7 +1325,7 @@ cdef class Polynomial_dense_modn_ntl_ZZ(Polynomial_dense_mod_n):
if do_sig: sig_off()
return r
- cpdef _lmul_(self, RingElement c):
+ cpdef _lmul_(self, Element c):
"""
TESTS::
diff --git a/src/sage/rings/polynomial/polynomial_rational_flint.pyx b/src/sage/rings/polynomial/polynomial_rational_flint.pyx
index 1d51662..4b381d7 100644
--- a/src/sage/rings/polynomial/polynomial_rational_flint.pyx
+++ b/src/sage/rings/polynomial/polynomial_rational_flint.pyx
@@ -1071,7 +1071,7 @@ cdef class Polynomial_rational_flint(Polynomial):
if do_sig: sig_off()
return res
- cpdef _rmul_(self, RingElement left):
+ cpdef _rmul_(self, Element left):
r"""
Returns left * self, where left is a rational number.
@@ -1091,7 +1091,7 @@ cdef class Polynomial_rational_flint(Polynomial):
if do_sig: sig_off()
return res
- cpdef _lmul_(self, RingElement right):
+ cpdef _lmul_(self, Element right):
r"""
Returns self * right, where right is a rational number.
diff --git a/src/sage/rings/polynomial/polynomial_real_mpfr_dense.pyx b/src/sage/rings/polynomial/polynomial_real_mpfr_dense.pyx
index f585877..c561b77 100644
--- a/src/sage/rings/polynomial/polynomial_real_mpfr_dense.pyx
+++ b/src/sage/rings/polynomial/polynomial_real_mpfr_dense.pyx
@@ -443,7 +443,7 @@ cdef class PolynomialRealDense(Polynomial):
f._normalize()
return f
- cpdef _lmul_(self, RingElement c):
+ cpdef _lmul_(self, Element c):
"""
EXAMPLES::
diff --git a/src/sage/rings/polynomial/polynomial_template.pxi b/src/sage/rings/polynomial/polynomial_template.pxi
index 1d6d2c2..f508db7 100644
--- a/src/sage/rings/polynomial/polynomial_template.pxi
+++ b/src/sage/rings/polynomial/polynomial_template.pxi
@@ -275,7 +275,7 @@ cdef class Polynomial_template(Polynomial):
#assert(r._parent(-pari(self)) == r)
return r
- cpdef _lmul_(self, RingElement left):
+ cpdef _lmul_(self, Element left):
"""
EXAMPLES::
diff --git a/src/sage/rings/polynomial/polynomial_zz_pex.pyx b/src/sage/rings/polynomial/polynomial_zz_pex.pyx
index 2cc3522..0e22e15 100644
--- a/src/sage/rings/polynomial/polynomial_zz_pex.pyx
+++ b/src/sage/rings/polynomial/polynomial_zz_pex.pyx
@@ -194,7 +194,7 @@ cdef class Polynomial_ZZ_pEX(Polynomial_template):
return [K(ZZ_pE_c_to_list(ZZ_pEX_coeff(self.x, i)))
for i in range(celement_len(&self.x, (<Polynomial_template>self)._cparent))]
- cpdef _lmul_(self, RingElement left):
+ cpdef _lmul_(self, Element left):
"""
EXAMPLES::
diff --git a/src/sage/rings/polynomial/skew_polynomial_element.pyx b/src/sage/rings/polynomial/skew_polynomial_element.pyx
index ff1e1db..7bfd2b8 100644
--- a/src/sage/rings/polynomial/skew_polynomial_element.pyx
+++ b/src/sage/rings/polynomial/skew_polynomial_element.pyx
@@ -2513,7 +2513,7 @@ cdef class SkewPolynomial_generic_dense(SkewPolynomial):
self._parent, 0)
return c
- cpdef ModuleElement _lmul_(self, RingElement right):
+ cpdef ModuleElement _lmul_(self, Element right):
r"""
Multiply ``self`` on the right by scalar.
@@ -2542,7 +2542,7 @@ cdef class SkewPolynomial_generic_dense(SkewPolynomial):
self._parent, 0)
return r
- cpdef ModuleElement _rmul_(self, RingElement left):
+ cpdef ModuleElement _rmul_(self, Element left):
r"""
Multiply ``self`` on the left by scalar.
diff --git a/src/sage/rings/power_series_mpoly.pyx b/src/sage/rings/power_series_mpoly.pyx
index 52aa4e6..ae927d7 100644
--- a/src/sage/rings/power_series_mpoly.pyx
+++ b/src/sage/rings/power_series_mpoly.pyx
@@ -146,10 +146,10 @@ cdef class PowerSeries_mpoly(PowerSeries):
return PowerSeries_mpoly(self._parent, self.__f - right.__f, \
self.common_prec_c(right), check=True)
- cpdef _rmul_(self, RingElement c):
+ cpdef _rmul_(self, Element c):
return PowerSeries_mpoly(self._parent, self.__f._rmul_(c), self._prec, check=False)
- cpdef _lmul_(self, RingElement c):
+ cpdef _lmul_(self, Element c):
return PowerSeries_mpoly(self._parent, self.__f._lmul_(c), self._prec, check=False)
diff --git a/src/sage/rings/power_series_pari.pyx b/src/sage/rings/power_series_pari.pyx
index ffee438..f16aee8 100644
--- a/src/sage/rings/power_series_pari.pyx
+++ b/src/sage/rings/power_series_pari.pyx
@@ -602,7 +602,7 @@ cdef class PowerSeries_pari(PowerSeries):
"""
return construct_from_pari(self._parent, self.g * (<PowerSeries_pari>right).g)
- cpdef _rmul_(self, RingElement c):
+ cpdef _rmul_(self, Element c):
"""
Right multiplication by a scalar.
@@ -616,7 +616,7 @@ cdef class PowerSeries_pari(PowerSeries):
"""
return construct_from_pari(self._parent, self.g * c)
- cpdef _lmul_(self, RingElement c):
+ cpdef _lmul_(self, Element c):
"""
Left multiplication by a scalar.
diff --git a/src/sage/rings/power_series_poly.pyx b/src/sage/rings/power_series_poly.pyx
index 4e4119a..f3af2ce 100644
--- a/src/sage/rings/power_series_poly.pyx
+++ b/src/sage/rings/power_series_poly.pyx
@@ -546,7 +546,7 @@ cdef class PowerSeries_poly(PowerSeries):
prec = prec,
check = True) # check, since truncation may be needed
- cpdef _rmul_(self, RingElement c):
+ cpdef _rmul_(self, Element c):
"""
Multiply self on the right by a scalar.
@@ -559,7 +559,7 @@ cdef class PowerSeries_poly(PowerSeries):
"""
return PowerSeries_poly(self._parent, self.__f * c, self._prec, check=False)
- cpdef _lmul_(self, RingElement c):
+ cpdef _lmul_(self, Element c):
"""
Multiply self on the left by a scalar.
diff --git a/src/sage/structure/coerce_actions.pyx b/src/sage/structure/coerce_actions.pyx
index 5280a2c..637c4dd 100644
--- a/src/sage/structure/coerce_actions.pyx
+++ b/src/sage/structure/coerce_actions.pyx
@@ -18,8 +18,7 @@ from cpython.int cimport *
from cpython.number cimport *
from cysignals.signals cimport sig_check
-from .element cimport (parent, coercion_model,
- Element, ModuleElement, RingElement)
+from .element cimport parent, coercion_model, Element, ModuleElement
from .parent cimport Parent
from .coerce_exceptions import CoercionException
from sage.categories.action cimport InverseAction, PrecomposedAction
@@ -226,7 +225,7 @@ def detect_element_action(Parent X, Y, bint X_on_left, X_el=None, Y_el=None):
raise RuntimeError("an_element() for %s returned None" % Y)
else:
return # don't know how to make elements of this type...
- if isinstance(x, ModuleElement) and isinstance(y, RingElement):
+ if isinstance(x, ModuleElement) and isinstance(y, Element):
# Elements defining _lmul_ and _rmul_
try:
return (RightModuleAction if X_on_left else LeftModuleAction)(Y, X, y, x)
@@ -356,7 +355,7 @@ cdef class ModuleAction(Action):
if self.extended_base is not None and self.extended_base is S:
self.extended_base = None
- # At this point, we can assert it is safe to call _Xmul_c
+ # At this point, we can assert it is safe to call _Xmul_
the_ring = G if self.connecting is None else self.connecting.codomain()
the_set = S if self.extended_base is None else self.extended_base
assert the_ring is the_set.base(), "BUG in coercion model\n Apparently there are two versions of\n %s\n in the cache."%the_ring
@@ -371,8 +370,8 @@ cdef class ModuleAction(Action):
a = S.an_element()
if parent(a) is not S:
raise CoercionException("The parent of %s is not %s but %s"%(a,S,parent(a)))
- if not isinstance(g, RingElement) or not isinstance(a, ModuleElement):
- raise CoercionException("Not a ring element acting on a module element.")
+ if not isinstance(g, Element) or not isinstance(a, ModuleElement):
+ raise CoercionException("not an Element acting on a ModuleElement")
res = self.act(g, a)
if parent(res) is not the_set:
# In particular we will raise an error if res is None
@@ -604,11 +603,15 @@ cdef class LeftModuleAction(ModuleAction):
sage: A._call_(1/2, x+1) # safe only when arguments have exactly the correct parent
1/2*x + 1/2
"""
+ # The way we are called, we know for sure that a is a
+ # ModuleElement and that g is an Element.
+ # If we change a or g, we need to explicitly check this,
+ # which explains the <?> casts below.
if self.connecting is not None:
- g = self.connecting._call_(g)
+ g = <Element?>self.connecting._call_(g)
if self.extended_base is not None:
- a = self.extended_base(a)
- return (<ModuleElement>a)._rmul_(<RingElement>g) # g * a
+ a = <ModuleElement?>self.extended_base(a)
+ return (<ModuleElement>a)._rmul_(<Element>g) # g * a
cdef class RightModuleAction(ModuleAction):
@@ -633,11 +636,15 @@ cdef class RightModuleAction(ModuleAction):
sage: A._call_(x+5, 2) # safe only when arguments have exactly the correct parent
2*x + 10
"""
+ # The way we are called, we know for sure that a is a
+ # ModuleElement and that g is an Element.
+ # If we change a or g, we need to explicitly check this,
+ # which explains the <?> casts below.
if self.connecting is not None:
- g = self.connecting._call_(g)
+ g = <Element?>self.connecting._call_(g)
if self.extended_base is not None:
- a = self.extended_base(a)
- return (<ModuleElement>a)._lmul_(<RingElement>g) # a * g
+ a = <ModuleElement?>self.extended_base(a)
+ return (<ModuleElement>a)._lmul_(<Element>g) # a * g
cdef class IntegerMulAction(Action):
diff --git a/src/sage/structure/element.pxd b/src/sage/structure/element.pxd
index 46e0c92..8199639 100644
--- a/src/sage/structure/element.pxd
+++ b/src/sage/structure/element.pxd
@@ -215,9 +215,9 @@ cdef class ModuleElement(Element):
cpdef _neg_(self)
# self._rmul_(x) is x * self
- cpdef _lmul_(self, RingElement right)
+ cpdef _lmul_(self, Element right)
# self._lmul_(x) is self * x
- cpdef _rmul_(self, RingElement left)
+ cpdef _rmul_(self, Element left)
cdef class MonoidElement(Element):
pass
diff --git a/src/sage/structure/element.pyx b/src/sage/structure/element.pyx
index 0fe1b3d..f9a7657 100644
--- a/src/sage/structure/element.pyx
+++ b/src/sage/structure/element.pyx
@@ -2206,7 +2206,7 @@ cdef class ModuleElement(Element):
return coercion_model.bin_op(self, n, mul)
# rmul -- left * self
- cpdef _rmul_(self, RingElement left):
+ cpdef _rmul_(self, Element left):
"""
Reversed scalar multiplication for module elements with the
module element on the right and the scalar on the left.
@@ -2216,7 +2216,7 @@ cdef class ModuleElement(Element):
return self._lmul_(left)
# lmul -- self * right
- cpdef _lmul_(self, RingElement right):
+ cpdef _lmul_(self, Element right):
"""
Scalar multiplication for module elements with the module
element on the left and the scalar on the right.