diff --git a/src/sage/algebras/letterplace/free_algebra_element_letterplace.pyx b/src/sage/algebras/letterplace/free_algebra_element_letterplace.pyx index b6bc0e3f87a..5c357f625ea 100644 --- a/src/sage/algebras/letterplace/free_algebra_element_letterplace.pyx +++ b/src/sage/algebras/letterplace/free_algebra_element_letterplace.pyx @@ -470,7 +470,7 @@ cdef class FreeAlgebraElement_letterplace(AlgebraElement): ################################ ## Arithmetic - cpdef ModuleElement _neg_(self): + cpdef _neg_(self): """ TEST:: @@ -484,7 +484,7 @@ cdef class FreeAlgebraElement_letterplace(AlgebraElement): """ return FreeAlgebraElement_letterplace(self._parent,-self._poly,check=False) - cpdef ModuleElement _add_(self, ModuleElement other): + cpdef _add_(self, ModuleElement other): """ Addition, under the side condition that either one summand is zero, or both summands have the same degree. @@ -517,7 +517,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 ModuleElement _sub_(self, ModuleElement other): + cpdef _sub_(self, ModuleElement other): """ Difference, under the side condition that either one summand is zero or both have the same weighted degree. @@ -556,7 +556,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 ModuleElement _lmul_(self, RingElement right): + cpdef _lmul_(self, RingElement right): """ Multiplication from the right with an element of the base ring. @@ -570,7 +570,7 @@ cdef class FreeAlgebraElement_letterplace(AlgebraElement): """ return FreeAlgebraElement_letterplace(self._parent,self._poly._lmul_(right),check=False) - cpdef ModuleElement _rmul_(self, RingElement left): + cpdef _rmul_(self, RingElement left): """ Multiplication from the left with an element of the base ring. @@ -584,7 +584,7 @@ cdef class FreeAlgebraElement_letterplace(AlgebraElement): """ return FreeAlgebraElement_letterplace(self._parent,self._poly._rmul_(left),check=False) - cpdef RingElement _mul_(self, RingElement other): + cpdef _mul_(self, RingElement other): """ Product of two free algebra elements in letterplace implementation. diff --git a/src/sage/algebras/quatalg/quaternion_algebra_element.pyx b/src/sage/algebras/quatalg/quaternion_algebra_element.pyx index 92752061629..0a3d7a30ed7 100644 --- a/src/sage/algebras/quatalg/quaternion_algebra_element.pyx +++ b/src/sage/algebras/quatalg/quaternion_algebra_element.pyx @@ -487,7 +487,7 @@ cdef class QuaternionAlgebraElement_abstract(AlgebraElement): """ return ~self.reduced_norm() * self.conjugate() - cpdef ModuleElement _rmul_(self, RingElement left): + cpdef _rmul_(self, RingElement left): """ Return left*self, where left is in the base ring. @@ -501,7 +501,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 ModuleElement _lmul_(self, RingElement right): + cpdef _lmul_(self, RingElement right): """ Return self*right, where right is in the base ring. @@ -515,7 +515,7 @@ cdef class QuaternionAlgebraElement_abstract(AlgebraElement): """ return self.__class__(self._parent, (self[0]*right, self[1]*right, self[2]*right, self[3]*right), check=False) - cpdef RingElement _div_(self, RingElement right): + cpdef _div_(self, RingElement right): """ Return quotient of self by right. @@ -724,7 +724,7 @@ cdef class QuaternionAlgebraElement_generic(QuaternionAlgebraElement_abstract): return (unpickle_QuaternionAlgebraElement_generic_v0, (self._parent, (self.x, self.y, self.z, self.w))) - cpdef ModuleElement _add_(self, ModuleElement _right): + cpdef _add_(self, ModuleElement _right): """ Return the sum of self and _right. @@ -740,7 +740,7 @@ cdef class QuaternionAlgebraElement_generic(QuaternionAlgebraElement_abstract): # TODO -- make this, etc. use __new__ return QuaternionAlgebraElement_generic(self._parent, (self.x + right.x, self.y + right.y, self.z + right.z, self.w + right.w), check=False) - cpdef ModuleElement _sub_(self, ModuleElement _right): + cpdef _sub_(self, ModuleElement _right): """ Return the difference of self and _right. @@ -755,7 +755,7 @@ cdef class QuaternionAlgebraElement_generic(QuaternionAlgebraElement_abstract): cdef QuaternionAlgebraElement_generic right = _right return QuaternionAlgebraElement_generic(self._parent, (self.x - right.x, self.y - right.y, self.z - right.z, self.w - right.w), check=False) - cpdef RingElement _mul_(self, RingElement _right): + cpdef _mul_(self, RingElement _right): """ Return the product of self and _right. @@ -1076,7 +1076,7 @@ cdef class QuaternionAlgebraElement_rational_field(QuaternionAlgebraElement_abst return (unpickle_QuaternionAlgebraElement_rational_field_v0, (self._parent, (self[0], self[1], self[2], self[3]))) - cpdef ModuleElement _add_(self, ModuleElement _right): + cpdef _add_(self, ModuleElement _right): """ EXAMPLES:: @@ -1132,7 +1132,7 @@ cdef class QuaternionAlgebraElement_rational_field(QuaternionAlgebraElement_abst mpz_set(result.b, self.b) return result - cpdef ModuleElement _sub_(self, ModuleElement _right): + cpdef _sub_(self, ModuleElement _right): """ EXAMPLES:: @@ -1173,7 +1173,7 @@ cdef class QuaternionAlgebraElement_rational_field(QuaternionAlgebraElement_abst mpz_set(result.b, self.b) return result - cpdef RingElement _mul_(self, RingElement _right): + cpdef _mul_(self, RingElement _right): """ EXAMPLES:: @@ -1739,7 +1739,7 @@ cdef class QuaternionAlgebraElement_number_field(QuaternionAlgebraElement_abstra return (unpickle_QuaternionAlgebraElement_number_field_v0, (self._parent, (self[0], self[1], self[2], self[3]))) - cpdef ModuleElement _add_(self, ModuleElement _right): + cpdef _add_(self, ModuleElement _right): """ Add self and _right: @@ -1810,7 +1810,7 @@ cdef class QuaternionAlgebraElement_number_field(QuaternionAlgebraElement_abstra return result - cpdef ModuleElement _sub_(self, ModuleElement _right): + cpdef _sub_(self, ModuleElement _right): """ Subtract _right from self. @@ -1860,7 +1860,7 @@ cdef class QuaternionAlgebraElement_number_field(QuaternionAlgebraElement_abstra return result - cpdef RingElement _mul_(self, RingElement _right): + cpdef _mul_(self, RingElement _right): """ Multiply self and _right. diff --git a/src/sage/geometry/toric_lattice_element.pyx b/src/sage/geometry/toric_lattice_element.pyx index 2a39ad678c2..984945b321a 100644 --- a/src/sage/geometry/toric_lattice_element.pyx +++ b/src/sage/geometry/toric_lattice_element.pyx @@ -316,7 +316,7 @@ cdef class ToricLatticeElement(Vector_integer_dense): # We need to override this function to prohibit default behaviour. # It seems to be called when right is in the same lattice as self, which # is wrong from our point of view. - cpdef Element _dot_product_(self, Vector right): + cpdef _dot_product_(self, Vector right): """ Raise a ``TypeError`` exception. diff --git a/src/sage/groups/libgap_wrapper.pxd b/src/sage/groups/libgap_wrapper.pxd index 22c2b4d0eb2..5ab5dad1776 100644 --- a/src/sage/groups/libgap_wrapper.pxd +++ b/src/sage/groups/libgap_wrapper.pxd @@ -5,8 +5,3 @@ from sage.libs.gap.element cimport GapElement cdef class ElementLibGAP(MultiplicativeGroupElement): cdef GapElement _libgap cpdef GapElement gap(self) - cpdef MonoidElement _mul_(left, MonoidElement right) - cpdef MultiplicativeGroupElement _div_(self, MultiplicativeGroupElement right) - - - diff --git a/src/sage/groups/libgap_wrapper.pyx b/src/sage/groups/libgap_wrapper.pyx index 935d18dd6cd..53bae4075f9 100644 --- a/src/sage/groups/libgap_wrapper.pyx +++ b/src/sage/groups/libgap_wrapper.pyx @@ -540,7 +540,7 @@ cdef class ElementLibGAP(MultiplicativeGroupElement): from sage.misc.latex import latex return latex(self._repr_()) - cpdef MonoidElement _mul_(left, MonoidElement right): + cpdef _mul_(left, MonoidElement right): """ Multiplication of group elements @@ -585,7 +585,7 @@ cdef class ElementLibGAP(MultiplicativeGroupElement): return cmp((left)._libgap, (right)._libgap) - cpdef MultiplicativeGroupElement _div_(left, MultiplicativeGroupElement right): + cpdef _div_(left, MultiplicativeGroupElement right): """ Division of group elements. diff --git a/src/sage/groups/matrix_gps/group_element.pyx b/src/sage/groups/matrix_gps/group_element.pyx index 0dd7a804dc9..db1064535e4 100644 --- a/src/sage/groups/matrix_gps/group_element.pyx +++ b/src/sage/groups/matrix_gps/group_element.pyx @@ -302,7 +302,7 @@ cdef class MatrixGroupElement_generic(MultiplicativeGroupElement): """ return self._matrix - cpdef MonoidElement _mul_(self, MonoidElement other): + cpdef _mul_(self, MonoidElement other): """ Return the product of ``self`` and`` other``, which must have identical parents. diff --git a/src/sage/groups/perm_gps/permgroup_element.pyx b/src/sage/groups/perm_gps/permgroup_element.pyx index 6165e340fbf..767731519d0 100644 --- a/src/sage/groups/perm_gps/permgroup_element.pyx +++ b/src/sage/groups/perm_gps/permgroup_element.pyx @@ -842,7 +842,7 @@ cdef class PermutationGroupElement(MultiplicativeGroupElement): elif is_Matrix(left): return left.with_permuted_rows(self) - cpdef MonoidElement _mul_(left, MonoidElement _right): + cpdef _mul_(left, MonoidElement _right): """ EXAMPLES:: diff --git a/src/sage/groups/semimonomial_transformations/semimonomial_transformation.pyx b/src/sage/groups/semimonomial_transformations/semimonomial_transformation.pyx index 7f73bd0f00c..2d40f6f57e9 100644 --- a/src/sage/groups/semimonomial_transformations/semimonomial_transformation.pyx +++ b/src/sage/groups/semimonomial_transformations/semimonomial_transformation.pyx @@ -171,7 +171,7 @@ cdef class SemimonomialTransformation(MultiplicativeGroupElement): """ return hash(self.v) + hash(self.perm) + hash(self.get_autom()) - cpdef MonoidElement _mul_(left, MonoidElement _right): + cpdef _mul_(left, MonoidElement _right): r""" Multiplication of elements. diff --git a/src/sage/libs/gap/element.pxd b/src/sage/libs/gap/element.pxd index b28ead6e035..12c0c236b38 100644 --- a/src/sage/libs/gap/element.pxd +++ b/src/sage/libs/gap/element.pxd @@ -42,10 +42,6 @@ cdef class GapElement(RingElement): cdef _initialize(self, parent, libGAP_Obj obj) cpdef _type_number(self) - cpdef ModuleElement _add_(self, ModuleElement right) - cpdef ModuleElement _sub_(self, ModuleElement right) - cpdef RingElement _mul_(self, RingElement right) - cpdef RingElement _div_(self, RingElement right) cpdef is_bool(self) diff --git a/src/sage/libs/gap/element.pyx b/src/sage/libs/gap/element.pyx index 9efbe1b03f9..c00fa0e7958 100644 --- a/src/sage/libs/gap/element.pyx +++ b/src/sage/libs/gap/element.pyx @@ -690,7 +690,7 @@ cdef class GapElement(RingElement): libgap_exit() return result - cpdef ModuleElement _add_(self, ModuleElement right): + cpdef _add_(self, ModuleElement right): r""" Add two GapElement objects. @@ -723,7 +723,7 @@ cdef class GapElement(RingElement): return make_any_gap_element(self.parent(), result) - cpdef ModuleElement _sub_(self, ModuleElement right): + cpdef _sub_(self, ModuleElement right): r""" Subtract two GapElement objects. @@ -756,7 +756,7 @@ cdef class GapElement(RingElement): return make_any_gap_element(self.parent(), result) - cpdef RingElement _mul_(self, RingElement right): + cpdef _mul_(self, RingElement right): r""" Multiply two GapElement objects. @@ -789,7 +789,7 @@ cdef class GapElement(RingElement): return make_any_gap_element(self.parent(), result) - cpdef RingElement _div_(self, RingElement right): + cpdef _div_(self, RingElement right): r""" Divide two GapElement objects. diff --git a/src/sage/libs/pari/gen.pyx b/src/sage/libs/pari/gen.pyx index 9514fb3cf72..2f2fbd849d0 100644 --- a/src/sage/libs/pari/gen.pyx +++ b/src/sage/libs/pari/gen.pyx @@ -240,19 +240,19 @@ cdef class gen(gen_auto): s = repr(self) return (objtogen, (s,)) - cpdef ModuleElement _add_(self, ModuleElement right): + cpdef _add_(self, ModuleElement right): sig_on() return P.new_gen(gadd(self.g, (right).g)) - cpdef ModuleElement _sub_(self, ModuleElement right): + cpdef _sub_(self, ModuleElement right): sig_on() return P.new_gen(gsub(self.g, ( right).g)) - cpdef RingElement _mul_(self, RingElement right): + cpdef _mul_(self, RingElement right): sig_on() return P.new_gen(gmul(self.g, (right).g)) - cpdef RingElement _div_(self, RingElement right): + cpdef _div_(self, RingElement right): sig_on() return P.new_gen(gdiv(self.g, (right).g)) diff --git a/src/sage/matrix/matrix0.pyx b/src/sage/matrix/matrix0.pyx index a444c00a22d..e99f6edc460 100644 --- a/src/sage/matrix/matrix0.pyx +++ b/src/sage/matrix/matrix0.pyx @@ -4592,7 +4592,7 @@ cdef class Matrix(sage.structure.element.Matrix): ################################################### # Arithmetic ################################################### - cdef Vector _vector_times_matrix_(self, Vector v): + cdef _vector_times_matrix_(self, Vector v): """ Returns the vector times matrix product. @@ -4650,7 +4650,7 @@ cdef class Matrix(sage.structure.element.Matrix): return sum([v[i] * self.row(i, from_list=True) for i in xrange(self._nrows)], M(0)) - cdef Vector _matrix_times_vector_(self, Vector v): + cdef _matrix_times_vector_(self, Vector v): """ EXAMPLES:: @@ -4760,7 +4760,7 @@ cdef class Matrix(sage.structure.element.Matrix): MS = self.matrix_space(n, m) return MS(X).transpose() - cpdef ModuleElement _add_(self, ModuleElement _right): + cpdef _add_(self, ModuleElement _right): """ Add two matrices with the same parent. @@ -4783,7 +4783,7 @@ cdef class Matrix(sage.structure.element.Matrix): A.set_unsafe(i,j,self.get_unsafe(i,j)._add_(right.get_unsafe(i,j))) return A - cpdef ModuleElement _sub_(self, ModuleElement _right): + cpdef _sub_(self, ModuleElement _right): """ Subtract two matrices with the same parent. @@ -4849,7 +4849,7 @@ cdef class Matrix(sage.structure.element.Matrix): return self.change_ring(self._base_ring.quotient_ring(p)) - cpdef ModuleElement _rmul_(self, RingElement left): + cpdef _rmul_(self, RingElement left): """ EXAMPLES:: @@ -4886,7 +4886,7 @@ cdef class Matrix(sage.structure.element.Matrix): ans.set_unsafe(r, c, x * self.get_unsafe(r, c)) return ans - cpdef ModuleElement _lmul_(self, RingElement right): + cpdef _lmul_(self, RingElement right): """ EXAMPLES: diff --git a/src/sage/matrix/matrix_cyclo_dense.pyx b/src/sage/matrix/matrix_cyclo_dense.pyx index a8d5692adde..01bb3b6b9fa 100644 --- a/src/sage/matrix/matrix_cyclo_dense.pyx +++ b/src/sage/matrix/matrix_cyclo_dense.pyx @@ -469,7 +469,7 @@ cdef class Matrix_cyclo_dense(matrix_dense.Matrix_dense): # * _dict -- sparse dictionary of underlying elements (need not be a copy) ######################################################################## - cpdef ModuleElement _add_(self, ModuleElement right): + cpdef _add_(self, ModuleElement right): """ Return the sum of two dense cyclotomic matrices. @@ -497,7 +497,7 @@ cdef class Matrix_cyclo_dense(matrix_dense.Matrix_dense): A._matrix = self._matrix + (right)._matrix return A - cpdef ModuleElement _sub_(self, ModuleElement right): + cpdef _sub_(self, ModuleElement right): """ Return the difference of two dense cyclotomic matrices. @@ -524,7 +524,7 @@ cdef class Matrix_cyclo_dense(matrix_dense.Matrix_dense): A._matrix = self._matrix - (right)._matrix return A - cpdef ModuleElement _lmul_(self, RingElement right): + cpdef _lmul_(self, RingElement right): """ Multiply a dense cyclotomic matrix by a scalar. @@ -566,7 +566,7 @@ cdef class Matrix_cyclo_dense(matrix_dense.Matrix_dense): A._matrix = T * self._matrix return A - cdef baseMatrix _matrix_times_matrix_(self, baseMatrix right): + cdef _matrix_times_matrix_(self, baseMatrix right): """ Return the product of two cyclotomic dense matrices. diff --git a/src/sage/matrix/matrix_double_dense.pyx b/src/sage/matrix/matrix_double_dense.pyx index bc2e873fa08..b3977f5a7c2 100644 --- a/src/sage/matrix/matrix_double_dense.pyx +++ b/src/sage/matrix/matrix_double_dense.pyx @@ -317,7 +317,7 @@ cdef class Matrix_double_dense(matrix_dense.Matrix_dense): # LEVEL 2 functionality # * def _pickle # * def _unpickle - cpdef ModuleElement _add_(self, ModuleElement right): + cpdef _add_(self, ModuleElement right): """ Add two matrices together. @@ -340,7 +340,7 @@ cdef class Matrix_double_dense(matrix_dense.Matrix_dense): M._matrix_numpy = _left._matrix_numpy + _right._matrix_numpy return M - cpdef ModuleElement _sub_(self, ModuleElement right): + cpdef _sub_(self, ModuleElement right): """ Return self - right @@ -3581,7 +3581,7 @@ cdef class Matrix_double_dense(matrix_dense.Matrix_dense): posdef = self.fetch(cache_str) return posdef - cdef Vector _vector_times_matrix_(self,Vector v): + cdef _vector_times_matrix_(self,Vector v): if self._nrows == 0 or self._ncols == 0: return self._row_ambient_module().zero_vector() global numpy @@ -3594,7 +3594,7 @@ cdef class Matrix_double_dense(matrix_dense.Matrix_dense): ans = numpy.dot(v_numpy,self._matrix_numpy) return M(ans) - cdef Vector _matrix_times_vector_(self,Vector v): + cdef _matrix_times_vector_(self,Vector v): if self._nrows == 0 or self._ncols == 0: return self._column_ambient_module().zero_vector() diff --git a/src/sage/matrix/matrix_generic_sparse.pyx b/src/sage/matrix/matrix_generic_sparse.pyx index 7994d4726a3..9199b3fdd9b 100644 --- a/src/sage/matrix/matrix_generic_sparse.pyx +++ b/src/sage/matrix/matrix_generic_sparse.pyx @@ -329,7 +329,7 @@ cdef class Matrix_generic_sparse(matrix_sparse.Matrix_sparse): # x * _dict -- copy of the sparse dictionary of underlying elements ######################################################################## - cpdef ModuleElement _add_(self, ModuleElement _other): + cpdef _add_(self, ModuleElement _other): """ EXAMPLES:: diff --git a/src/sage/matrix/matrix_gf2e_dense.pyx b/src/sage/matrix/matrix_gf2e_dense.pyx index 892ca5eb7dc..b9121fd3689 100644 --- a/src/sage/matrix/matrix_gf2e_dense.pyx +++ b/src/sage/matrix/matrix_gf2e_dense.pyx @@ -320,7 +320,7 @@ cdef class Matrix_gf2e_dense(matrix_dense.Matrix_dense): cdef int r = mzed_read_elem(self._entries, i, j) return word_to_poly(r, self._base_ring) - cpdef ModuleElement _add_(self, ModuleElement right): + cpdef _add_(self, ModuleElement right): """ Return A+B @@ -354,7 +354,7 @@ cdef class Matrix_gf2e_dense(matrix_dense.Matrix_dense): return A - cpdef ModuleElement _sub_(self, ModuleElement right): + cpdef _sub_(self, ModuleElement right): """ EXAMPLE:: @@ -426,7 +426,7 @@ cdef class Matrix_gf2e_dense(matrix_dense.Matrix_dense): sig_off() return ans - cdef Matrix _matrix_times_matrix_(self, Matrix right): + cdef _matrix_times_matrix_(self, Matrix right): """ Return A*B @@ -633,7 +633,7 @@ cdef class Matrix_gf2e_dense(matrix_dense.Matrix_dense): sig_off() return ans - cpdef ModuleElement _lmul_(self, RingElement right): + cpdef _lmul_(self, RingElement right): """ Return ``a*B`` for ``a`` an element of the base field. diff --git a/src/sage/matrix/matrix_gfpn_dense.pxd b/src/sage/matrix/matrix_gfpn_dense.pxd index 34487536b14..a2374d6f32f 100644 --- a/src/sage/matrix/matrix_gfpn_dense.pxd +++ b/src/sage/matrix/matrix_gfpn_dense.pxd @@ -24,6 +24,6 @@ cdef class Matrix_gfpn_dense(Matrix_dense): cdef set_unsafe_int(self, Py_ssize_t i, Py_ssize_t j, int value) cdef inline int get_unsafe_int(self, Py_ssize_t i, Py_ssize_t j) cdef list _rowlist_(self, i, j=*) - cdef Matrix _matrix_times_matrix_(self, Matrix right) + cdef _matrix_times_matrix_(self, Matrix right) cpdef Matrix_gfpn_dense _multiply_classical(Matrix_gfpn_dense self, Matrix_gfpn_dense right) cpdef Matrix_gfpn_dense _multiply_strassen(Matrix_gfpn_dense self, Matrix_gfpn_dense right, cutoff=*) diff --git a/src/sage/matrix/matrix_gfpn_dense.pyx b/src/sage/matrix/matrix_gfpn_dense.pyx index 90d5198fb88..b9c53cf674f 100644 --- a/src/sage/matrix/matrix_gfpn_dense.pyx +++ b/src/sage/matrix/matrix_gfpn_dense.pyx @@ -1042,7 +1042,7 @@ cdef class Matrix_gfpn_dense(Matrix_dense): memcpy(MatGetPtr(OUT.Data, self.Data.Nor), other.Data.Data, FfCurrentRowSize*other.Data.Nor) return OUT - cpdef ModuleElement _add_(self, ModuleElement right): + cpdef _add_(self, ModuleElement right): """ TESTS:: @@ -1066,7 +1066,7 @@ cdef class Matrix_gfpn_dense(Matrix_dense): MatAdd(Left.Data, Right.Data) return Left - cpdef ModuleElement _sub_(self, ModuleElement right): + cpdef _sub_(self, ModuleElement right): """ TESTS:: @@ -1113,7 +1113,7 @@ cdef class Matrix_gfpn_dense(Matrix_dense): raise ValueError("The matrix must not be empty") return self._rmul_(self._base_ring(-1)) - cpdef ModuleElement _rmul_(self, RingElement left): + cpdef _rmul_(self, RingElement left): """ EXAMPLES:: @@ -1136,7 +1136,7 @@ cdef class Matrix_gfpn_dense(Matrix_dense): MatMulScalar(OUT.Data, FfFromInt(self._converter.field_to_int(left))) return OUT - cpdef ModuleElement _lmul_(self, RingElement right): + cpdef _lmul_(self, RingElement right): """ EXAMPLES:: @@ -1232,8 +1232,10 @@ cdef class Matrix_gfpn_dense(Matrix_dense): sig_off() return OUT - cdef ModuleElement _mul_long(self, long n): - "multiply an MTX matrix with a field element represented by an integer" + cdef _mul_long(self, long n): + """ + Multiply an MTX matrix with a field element represented by an integer + """ if self.Data == NULL: raise ValueError("The matrix must not be empty") cdef Matrix_gfpn_dense left diff --git a/src/sage/matrix/matrix_integer_dense.pyx b/src/sage/matrix/matrix_integer_dense.pyx index 4b516620bf8..7adefd3d371 100644 --- a/src/sage/matrix/matrix_integer_dense.pyx +++ b/src/sage/matrix/matrix_integer_dense.pyx @@ -915,7 +915,7 @@ cdef class Matrix_integer_dense(matrix_dense.Matrix_dense): # dense or sparse return M - cpdef ModuleElement _lmul_(self, RingElement right): + cpdef _lmul_(self, RingElement right): """ EXAMPLES:: @@ -935,7 +935,7 @@ cdef class Matrix_integer_dense(matrix_dense.Matrix_dense): # dense or sparse sig_off() return M - cpdef ModuleElement _add_(self, ModuleElement right): + cpdef _add_(self, ModuleElement right): """ Add two dense matrices over ZZ. @@ -960,7 +960,7 @@ cdef class Matrix_integer_dense(matrix_dense.Matrix_dense): # dense or sparse sig_off() return M - cpdef ModuleElement _sub_(self, ModuleElement right): + cpdef _sub_(self, ModuleElement right): """ Subtract two dense matrices over ZZ. @@ -1127,7 +1127,7 @@ cdef class Matrix_integer_dense(matrix_dense.Matrix_dense): # dense or sparse return 0 # TODO: Implement better - cdef Vector _vector_times_matrix_(self, Vector v): + cdef _vector_times_matrix_(self, Vector v): """ Returns the vector times matrix product. diff --git a/src/sage/matrix/matrix_integer_sparse.pyx b/src/sage/matrix/matrix_integer_sparse.pyx index 7e1c4543d85..25521178738 100644 --- a/src/sage/matrix/matrix_integer_sparse.pyx +++ b/src/sage/matrix/matrix_integer_sparse.pyx @@ -175,7 +175,7 @@ cdef class Matrix_integer_sparse(matrix_sparse.Matrix_sparse): ######################################################################## # def _pickle(self): # def _unpickle(self, data, int version): # use version >= 0 - # cpdef ModuleElement _add_(self, ModuleElement right): + # cpdef _add_(self, ModuleElement right): # cdef _mul_(self, Matrix right): # cpdef int _cmp_(self, Matrix right) except -2: # def __neg__(self): @@ -184,7 +184,7 @@ cdef class Matrix_integer_sparse(matrix_sparse.Matrix_sparse): # def _multiply_classical(left, matrix.Matrix _right): # def _list(self): - cpdef ModuleElement _lmul_(self, RingElement right): + cpdef _lmul_(self, RingElement right): """ EXAMPLES:: @@ -206,7 +206,7 @@ cdef class Matrix_integer_sparse(matrix_sparse.Matrix_sparse): mpz_vector_scalar_multiply(M_row, self_row, _x.value) return M - cpdef ModuleElement _add_(self, ModuleElement right): + cpdef _add_(self, ModuleElement right): cdef Py_ssize_t i, j cdef mpz_vector *self_row cdef mpz_vector *M_row @@ -221,7 +221,7 @@ cdef class Matrix_integer_sparse(matrix_sparse.Matrix_sparse): mpz_clear(mul) return M - cpdef ModuleElement _sub_(self, ModuleElement right): + cpdef _sub_(self, ModuleElement right): cdef Py_ssize_t i, j cdef mpz_vector *self_row cdef mpz_vector *M_row diff --git a/src/sage/matrix/matrix_mod2_dense.pyx b/src/sage/matrix/matrix_mod2_dense.pyx index 45c6e3fd660..3bef20ea33a 100644 --- a/src/sage/matrix/matrix_mod2_dense.pyx +++ b/src/sage/matrix/matrix_mod2_dense.pyx @@ -560,7 +560,7 @@ cdef class Matrix_mod2_dense(matrix_dense.Matrix_dense): # dense or sparse # def _pickle(self): # def _unpickle(self, data, int version): # use version >= 0 - cpdef ModuleElement _add_(self, ModuleElement right): + cpdef _add_(self, ModuleElement right): """ Matrix addition. @@ -598,7 +598,7 @@ cdef class Matrix_mod2_dense(matrix_dense.Matrix_dense): # dense or sparse return A - cpdef ModuleElement _sub_(self, ModuleElement right): + cpdef _sub_(self, ModuleElement right): """ Matrix addition. @@ -614,7 +614,7 @@ cdef class Matrix_mod2_dense(matrix_dense.Matrix_dense): # dense or sparse """ return self._add_(right) - cdef Vector _matrix_times_vector_(self, Vector v): + cdef _matrix_times_vector_(self, Vector v): """ EXAMPLES:: @@ -656,7 +656,7 @@ cdef class Matrix_mod2_dense(matrix_dense.Matrix_dense): # dense or sparse mzd_free(tmp) return c - cdef Matrix _matrix_times_matrix_(self, Matrix right): + cdef _matrix_times_matrix_(self, Matrix right): """ Matrix multiplication. diff --git a/src/sage/matrix/matrix_modn_dense_template.pxi b/src/sage/matrix/matrix_modn_dense_template.pxi index ad24a8ef407..89d7d2f08b3 100644 --- a/src/sage/matrix/matrix_modn_dense_template.pxi +++ b/src/sage/matrix/matrix_modn_dense_template.pxi @@ -798,7 +798,7 @@ cdef class Matrix_modn_dense_template(matrix_dense.Matrix_dense): return M - cpdef ModuleElement _lmul_(self, RingElement right): + cpdef _lmul_(self, RingElement right): """ EXAMPLES:: @@ -808,7 +808,7 @@ cdef class Matrix_modn_dense_template(matrix_dense.Matrix_dense): """ return self._rmul_(right) - cpdef ModuleElement _rmul_(self, RingElement left): + cpdef _rmul_(self, RingElement left): """ EXAMPLES:: @@ -856,7 +856,7 @@ cdef class Matrix_modn_dense_template(matrix_dense.Matrix_dense): return A - cpdef ModuleElement _add_(self, ModuleElement right): + cpdef _add_(self, ModuleElement right): """ Add two dense matrices over `\Z/n\Z` @@ -900,7 +900,7 @@ cdef class Matrix_modn_dense_template(matrix_dense.Matrix_dense): return M - cpdef ModuleElement _sub_(self, ModuleElement right): + cpdef _sub_(self, ModuleElement right): r""" Subtract two dense matrices over `\Z/n\Z` @@ -990,7 +990,7 @@ cdef class Matrix_modn_dense_template(matrix_dense.Matrix_dense): return 0 - cdef Matrix _matrix_times_matrix_(self, Matrix right): + cdef _matrix_times_matrix_(self, Matrix right): """ return ``self*right`` @@ -1191,7 +1191,7 @@ cdef class Matrix_modn_dense_template(matrix_dense.Matrix_dense): return ans - cdef Vector _vector_times_matrix_(self, Vector v): + cdef _vector_times_matrix_(self, Vector v): """ ``v*self`` @@ -1248,7 +1248,7 @@ cdef class Matrix_modn_dense_template(matrix_dense.Matrix_dense): sig_free(_c) return c - cdef Vector _matrix_times_vector_(self, Vector v): + cdef _matrix_times_vector_(self, Vector v): """ ``self*v`` diff --git a/src/sage/matrix/matrix_modn_sparse.pyx b/src/sage/matrix/matrix_modn_sparse.pyx index cfac6f6f041..01af1b22bdb 100644 --- a/src/sage/matrix/matrix_modn_sparse.pyx +++ b/src/sage/matrix/matrix_modn_sparse.pyx @@ -255,7 +255,7 @@ cdef class Matrix_modn_sparse(matrix_sparse.Matrix_sparse): ######################################################################## # def _pickle(self): # def _unpickle(self, data, int version): # use version >= 0 - # cpdef ModuleElement _add_(self, ModuleElement right): + # cpdef _add_(self, ModuleElement right): # cdef _mul_(self, Matrix right): # cpdef int _cmp_(self, Matrix right) except -2: # def __neg__(self): diff --git a/src/sage/matrix/matrix_rational_dense.pyx b/src/sage/matrix/matrix_rational_dense.pyx index 0344f09a56d..15f843f70f4 100644 --- a/src/sage/matrix/matrix_rational_dense.pyx +++ b/src/sage/matrix/matrix_rational_dense.pyx @@ -324,7 +324,7 @@ cdef class Matrix_rational_dense(matrix_dense.Matrix_dense): # * _dict -- sparse dictionary of underlying elements (need not be a copy) ######################################################################## - cpdef ModuleElement _lmul_(self, RingElement right): + cpdef _lmul_(self, RingElement right): """ EXAMPLES:: @@ -342,7 +342,7 @@ cdef class Matrix_rational_dense(matrix_dense.Matrix_dense): mpq_mul(M._entries[i], self._entries[i], _x.value) return M - cpdef ModuleElement _add_(self, ModuleElement right): + cpdef _add_(self, ModuleElement right): """ Add two dense matrices over QQ. @@ -377,7 +377,7 @@ cdef class Matrix_rational_dense(matrix_dense.Matrix_dense): sig_off() return M - cpdef ModuleElement _sub_(self, ModuleElement right): + cpdef _sub_(self, ModuleElement right): """ Subtract two dense matrices over QQ. @@ -427,7 +427,7 @@ cdef class Matrix_rational_dense(matrix_dense.Matrix_dense): return 1 return 0 - cdef Vector _vector_times_matrix_(self, Vector v): + cdef _vector_times_matrix_(self, Vector v): """ Returns the vector times matrix product. diff --git a/src/sage/matrix/matrix_rational_sparse.pyx b/src/sage/matrix/matrix_rational_sparse.pyx index 31241d078c1..b16075797d8 100644 --- a/src/sage/matrix/matrix_rational_sparse.pyx +++ b/src/sage/matrix/matrix_rational_sparse.pyx @@ -275,7 +275,7 @@ cdef class Matrix_rational_sparse(matrix_sparse.Matrix_sparse): ######################################################################## # def _pickle(self): # def _unpickle(self, data, int version): # use version >= 0 - # cpdef ModuleElement _add_(self, ModuleElement right): + # cpdef _add_(self, ModuleElement right): # cdef _mul_(self, Matrix right): # cpdef int _cmp_(self, Matrix right) except -2: # def __neg__(self): @@ -285,7 +285,7 @@ cdef class Matrix_rational_sparse(matrix_sparse.Matrix_sparse): # def _list(self): # TODO -## cpdef ModuleElement _lmul_(self, RingElement right): +## cpdef _lmul_(self, RingElement 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 b16142e2d42..fc129ad1481 100644 --- a/src/sage/matrix/matrix_sparse.pyx +++ b/src/sage/matrix/matrix_sparse.pyx @@ -292,7 +292,7 @@ cdef class Matrix_sparse(matrix.Matrix): return left.new_matrix(left._nrows, right._ncols, entries=e, coerce=False, copy=False) - cpdef ModuleElement _lmul_(self, RingElement right): + cpdef _lmul_(self, RingElement right): """ Left scalar multiplication. Internal usage only. @@ -1007,7 +1007,7 @@ cdef class Matrix_sparse(matrix.Matrix): Z._subdivide_on_augment(self, other) return Z - cdef Vector _vector_times_matrix_(self, Vector v): + cdef _vector_times_matrix_(self, Vector v): """ Returns the vector times matrix product. @@ -1040,7 +1040,7 @@ cdef class Matrix_sparse(matrix.Matrix): s[j] += v[i] * a return s - cdef Vector _matrix_times_vector_(self, Vector v): + cdef _matrix_times_vector_(self, Vector v): """ Returns the matrix times vector product. diff --git a/src/sage/modular/arithgroup/arithgroup_element.pyx b/src/sage/modular/arithgroup/arithgroup_element.pyx index 167c100dc63..d8c79e421d7 100644 --- a/src/sage/modular/arithgroup/arithgroup_element.pyx +++ b/src/sage/modular/arithgroup/arithgroup_element.pyx @@ -202,7 +202,7 @@ cdef class ArithmeticSubgroupElement(MultiplicativeGroupElement): """ return True - cpdef MonoidElement _mul_(self, MonoidElement right): + cpdef _mul_(self, MonoidElement right): """ Return self * right. diff --git a/src/sage/modules/free_module_element.pyx b/src/sage/modules/free_module_element.pyx index 8a2904801c2..bf827235275 100644 --- a/src/sage/modules/free_module_element.pyx +++ b/src/sage/modules/free_module_element.pyx @@ -2375,7 +2375,7 @@ cdef class FreeModuleElement(Vector): # abstract base class else: return points(v, **kwds) - cpdef Element _dot_product_coerce_(left, Vector right): + cpdef _dot_product_coerce_(left, Vector right): """ Return the dot product of left and right. @@ -4097,7 +4097,7 @@ cdef class FreeModuleElement_generic_dense(FreeModuleElement): @cython.boundscheck(False) @cython.wraparound(False) - cpdef ModuleElement _add_(left, ModuleElement right): + cpdef _add_(left, ModuleElement right): """ Add left and right. @@ -4114,7 +4114,7 @@ cdef class FreeModuleElement_generic_dense(FreeModuleElement): @cython.boundscheck(False) @cython.wraparound(False) - cpdef ModuleElement _sub_(left, ModuleElement right): + cpdef _sub_(left, ModuleElement right): """ Subtract right from left. @@ -4132,7 +4132,7 @@ cdef class FreeModuleElement_generic_dense(FreeModuleElement): v = [( a[i])._sub_( b[i]) for i in range(left._degree)] return left._new_c(v) - cpdef ModuleElement _rmul_(self, RingElement left): + cpdef _rmul_(self, RingElement left): """ EXAMPLES:: @@ -4146,7 +4146,7 @@ cdef class FreeModuleElement_generic_dense(FreeModuleElement): v = [left * x for x in self._entries] return self._new_c(v) - cpdef ModuleElement _lmul_(self, RingElement right): + cpdef _lmul_(self, RingElement right): """ EXAMPLES:: @@ -4164,7 +4164,7 @@ cdef class FreeModuleElement_generic_dense(FreeModuleElement): @cython.boundscheck(False) @cython.wraparound(False) - cpdef Vector _pairwise_product_(left, Vector right): + cpdef _pairwise_product_(left, Vector right): """ EXAMPLES:: @@ -4540,7 +4540,7 @@ cdef class FreeModuleElement_generic_sparse(FreeModuleElement): entries = dict(entries) # make a copy/convert to dict self._entries = entries - cpdef ModuleElement _add_(left, ModuleElement right): + cpdef _add_(left, ModuleElement right): """ Add left and right. @@ -4562,7 +4562,7 @@ cdef class FreeModuleElement_generic_sparse(FreeModuleElement): v[i] = a return left._new_c(v) - cpdef ModuleElement _sub_(left, ModuleElement right): + cpdef _sub_(left, ModuleElement right): """ EXAMPLES:: @@ -4582,7 +4582,7 @@ cdef class FreeModuleElement_generic_sparse(FreeModuleElement): v[i] = -a return left._new_c(v) - cpdef ModuleElement _lmul_(self, RingElement right): + cpdef _lmul_(self, RingElement right): """ EXAMPLES:: @@ -4598,7 +4598,7 @@ cdef class FreeModuleElement_generic_sparse(FreeModuleElement): v[i] = prod return self._new_c(v) - cpdef ModuleElement _rmul_(self, RingElement left): + cpdef _rmul_(self, RingElement left): """ EXAMPLES:: @@ -4614,7 +4614,7 @@ cdef class FreeModuleElement_generic_sparse(FreeModuleElement): v[i] = prod return self._new_c(v) - cpdef Element _dot_product_coerce_(left, Vector right): + cpdef _dot_product_coerce_(left, Vector right): """ Return the dot product of left and right. @@ -4666,7 +4666,7 @@ cdef class FreeModuleElement_generic_sparse(FreeModuleElement): z += a * e[i] return z - cpdef Vector _pairwise_product_(left, Vector right): + cpdef _pairwise_product_(left, Vector right): """ EXAMPLES:: diff --git a/src/sage/modules/vector_double_dense.pyx b/src/sage/modules/vector_double_dense.pyx index 0cae3fb2a89..760c327fadc 100644 --- a/src/sage/modules/vector_double_dense.pyx +++ b/src/sage/modules/vector_double_dense.pyx @@ -271,7 +271,7 @@ cdef class Vector_double_dense(FreeModuleElement): numpy.PyArray_GETPTR1(self._vector_numpy, i))) - cpdef ModuleElement _add_(self, ModuleElement right): + cpdef _add_(self, ModuleElement right): """ Add two vectors together. @@ -291,7 +291,7 @@ cdef class Vector_double_dense(FreeModuleElement): return self._new(_left._vector_numpy + _right._vector_numpy) - cpdef ModuleElement _sub_(self, ModuleElement right): + cpdef _sub_(self, ModuleElement right): """ Return self - right @@ -311,7 +311,7 @@ cdef class Vector_double_dense(FreeModuleElement): return self._new(_left._vector_numpy - _right._vector_numpy) - cpdef Element _dot_product_(self, Vector right): + cpdef _dot_product_(self, Vector right): """ Dot product of self and right. @@ -335,7 +335,7 @@ cdef class Vector_double_dense(FreeModuleElement): return self._sage_dtype(numpy.dot(_left._vector_numpy, _right._vector_numpy)) - cpdef Vector _pairwise_product_(self, Vector right): + cpdef _pairwise_product_(self, Vector right): """ Return the component-wise product of self and right. @@ -358,7 +358,7 @@ cdef class Vector_double_dense(FreeModuleElement): return self._new(_left._vector_numpy * _right._vector_numpy) - cpdef ModuleElement _rmul_(self, RingElement left): + cpdef _rmul_(self, RingElement left): """ Multiply a scalar and vector @@ -375,7 +375,7 @@ cdef class Vector_double_dense(FreeModuleElement): return self._new(self._python_dtype(left)*self._vector_numpy) - cpdef ModuleElement _lmul_(self, RingElement right): + cpdef _lmul_(self, RingElement 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 27d13bbb923..9860212e71d 100644 --- a/src/sage/modules/vector_integer_dense.pyx +++ b/src/sage/modules/vector_integer_dense.pyx @@ -213,7 +213,7 @@ cdef class Vector_integer_dense(free_module_element.FreeModuleElement): def __reduce__(self): return (unpickle_v1, (self._parent, self.list(), self._degree, self._is_mutable)) - cpdef ModuleElement _add_(self, ModuleElement right): + cpdef _add_(self, ModuleElement right): cdef Vector_integer_dense z, r r = right z = self._new_c() @@ -224,7 +224,7 @@ cdef class Vector_integer_dense(free_module_element.FreeModuleElement): return z - cpdef ModuleElement _sub_(self, ModuleElement right): + cpdef _sub_(self, ModuleElement right): cdef Vector_integer_dense z, r r = right z = self._new_c() @@ -234,7 +234,7 @@ cdef class Vector_integer_dense(free_module_element.FreeModuleElement): mpz_sub(z._entries[i], self._entries[i], r._entries[i]) return z - cpdef Element _dot_product_(self, Vector right): + cpdef _dot_product_(self, Vector right): """ Dot product of dense vectors over the integers. @@ -259,7 +259,7 @@ cdef class Vector_integer_dense(free_module_element.FreeModuleElement): mpz_clear(t) return z - cpdef Vector _pairwise_product_(self, Vector right): + cpdef _pairwise_product_(self, Vector right): """ EXAMPLES:: @@ -276,7 +276,7 @@ cdef class Vector_integer_dense(free_module_element.FreeModuleElement): mpz_mul(z._entries[i], self._entries[i], r._entries[i]) return z - cpdef ModuleElement _rmul_(self, RingElement left): + cpdef _rmul_(self, RingElement left): cdef Vector_integer_dense z cdef Integer a a = left @@ -287,7 +287,7 @@ cdef class Vector_integer_dense(free_module_element.FreeModuleElement): mpz_mul(z._entries[i], self._entries[i], a.value) return z - cpdef ModuleElement _lmul_(self, RingElement right): + cpdef _lmul_(self, RingElement right): cdef Vector_integer_dense z cdef Integer a a = right @@ -298,7 +298,7 @@ cdef class Vector_integer_dense(free_module_element.FreeModuleElement): mpz_mul(z._entries[i], self._entries[i], a.value) return z - cpdef ModuleElement _neg_(self): + cpdef _neg_(self): cdef Vector_integer_dense z z = self._new_c() cdef Py_ssize_t i diff --git a/src/sage/modules/vector_mod2_dense.pyx b/src/sage/modules/vector_mod2_dense.pyx index 6015ccc1821..1246b0f3248 100644 --- a/src/sage/modules/vector_mod2_dense.pyx +++ b/src/sage/modules/vector_mod2_dense.pyx @@ -263,7 +263,7 @@ cdef class Vector_mod2_dense(free_module_element.FreeModuleElement): """ return unpickle_v0, (self._parent, self.list(), self._degree, self._is_mutable) - cpdef ModuleElement _add_(self, ModuleElement right): + cpdef _add_(self, ModuleElement right): """ EXAMPLE:: @@ -278,7 +278,7 @@ cdef class Vector_mod2_dense(free_module_element.FreeModuleElement): mzd_add(z._entries, self._entries, (right)._entries) return z - cpdef ModuleElement _sub_(self, ModuleElement right): + cpdef _sub_(self, ModuleElement right): """ EXAMPLE:: @@ -309,7 +309,7 @@ cdef class Vector_mod2_dense(free_module_element.FreeModuleElement): return res - cpdef Element _dot_product_(self, Vector right): + cpdef _dot_product_(self, Vector right): """ EXAMPLES:: sage: VS = VectorSpace(GF(2),3) @@ -355,7 +355,7 @@ cdef class Vector_mod2_dense(free_module_element.FreeModuleElement): return n - cpdef Vector _pairwise_product_(self, Vector right): + cpdef _pairwise_product_(self, Vector right): """ EXAMPLE:: @@ -375,7 +375,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 ModuleElement _rmul_(self, RingElement left): + cpdef _rmul_(self, RingElement left): """ EXAMPLE:: @@ -397,7 +397,7 @@ cdef class Vector_mod2_dense(free_module_element.FreeModuleElement): return self._new_c() - cpdef ModuleElement _lmul_(self, RingElement right): + cpdef _lmul_(self, RingElement right): """ EXAMPLE:: @@ -413,7 +413,7 @@ cdef class Vector_mod2_dense(free_module_element.FreeModuleElement): """ return self._rmul_(right) - cpdef ModuleElement _neg_(self): + cpdef _neg_(self): """ EXAMPLE:: diff --git a/src/sage/modules/vector_modn_dense.pyx b/src/sage/modules/vector_modn_dense.pyx index a91d7afdd35..729daa1fd3f 100644 --- a/src/sage/modules/vector_modn_dense.pyx +++ b/src/sage/modules/vector_modn_dense.pyx @@ -256,7 +256,7 @@ cdef class Vector_modn_dense(free_module_element.FreeModuleElement): def __reduce__(self): return unpickle_v1, (self._parent, self.list(), self._degree, self._p, self._is_mutable) - cpdef ModuleElement _add_(self, ModuleElement right): + cpdef _add_(self, ModuleElement right): cdef Vector_modn_dense z, r r = right z = self._new_c() @@ -266,7 +266,7 @@ cdef class Vector_modn_dense(free_module_element.FreeModuleElement): return z - cpdef ModuleElement _sub_(self, ModuleElement right): + cpdef _sub_(self, ModuleElement right): cdef Vector_modn_dense z, r r = right z = self._new_c() @@ -275,7 +275,7 @@ cdef class Vector_modn_dense(free_module_element.FreeModuleElement): z._entries[i] = (self._p + self._entries[i] - r._entries[i]) % self._p return z - cpdef Element _dot_product_(self, Vector right): + cpdef _dot_product_(self, Vector right): cdef Py_ssize_t i cdef IntegerMod_int n cdef Vector_modn_dense r = right @@ -288,7 +288,7 @@ cdef class Vector_modn_dense(free_module_element.FreeModuleElement): return n - cpdef Vector _pairwise_product_(self, Vector right): + cpdef _pairwise_product_(self, Vector right): """ EXAMPLES: sage: v = vector(Integers(8), [2,3]); w = vector(Integers(8), [2,5]) @@ -305,7 +305,7 @@ cdef class Vector_modn_dense(free_module_element.FreeModuleElement): z._entries[i] = (self._entries[i] * r._entries[i]) % self._p return z - cpdef ModuleElement _rmul_(self, RingElement left): + cpdef _rmul_(self, RingElement left): cdef Vector_modn_dense z cdef mod_int a = ivalue(left) @@ -316,10 +316,10 @@ cdef class Vector_modn_dense(free_module_element.FreeModuleElement): z._entries[i] = (self._entries[i] * a) % self._p return z - cpdef ModuleElement _lmul_(self, RingElement right): + cpdef _lmul_(self, RingElement right): return self._rmul_(right) - cpdef ModuleElement _neg_(self): + cpdef _neg_(self): cdef Vector_modn_dense z z = self._new_c() cdef Py_ssize_t i diff --git a/src/sage/modules/vector_rational_dense.pyx b/src/sage/modules/vector_rational_dense.pyx index 1433d9dbb8a..dcb00959b9a 100644 --- a/src/sage/modules/vector_rational_dense.pyx +++ b/src/sage/modules/vector_rational_dense.pyx @@ -242,7 +242,7 @@ cdef class Vector_rational_dense(free_module_element.FreeModuleElement): def __reduce__(self): return (unpickle_v1, (self._parent, self.list(), self._degree, self._is_mutable)) - cpdef ModuleElement _add_(self, ModuleElement right): + cpdef _add_(self, ModuleElement right): cdef Vector_rational_dense z, r r = right z = self._new_c() @@ -253,7 +253,7 @@ cdef class Vector_rational_dense(free_module_element.FreeModuleElement): return z - cpdef ModuleElement _sub_(self, ModuleElement right): + cpdef _sub_(self, ModuleElement right): cdef Vector_rational_dense z, r r = right z = self._new_c() @@ -263,7 +263,7 @@ cdef class Vector_rational_dense(free_module_element.FreeModuleElement): mpq_sub(z._entries[i], self._entries[i], r._entries[i]) return z - cpdef Element _dot_product_(self, Vector right): + cpdef _dot_product_(self, Vector right): """ Dot product of dense vectors over the rationals. @@ -289,7 +289,7 @@ cdef class Vector_rational_dense(free_module_element.FreeModuleElement): return z - cpdef Vector _pairwise_product_(self, Vector right): + cpdef _pairwise_product_(self, Vector right): """ EXAMPLES:: @@ -306,7 +306,7 @@ cdef class Vector_rational_dense(free_module_element.FreeModuleElement): mpq_mul(z._entries[i], self._entries[i], r._entries[i]) return z - cpdef ModuleElement _rmul_(self, RingElement left): + cpdef _rmul_(self, RingElement left): cdef Vector_rational_dense z cdef Rational a if isinstance(left, Rational): @@ -325,7 +325,7 @@ cdef class Vector_rational_dense(free_module_element.FreeModuleElement): return z - cpdef ModuleElement _lmul_(self, RingElement right): + cpdef _lmul_(self, RingElement right): cdef Vector_rational_dense z cdef Rational a if isinstance(right, Rational): @@ -343,7 +343,7 @@ cdef class Vector_rational_dense(free_module_element.FreeModuleElement): mpq_mul(z._entries[i], self._entries[i], a.value) return z - cpdef ModuleElement _neg_(self): + cpdef _neg_(self): cdef Vector_rational_dense z z = self._new_c() cdef Py_ssize_t i diff --git a/src/sage/numerical/linear_functions.pxd b/src/sage/numerical/linear_functions.pxd index c531b11a1fe..bf447586b6e 100644 --- a/src/sage/numerical/linear_functions.pxd +++ b/src/sage/numerical/linear_functions.pxd @@ -14,11 +14,6 @@ cdef class LinearFunctionsParent_class(Parent): cdef class LinearFunction(LinearFunctionOrConstraint): cdef dict _f cpdef iteritems(self) - cpdef ModuleElement _add_(self, ModuleElement b) - cpdef ModuleElement _sub_(self, ModuleElement b) - cpdef ModuleElement _lmul_(self, RingElement b) - cpdef ModuleElement _rmul_(self, RingElement b) - cpdef ModuleElement _neg_(self) cpdef _acted_upon_(self, x, bint self_on_left) cpdef is_zero(self) cpdef equals(LinearFunction left, LinearFunction right) diff --git a/src/sage/numerical/linear_functions.pyx b/src/sage/numerical/linear_functions.pyx index 0266a33030d..2d2498d917a 100644 --- a/src/sage/numerical/linear_functions.pyx +++ b/src/sage/numerical/linear_functions.pyx @@ -905,7 +905,7 @@ cdef class LinearFunction(LinearFunctionOrConstraint): except KeyError: return self.parent().base_ring().zero() - cpdef ModuleElement _add_(self, ModuleElement b): + cpdef _add_(self, ModuleElement b): r""" Defining the + operator @@ -921,7 +921,7 @@ cdef class LinearFunction(LinearFunctionOrConstraint): P = self.parent() return P(e) - cpdef ModuleElement _neg_(self): + cpdef _neg_(self): r""" Defining the - operator (opposite). @@ -934,7 +934,7 @@ cdef class LinearFunction(LinearFunctionOrConstraint): P = self.parent() return P(dict([(id,-coeff) for (id, coeff) in self._f.iteritems()])) - cpdef ModuleElement _sub_(self, ModuleElement b): + cpdef _sub_(self, ModuleElement b): r""" Defining the - operator (substraction). @@ -952,7 +952,7 @@ cdef class LinearFunction(LinearFunctionOrConstraint): P = self.parent() return P(e) - cpdef ModuleElement _rmul_(self, RingElement b): + cpdef _rmul_(self, RingElement b): r""" Left multiplication by scalars @@ -965,7 +965,7 @@ cdef class LinearFunction(LinearFunctionOrConstraint): P = self.parent() return P(dict([(id,b*coeff) for (id, coeff) in self._f.iteritems()])) - cpdef ModuleElement _lmul_(self, RingElement b): + cpdef _lmul_(self, RingElement b): r""" Right multiplication by scalars diff --git a/src/sage/numerical/linear_tensor_element.pyx b/src/sage/numerical/linear_tensor_element.pyx index 1fbd71116d5..5ee3c7bc70c 100644 --- a/src/sage/numerical/linear_tensor_element.pyx +++ b/src/sage/numerical/linear_tensor_element.pyx @@ -261,7 +261,7 @@ cdef class LinearTensor(ModuleElement): s += ']' return s - cpdef ModuleElement _add_(self, ModuleElement b): + cpdef _add_(self, ModuleElement b): r""" Return sum. @@ -285,7 +285,7 @@ cdef class LinearTensor(ModuleElement): result[key] = self._f.get(key, 0) + coeff return self.parent()(result) - cpdef ModuleElement _neg_(self): + cpdef _neg_(self): r""" Return the negative. @@ -305,7 +305,7 @@ cdef class LinearTensor(ModuleElement): result[key] = -coeff return self.parent()(result) - cpdef ModuleElement _sub_(self, ModuleElement b): + cpdef _sub_(self, ModuleElement b): r""" Return difference. @@ -331,7 +331,7 @@ cdef class LinearTensor(ModuleElement): result[key] = self._f.get(key, 0) - coeff return self.parent()(result) - cpdef ModuleElement _rmul_(self, RingElement b): + cpdef _rmul_(self, RingElement b): r""" Return right multiplication by scalar. diff --git a/src/sage/quivers/algebra_elements.pyx b/src/sage/quivers/algebra_elements.pyx index e615fe4e8e0..9d9b03cd330 100644 --- a/src/sage/quivers/algebra_elements.pyx +++ b/src/sage/quivers/algebra_elements.pyx @@ -1014,7 +1014,7 @@ cdef class PathAlgebraElement(RingElement): return 1 # negation - cpdef ModuleElement _neg_(self): + cpdef _neg_(self): """ EXAMPLES:: @@ -1028,7 +1028,7 @@ cdef class PathAlgebraElement(RingElement): return self._new_(homog_poly_neg(self.data)) # addition - cpdef ModuleElement _add_(self, ModuleElement other): + cpdef _add_(self, ModuleElement other): """ EXAMPLES:: @@ -1105,7 +1105,7 @@ cdef class PathAlgebraElement(RingElement): H1 = H1.nxt H2 = H2.nxt - cpdef ModuleElement _sub_(self, ModuleElement other): + cpdef _sub_(self, ModuleElement other): """ EXAMPLES:: @@ -1195,7 +1195,7 @@ cdef class PathAlgebraElement(RingElement): ## (scalar) multiplication - cpdef ModuleElement _lmul_(self, RingElement right): + cpdef _lmul_(self, RingElement right): """ EXAMPLES:: @@ -1226,7 +1226,7 @@ cdef class PathAlgebraElement(RingElement): return self._new_(outnxt) return self._new_(out) - cpdef ModuleElement _rmul_(self, RingElement left): + cpdef _rmul_(self, RingElement left): """ EXAMPLES:: @@ -1298,7 +1298,7 @@ cdef class PathAlgebraElement(RingElement): ## Multiplication in the algebra - cpdef RingElement _mul_(self, RingElement other): + cpdef _mul_(self, RingElement other): """ EXAMPLES:: diff --git a/src/sage/quivers/paths.pyx b/src/sage/quivers/paths.pyx index 767386994a5..9d22ef35af2 100644 --- a/src/sage/quivers/paths.pyx +++ b/src/sage/quivers/paths.pyx @@ -427,7 +427,7 @@ cdef class QuiverPath(MonoidElement): for i in range(0,self._path.length): yield E[biseq_getitem(self._path, i)] - cpdef MonoidElement _mul_(self, MonoidElement other): + cpdef _mul_(self, MonoidElement other): """ Compose two paths. diff --git a/src/sage/rings/complex_arb.pyx b/src/sage/rings/complex_arb.pyx index 895107646c4..5321077b55e 100644 --- a/src/sage/rings/complex_arb.pyx +++ b/src/sage/rings/complex_arb.pyx @@ -1748,7 +1748,7 @@ cdef class ComplexBall(RingElement): acb_conj(res.value, self.value) return res - cpdef ModuleElement _add_(self, ModuleElement other): + cpdef _add_(self, ModuleElement other): """ Return the sum of two balls, rounded to the ambient field's precision. @@ -1766,7 +1766,7 @@ cdef class ComplexBall(RingElement): if _do_sig(prec(self)): sig_off() return res - cpdef ModuleElement _sub_(self, ModuleElement other): + cpdef _sub_(self, ModuleElement other): """ Return the difference of two balls, rounded to the ambient field's precision. @@ -1807,7 +1807,7 @@ cdef class ComplexBall(RingElement): if _do_sig(prec(self)): sig_off() return res - cpdef RingElement _mul_(self, RingElement other): + cpdef _mul_(self, RingElement other): """ Return the product of two balls, rounded to the ambient field's precision. @@ -1907,7 +1907,7 @@ cdef class ComplexBall(RingElement): raise TypeError("unsupported operand type(s) for >>: '{}' and '{}'" .format(type(val).__name__, type(shift).__name__)) - cpdef RingElement _div_(self, RingElement other): + cpdef _div_(self, RingElement other): """ Return the quotient of two balls, rounded to the ambient field's precision. diff --git a/src/sage/rings/complex_double.pyx b/src/sage/rings/complex_double.pyx index 4ea6cfd7102..35a2cec17fc 100644 --- a/src/sage/rings/complex_double.pyx +++ b/src/sage/rings/complex_double.pyx @@ -1155,7 +1155,7 @@ cdef class ComplexDoubleElement(FieldElement): # Arithmetic ####################################################################### - cpdef ModuleElement _add_(self, ModuleElement right): + cpdef _add_(self, ModuleElement right): """ Add ``self`` and ``right``. @@ -1167,7 +1167,7 @@ cdef class ComplexDoubleElement(FieldElement): return self._new_c(gsl_complex_add(self._complex, (right)._complex)) - cpdef ModuleElement _sub_(self, ModuleElement right): + cpdef _sub_(self, ModuleElement right): """ Subtract ``self`` and ``right``. @@ -1179,7 +1179,7 @@ cdef class ComplexDoubleElement(FieldElement): return self._new_c(gsl_complex_sub(self._complex, (right)._complex)) - cpdef RingElement _mul_(self, RingElement right): + cpdef _mul_(self, RingElement right): """ Multiply ``self`` and ``right``. @@ -1191,7 +1191,7 @@ cdef class ComplexDoubleElement(FieldElement): return self._new_c(gsl_complex_mul(self._complex, (right)._complex)) - cpdef RingElement _div_(self, RingElement right): + cpdef _div_(self, RingElement right): """ Divide ``self`` by ``right``. @@ -1225,7 +1225,7 @@ cdef class ComplexDoubleElement(FieldElement): """ return self._new_c(gsl_complex_inverse(self._complex)) - cpdef ModuleElement _neg_(self): + cpdef _neg_(self): """ This function returns the negative of the complex number `z`: diff --git a/src/sage/rings/complex_interval.pyx b/src/sage/rings/complex_interval.pyx index a790abb6143..a01bda22d01 100644 --- a/src/sage/rings/complex_interval.pyx +++ b/src/sage/rings/complex_interval.pyx @@ -652,7 +652,7 @@ cdef class ComplexIntervalFieldElement(sage.structure.element.FieldElement): """ return mpfi_has_zero(self.__re) and mpfi_has_zero(self.__im) - cpdef ModuleElement _add_(self, ModuleElement right): + cpdef _add_(self, ModuleElement right): """ Add ``self`` and ``right``. @@ -667,7 +667,7 @@ cdef class ComplexIntervalFieldElement(sage.structure.element.FieldElement): mpfi_add(x.__im, self.__im, (right).__im) return x - cpdef ModuleElement _sub_(self, ModuleElement right): + cpdef _sub_(self, ModuleElement right): """ Subtract ``self`` by ``right``. @@ -682,7 +682,7 @@ cdef class ComplexIntervalFieldElement(sage.structure.element.FieldElement): mpfi_sub(x.__im, self.__im, (right).__im) return x - cpdef RingElement _mul_(self, RingElement right): + cpdef _mul_(self, RingElement right): """ Multiply ``self`` and ``right``. @@ -777,7 +777,7 @@ cdef class ComplexIntervalFieldElement(sage.structure.element.FieldElement): mpfi_clear(t1) return x - cpdef RingElement _div_(self, RingElement right): + cpdef _div_(self, RingElement right): """ Divide ``self`` by ``right``. diff --git a/src/sage/rings/complex_mpc.pyx b/src/sage/rings/complex_mpc.pyx index 0256a3946fe..b2df460d17d 100644 --- a/src/sage/rings/complex_mpc.pyx +++ b/src/sage/rings/complex_mpc.pyx @@ -1293,7 +1293,7 @@ cdef class MPComplexNumber(sage.structure.element.FieldElement): # Basic Arithmetic ################################ - cpdef ModuleElement _add_(self, ModuleElement right): + cpdef _add_(self, ModuleElement right): """ Add two complex numbers with the same parent. @@ -1308,7 +1308,7 @@ cdef class MPComplexNumber(sage.structure.element.FieldElement): mpc_add(z.value, self.value, (right).value, (self._parent).__rnd) return z - cpdef ModuleElement _sub_(self, ModuleElement right): + cpdef _sub_(self, ModuleElement right): """ Subtract two complex numbers with the same parent. @@ -1323,7 +1323,7 @@ cdef class MPComplexNumber(sage.structure.element.FieldElement): mpc_sub(z.value, self.value, (right).value, (self._parent).__rnd) return z - cpdef RingElement _mul_(self, RingElement right): + cpdef _mul_(self, RingElement right): """ Multiply two complex numbers with the same parent. @@ -1338,7 +1338,7 @@ cdef class MPComplexNumber(sage.structure.element.FieldElement): mpc_mul(z.value, self.value, (right).value, (self._parent).__rnd) return z - cpdef RingElement _div_(self, RingElement right): + cpdef _div_(self, RingElement right): """ Divide two complex numbers with the same parent. @@ -1357,7 +1357,7 @@ cdef class MPComplexNumber(sage.structure.element.FieldElement): mpc_div(z.value, self.value, x.value, (self._parent).__rnd) return z - cpdef ModuleElement _neg_(self): + cpdef _neg_(self): """ Return the negative of this complex number. diff --git a/src/sage/rings/complex_number.pyx b/src/sage/rings/complex_number.pyx index d5c70b47206..c1a7dc908b8 100644 --- a/src/sage/rings/complex_number.pyx +++ b/src/sage/rings/complex_number.pyx @@ -596,7 +596,7 @@ cdef class ComplexNumber(sage.structure.element.FieldElement): im = mpfr_to_mpfval(self.__im) return make_mpc((re, im)) - cpdef ModuleElement _add_(self, ModuleElement right): + cpdef _add_(self, ModuleElement right): """ Add ``self`` to ``right``. @@ -611,7 +611,7 @@ cdef class ComplexNumber(sage.structure.element.FieldElement): mpfr_add(x.__im, self.__im, (right).__im, rnd) return x - cpdef ModuleElement _sub_(self, ModuleElement right): + cpdef _sub_(self, ModuleElement right): """ Subtract ``right`` from ``self``. @@ -626,7 +626,7 @@ cdef class ComplexNumber(sage.structure.element.FieldElement): mpfr_sub(x.__im, self.__im, (right).__im, rnd) return x - cpdef RingElement _mul_(self, RingElement right): + cpdef _mul_(self, RingElement right): """ Multiply ``self`` by ``right``. @@ -730,7 +730,7 @@ cdef class ComplexNumber(sage.structure.element.FieldElement): mpfr_clear(t1) return x - cpdef RingElement _div_(self, RingElement right): + cpdef _div_(self, RingElement right): """ Divide ``self`` by ``right``. diff --git a/src/sage/rings/finite_rings/element_givaro.pyx b/src/sage/rings/finite_rings/element_givaro.pyx index c20c88f506f..495fd7f22df 100644 --- a/src/sage/rings/finite_rings/element_givaro.pyx +++ b/src/sage/rings/finite_rings/element_givaro.pyx @@ -1088,7 +1088,7 @@ cdef class FiniteField_givaroElement(FinitePolyExtElement): else: raise ValueError("must be a perfect square.") - cpdef ModuleElement _add_(self, ModuleElement right): + cpdef _add_(self, ModuleElement right): """ Add two elements. @@ -1103,7 +1103,7 @@ cdef class FiniteField_givaroElement(FinitePolyExtElement): (right).element ) return make_FiniteField_givaroElement(self._cache,r) - cpdef RingElement _mul_(self, RingElement right): + cpdef _mul_(self, RingElement right): """ Multiply two elements. @@ -1121,7 +1121,7 @@ cdef class FiniteField_givaroElement(FinitePolyExtElement): return make_FiniteField_givaroElement(self._cache,r) - cpdef RingElement _div_(self, RingElement right): + cpdef _div_(self, RingElement right): """ Divide two elements @@ -1143,7 +1143,7 @@ cdef class FiniteField_givaroElement(FinitePolyExtElement): (right).element) return make_FiniteField_givaroElement(self._cache,r) - cpdef ModuleElement _sub_(self, ModuleElement right): + cpdef _sub_(self, ModuleElement right): """ Subtract two elements. diff --git a/src/sage/rings/finite_rings/element_ntl_gf2e.pyx b/src/sage/rings/finite_rings/element_ntl_gf2e.pyx index 40e3e1f287a..c129bb2c523 100644 --- a/src/sage/rings/finite_rings/element_ntl_gf2e.pyx +++ b/src/sage/rings/finite_rings/element_ntl_gf2e.pyx @@ -675,7 +675,7 @@ cdef class FiniteField_ntl_gf2eElement(FinitePolyExtElement): else: return a - cpdef ModuleElement _add_(self, ModuleElement right): + cpdef _add_(self, ModuleElement right): """ Add two elements. @@ -691,7 +691,7 @@ cdef class FiniteField_ntl_gf2eElement(FinitePolyExtElement): GF2E_add(r.x, (self).x, (right).x) return r - cpdef RingElement _mul_(self, RingElement right): + cpdef _mul_(self, RingElement right): """ Multiply two elements. @@ -707,7 +707,7 @@ cdef class FiniteField_ntl_gf2eElement(FinitePolyExtElement): GF2E_mul(r.x, (self).x, (right).x) return r - cpdef RingElement _div_(self, RingElement right): + cpdef _div_(self, RingElement right): """ Divide two elements. @@ -729,7 +729,7 @@ cdef class FiniteField_ntl_gf2eElement(FinitePolyExtElement): GF2E_div(r.x, (self).x, (right).x) return r - cpdef ModuleElement _sub_(self, ModuleElement right): + cpdef _sub_(self, ModuleElement right): """ Subtract two elements. diff --git a/src/sage/rings/finite_rings/element_pari_ffelt.pyx b/src/sage/rings/finite_rings/element_pari_ffelt.pyx index 004b98eb1ea..a0487bc3902 100644 --- a/src/sage/rings/finite_rings/element_pari_ffelt.pyx +++ b/src/sage/rings/finite_rings/element_pari_ffelt.pyx @@ -443,7 +443,7 @@ cdef class FiniteFieldElement_pari_ffelt(FinitePolyExtElement): sig_off() return r - cpdef ModuleElement _add_(FiniteFieldElement_pari_ffelt self, ModuleElement right): + cpdef _add_(FiniteFieldElement_pari_ffelt self, ModuleElement right): """ Addition. @@ -459,7 +459,7 @@ cdef class FiniteFieldElement_pari_ffelt(FinitePolyExtElement): (right).val)) return x - cpdef ModuleElement _sub_(FiniteFieldElement_pari_ffelt self, ModuleElement right): + cpdef _sub_(FiniteFieldElement_pari_ffelt self, ModuleElement right): """ Subtraction. @@ -475,7 +475,7 @@ cdef class FiniteFieldElement_pari_ffelt(FinitePolyExtElement): (right).val)) return x - cpdef RingElement _mul_(FiniteFieldElement_pari_ffelt self, RingElement right): + cpdef _mul_(FiniteFieldElement_pari_ffelt self, RingElement right): """ Multiplication. @@ -491,7 +491,7 @@ cdef class FiniteFieldElement_pari_ffelt(FinitePolyExtElement): (right).val)) return x - cpdef RingElement _div_(FiniteFieldElement_pari_ffelt self, RingElement right): + cpdef _div_(FiniteFieldElement_pari_ffelt self, RingElement right): """ Division. diff --git a/src/sage/rings/finite_rings/integer_mod.pyx b/src/sage/rings/finite_rings/integer_mod.pyx index df7fac47058..3c91d80e93e 100644 --- a/src/sage/rings/finite_rings/integer_mod.pyx +++ b/src/sage/rings/finite_rings/integer_mod.pyx @@ -1651,7 +1651,7 @@ cdef class IntegerMod_abstract(FiniteRingElement): return infinity return r - cpdef RingElement _floordiv_(self, RingElement right): + cpdef _floordiv_(self, RingElement right): """ Exact division for prime moduli, for compatibility with other fields. @@ -1909,7 +1909,7 @@ cdef class IntegerMod_gmp(IntegerMod_abstract): mpz_set(x.value, self.value) return x - cpdef ModuleElement _add_(self, ModuleElement right): + cpdef _add_(self, ModuleElement right): """ EXAMPLES:: @@ -1924,7 +1924,7 @@ cdef class IntegerMod_gmp(IntegerMod_abstract): mpz_sub(x.value, x.value, self.__modulus.sageInteger.value) return x; - cpdef ModuleElement _sub_(self, ModuleElement right): + cpdef _sub_(self, ModuleElement right): """ EXAMPLES:: @@ -1939,7 +1939,7 @@ cdef class IntegerMod_gmp(IntegerMod_abstract): mpz_add(x.value, x.value, self.__modulus.sageInteger.value) return x; - cpdef ModuleElement _neg_(self): + cpdef _neg_(self): """ EXAMPLES:: @@ -1955,7 +1955,7 @@ cdef class IntegerMod_gmp(IntegerMod_abstract): mpz_sub(x.value, self.__modulus.sageInteger.value, self.value) return x - cpdef RingElement _mul_(self, RingElement right): + cpdef _mul_(self, RingElement right): """ EXAMPLES:: @@ -1969,7 +1969,7 @@ cdef class IntegerMod_gmp(IntegerMod_abstract): mpz_fdiv_r(x.value, x.value, self.__modulus.sageInteger.value) return x - cpdef RingElement _div_(self, RingElement right): + cpdef _div_(self, RingElement right): """ EXAMPLES:: @@ -2324,7 +2324,7 @@ cdef class IntegerMod_int(IntegerMod_abstract): x.ivalue = self.ivalue return x - cpdef ModuleElement _add_(self, ModuleElement right): + cpdef _add_(self, ModuleElement right): """ EXAMPLES:: @@ -2338,7 +2338,7 @@ cdef class IntegerMod_int(IntegerMod_abstract): x = x - self.__modulus.int32 return self._new_c(x) - cpdef ModuleElement _sub_(self, ModuleElement right): + cpdef _sub_(self, ModuleElement right): """ EXAMPLES:: @@ -2352,7 +2352,7 @@ cdef class IntegerMod_int(IntegerMod_abstract): x = x + self.__modulus.int32 return self._new_c(x) - cpdef ModuleElement _neg_(self): + cpdef _neg_(self): """ EXAMPLES:: @@ -2365,7 +2365,7 @@ cdef class IntegerMod_int(IntegerMod_abstract): return self return self._new_c(self.__modulus.int32 - self.ivalue) - cpdef RingElement _mul_(self, RingElement right): + cpdef _mul_(self, RingElement right): """ EXAMPLES:: @@ -2375,7 +2375,7 @@ cdef class IntegerMod_int(IntegerMod_abstract): """ return self._new_c((self.ivalue * (right).ivalue) % self.__modulus.int32) - cpdef RingElement _div_(self, RingElement right): + cpdef _div_(self, RingElement right): """ EXAMPLES:: @@ -3152,7 +3152,7 @@ cdef class IntegerMod_int64(IntegerMod_abstract): def __copy__(IntegerMod_int64 self): return self._new_c(self.ivalue) - cpdef ModuleElement _add_(self, ModuleElement right): + cpdef _add_(self, ModuleElement right): """ EXAMPLES:: @@ -3166,7 +3166,7 @@ cdef class IntegerMod_int64(IntegerMod_abstract): x = x - self.__modulus.int64 return self._new_c(x) - cpdef ModuleElement _sub_(self, ModuleElement right): + cpdef _sub_(self, ModuleElement right): """ EXAMPLES:: @@ -3180,7 +3180,7 @@ cdef class IntegerMod_int64(IntegerMod_abstract): x = x + self.__modulus.int64 return self._new_c(x) - cpdef ModuleElement _neg_(self): + cpdef _neg_(self): """ EXAMPLES:: @@ -3193,7 +3193,7 @@ cdef class IntegerMod_int64(IntegerMod_abstract): return self return self._new_c(self.__modulus.int64 - self.ivalue) - cpdef RingElement _mul_(self, RingElement right): + cpdef _mul_(self, RingElement right): """ EXAMPLES:: @@ -3204,7 +3204,7 @@ cdef class IntegerMod_int64(IntegerMod_abstract): return self._new_c((self.ivalue * (right).ivalue) % self.__modulus.int64) - cpdef RingElement _div_(self, RingElement right): + cpdef _div_(self, RingElement right): """ EXAMPLES:: diff --git a/src/sage/rings/fraction_field_FpT.pyx b/src/sage/rings/fraction_field_FpT.pyx index 3ae3535e31e..8b0959ecd6a 100644 --- a/src/sage/rings/fraction_field_FpT.pyx +++ b/src/sage/rings/fraction_field_FpT.pyx @@ -443,7 +443,7 @@ cdef class FpTElement(RingElement): nmod_poly_swap(x._numer, x._denom) return x - cpdef ModuleElement _add_(self, ModuleElement _other): + cpdef _add_(self, ModuleElement _other): """ Returns the sum of this fraction field element and another. @@ -471,7 +471,7 @@ cdef class FpTElement(RingElement): normalize(x._numer, x._denom, self.p) return x - cpdef ModuleElement _sub_(self, ModuleElement _other): + cpdef _sub_(self, ModuleElement _other): """ Returns the difference of this fraction field element and another. @@ -493,7 +493,7 @@ cdef class FpTElement(RingElement): normalize(x._numer, x._denom, self.p) return x - cpdef RingElement _mul_(self, RingElement _other): + cpdef _mul_(self, RingElement _other): """ Returns the product of this fraction field element and another. @@ -513,7 +513,7 @@ cdef class FpTElement(RingElement): normalize(x._numer, x._denom, self.p) return x - cpdef RingElement _div_(self, RingElement _other): + cpdef _div_(self, RingElement _other): """ Returns the quotient of this fraction field element and another. diff --git a/src/sage/rings/fraction_field_element.pyx b/src/sage/rings/fraction_field_element.pyx index e3ae4979bc6..8dd9d67a166 100644 --- a/src/sage/rings/fraction_field_element.pyx +++ b/src/sage/rings/fraction_field_element.pyx @@ -484,7 +484,7 @@ cdef class FractionFieldElement(FieldElement): return s - cpdef ModuleElement _add_(self, ModuleElement right): + cpdef _add_(self, ModuleElement right): """ Computes the sum of ``self`` and ``right``. @@ -563,7 +563,7 @@ cdef class FractionFieldElement(FieldElement): return self.__class__(self._parent, rnum*sden + rden*snum, rden*sden, coerce=False, reduce=False) - cpdef ModuleElement _sub_(self, ModuleElement right): + cpdef _sub_(self, ModuleElement right): """ Computes the difference of ``self`` and ``right``. @@ -583,7 +583,7 @@ cdef class FractionFieldElement(FieldElement): """ return self._add_(-right) - cpdef RingElement _mul_(self, RingElement right): + cpdef _mul_(self, RingElement right): """ Computes the product of ``self`` and ``right``. @@ -648,7 +648,7 @@ cdef class FractionFieldElement(FieldElement): return self.__class__(self._parent, rnum * snum, rden * sden, coerce=False, reduce=False) - cpdef RingElement _div_(self, RingElement right): + cpdef _div_(self, RingElement right): """ Computes the quotient of ``self`` and ``right``. diff --git a/src/sage/rings/function_field/function_field_element.pyx b/src/sage/rings/function_field/function_field_element.pyx index 027407f07c3..9ee0d77cd7e 100644 --- a/src/sage/rings/function_field/function_field_element.pyx +++ b/src/sage/rings/function_field/function_field_element.pyx @@ -387,7 +387,7 @@ cdef class FunctionFieldElement_polymod(FunctionFieldElement): cdef FunctionFieldElement right = other return cmp(left._x, right._x) - cpdef ModuleElement _add_(self, ModuleElement right): + cpdef _add_(self, ModuleElement right): """ EXAMPLES:: @@ -404,7 +404,7 @@ cdef class FunctionFieldElement_polymod(FunctionFieldElement): res._x = self._x + (right)._x return res - cpdef ModuleElement _sub_(self, ModuleElement right): + cpdef _sub_(self, ModuleElement right): """ EXAMPLES:: @@ -419,7 +419,7 @@ cdef class FunctionFieldElement_polymod(FunctionFieldElement): res._x = self._x - (right)._x return res - cpdef RingElement _mul_(self, RingElement right): + cpdef _mul_(self, RingElement right): """ EXAMPLES:: @@ -432,7 +432,7 @@ cdef class FunctionFieldElement_polymod(FunctionFieldElement): res._x = (self._x * (right)._x) % self._parent.polynomial() return res - cpdef RingElement _div_(self, RingElement right): + cpdef _div_(self, RingElement right): """ EXAMPLES:: @@ -604,7 +604,7 @@ cdef class FunctionFieldElement_rational(FunctionFieldElement): c = cmp(left._parent, right._parent) return c or cmp(left._x, right._x) - cpdef ModuleElement _add_(self, ModuleElement right): + cpdef _add_(self, ModuleElement right): """ EXAMPLES:: @@ -616,7 +616,7 @@ cdef class FunctionFieldElement_rational(FunctionFieldElement): res._x = self._x + (right)._x return res - cpdef ModuleElement _sub_(self, ModuleElement right): + cpdef _sub_(self, ModuleElement right): """ EXAMPLES:: @@ -628,7 +628,7 @@ cdef class FunctionFieldElement_rational(FunctionFieldElement): res._x = self._x - (right)._x return res - cpdef RingElement _mul_(self, RingElement right): + cpdef _mul_(self, RingElement right): """ EXAMPLES:: @@ -640,7 +640,7 @@ cdef class FunctionFieldElement_rational(FunctionFieldElement): res._x = self._x * (right)._x return res - cpdef RingElement _div_(self, RingElement right): + cpdef _div_(self, RingElement right): """ EXAMPLES:: diff --git a/src/sage/rings/integer.pyx b/src/sage/rings/integer.pyx index e40042f7061..d8534ea3948 100644 --- a/src/sage/rings/integer.pyx +++ b/src/sage/rings/integer.pyx @@ -1552,7 +1552,7 @@ cdef class Integer(sage.structure.element.EuclideanDomainElement): mpz_to_ZZ(z, self.value) sig_off() - cpdef ModuleElement _add_(self, ModuleElement right): + cpdef _add_(self, ModuleElement right): """ Integer addition. @@ -1572,7 +1572,7 @@ cdef class Integer(sage.structure.element.EuclideanDomainElement): mpz_add(x.value, self.value, (right).value) return x - cdef RingElement _add_long(self, long n): + cdef _add_long(self, long n): """ Fast path for adding a C long. @@ -1611,7 +1611,7 @@ cdef class Integer(sage.structure.element.EuclideanDomainElement): mpz_sub_ui(x.value, self.value, 0 - n) return x - cpdef ModuleElement _sub_(self, ModuleElement right): + cpdef _sub_(self, ModuleElement right): """ Integer subtraction. @@ -1649,7 +1649,7 @@ cdef class Integer(sage.structure.element.EuclideanDomainElement): mpz_neg(x.value, self.value) return x - cpdef ModuleElement _neg_(self): + cpdef _neg_(self): cdef Integer x = PY_NEW(Integer) mpz_neg(x.value, self.value) return x @@ -1669,7 +1669,7 @@ cdef class Integer(sage.structure.element.EuclideanDomainElement): else: return s * int(self) # will raise the appropriate exception - cdef ModuleElement _mul_long(self, long n): + cdef _mul_long(self, long n): """ Fast path for multiplying a C long. @@ -1691,7 +1691,7 @@ cdef class Integer(sage.structure.element.EuclideanDomainElement): mpz_mul_si(x.value, self.value, n) return x - cpdef RingElement _mul_(self, RingElement right): + cpdef _mul_(self, RingElement right): """ Integer multiplication. @@ -1716,7 +1716,7 @@ cdef class Integer(sage.structure.element.EuclideanDomainElement): mpz_mul(x.value, self.value, (right).value) return x - cpdef RingElement _div_(self, RingElement right): + cpdef _div_(self, RingElement right): r""" Computes `\frac{a}{b}` @@ -1732,7 +1732,7 @@ cdef class Integer(sage.structure.element.EuclideanDomainElement): # we can't cimport rationals. return the_integer_ring._div(self, right) - cpdef RingElement _floordiv_(self, RingElement right): + cpdef _floordiv_(self, RingElement right): r""" Computes the whole part of `\frac{x}{y}`. diff --git a/src/sage/rings/laurent_series_ring_element.pyx b/src/sage/rings/laurent_series_ring_element.pyx index 124794a490f..db46cf9a84a 100644 --- a/src/sage/rings/laurent_series_ring_element.pyx +++ b/src/sage/rings/laurent_series_ring_element.pyx @@ -549,7 +549,7 @@ cdef class LaurentSeries(AlgebraElement): self.__u = self.__u._parent(coeffs) self.__normalize() - cpdef ModuleElement _add_(self, ModuleElement right_m): + cpdef _add_(self, ModuleElement right_m): """ Add two power series with the same parent. @@ -599,7 +599,7 @@ cdef class LaurentSeries(AlgebraElement): # 3. Add return LaurentSeries(self._parent, f1 + f2, m) - cpdef ModuleElement _sub_(self, ModuleElement right_m): + cpdef _sub_(self, ModuleElement right_m): """ Subtract two power series with the same parent. @@ -684,7 +684,7 @@ cdef class LaurentSeries(AlgebraElement): """ return LaurentSeries(self._parent, -self.__u, self.__n) - cpdef RingElement _mul_(self, RingElement right_r): + cpdef _mul_(self, RingElement right_r): """ EXAMPLES:: @@ -699,10 +699,10 @@ cdef class LaurentSeries(AlgebraElement): self.__u * right.__u, self.__n + right.__n) - cpdef ModuleElement _rmul_(self, RingElement c): + cpdef _rmul_(self, RingElement c): return LaurentSeries(self._parent, self.__u._rmul_(c), self.__n) - cpdef ModuleElement _lmul_(self, RingElement c): + cpdef _lmul_(self, RingElement c): return LaurentSeries(self._parent, self.__u._lmul_(c), self.__n) def __pow__(_self, r, dummy): @@ -809,7 +809,7 @@ cdef class LaurentSeries(AlgebraElement): """ return LaurentSeries(self._parent, self.__u >> (n - self.__n), n) - cpdef RingElement _div_(self, RingElement right_r): + cpdef _div_(self, RingElement right_r): """ EXAMPLES:: diff --git a/src/sage/rings/number_field/number_field_element.pxd b/src/sage/rings/number_field/number_field_element.pxd index 8b27454cc51..637ccb8b214 100644 --- a/src/sage/rings/number_field/number_field_element.pxd +++ b/src/sage/rings/number_field/number_field_element.pxd @@ -28,9 +28,6 @@ cdef class NumberFieldElement(FieldElement): cdef void _invert_c_(self, ZZX_c *num, ZZ_c *den) cdef void _reduce_c_(self) - cpdef ModuleElement _add_(self, ModuleElement right) - cpdef ModuleElement _sub_(self, ModuleElement right) - cpdef ModuleElement _neg_(self) cpdef list _coefficients(self) diff --git a/src/sage/rings/number_field/number_field_element.pyx b/src/sage/rings/number_field/number_field_element.pyx index 15bb506f108..0c2a57a4afc 100644 --- a/src/sage/rings/number_field/number_field_element.pyx +++ b/src/sage/rings/number_field/number_field_element.pyx @@ -2003,7 +2003,7 @@ cdef class NumberFieldElement(FieldElement): self.__numerator = t2 self.__denominator = t1 - cpdef ModuleElement _add_(self, ModuleElement right): + cpdef _add_(self, ModuleElement right): r""" EXAMPLE:: @@ -2024,7 +2024,7 @@ cdef class NumberFieldElement(FieldElement): x._reduce_c_() return x - cpdef ModuleElement _sub_(self, ModuleElement right): + cpdef _sub_(self, ModuleElement right): r""" EXAMPLES:: @@ -2043,7 +2043,7 @@ cdef class NumberFieldElement(FieldElement): x._reduce_c_() return x - cpdef RingElement _mul_(self, RingElement right): + cpdef _mul_(self, RingElement right): """ Returns the product of self and other as elements of a number field. @@ -2092,7 +2092,7 @@ cdef class NumberFieldElement(FieldElement): # but asymptotically fast poly multiplication means it's # actually faster to *not* build a table!?! - cpdef RingElement _div_(self, RingElement right): + cpdef _div_(self, RingElement right): """ Returns the quotient of self and other as elements of a number field. @@ -2168,7 +2168,7 @@ cdef class NumberFieldElement(FieldElement): """ return not IsZero_ZZX(self.__numerator) - cpdef ModuleElement _neg_(self): + cpdef _neg_(self): r""" EXAMPLE:: @@ -4556,7 +4556,7 @@ cdef class OrderElement_absolute(NumberFieldElement_absolute): """ return self._number_field - cpdef RingElement _div_(self, RingElement other): + cpdef _div_(self, RingElement other): r""" Implement division, checking that the result has the right parent. @@ -4684,7 +4684,7 @@ cdef class OrderElement_relative(NumberFieldElement_relative): x.__fld_denominator = self.__fld_denominator return x - cpdef RingElement _div_(self, RingElement other): + cpdef _div_(self, RingElement other): r""" Implement division, checking that the result has the right parent. 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 9793a3407f7..62645c1ed3f 100644 --- a/src/sage/rings/number_field/number_field_element_quadratic.pyx +++ b/src/sage/rings/number_field/number_field_element_quadratic.pyx @@ -960,7 +960,7 @@ cdef class NumberFieldElement_quadratic(NumberFieldElement_absolute): mpz_clear(gcd) - cpdef ModuleElement _add_(self, ModuleElement other_m): + cpdef _add_(self, ModuleElement other_m): """ EXAMPLES:: @@ -1017,7 +1017,7 @@ cdef class NumberFieldElement_quadratic(NumberFieldElement_absolute): return res - cpdef ModuleElement _sub_(self, ModuleElement other_m): + cpdef _sub_(self, ModuleElement other_m): """ EXAMPLES:: @@ -1084,7 +1084,7 @@ cdef class NumberFieldElement_quadratic(NumberFieldElement_absolute): return res - cpdef RingElement _mul_(self, RingElement other_m): + cpdef _mul_(self, RingElement other_m): """ EXAMPLES: sage: K. = NumberField(x^2+23) @@ -1141,7 +1141,7 @@ cdef class NumberFieldElement_quadratic(NumberFieldElement_absolute): return res - cpdef ModuleElement _rmul_(self, RingElement _c): + cpdef _rmul_(self, RingElement _c): """ EXAMPLE: sage: K. = NumberField(x^2+43) @@ -1157,7 +1157,7 @@ cdef class NumberFieldElement_quadratic(NumberFieldElement_absolute): return res - cpdef ModuleElement _lmul_(self, RingElement _c): + cpdef _lmul_(self, RingElement _c): """ EXAMPLE: sage: K. = NumberField(x^2+43) @@ -1173,7 +1173,7 @@ cdef class NumberFieldElement_quadratic(NumberFieldElement_absolute): return res - cpdef RingElement _div_(self, RingElement other): + cpdef _div_(self, RingElement other): """ EXAMPLES: sage: K. = NumberField(x^2-5) @@ -2084,7 +2084,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 ModuleElement _rmul_(self, RingElement _c): + cpdef _rmul_(self, RingElement _c): """ EXAMPLE: sage: K. = NumberField(x^2-27) @@ -2103,7 +2103,7 @@ cdef class OrderElement_quadratic(NumberFieldElement_quadratic): return res - cpdef ModuleElement _lmul_(self, RingElement _c): + cpdef _lmul_(self, RingElement _c): """ EXAMPLE: sage: K. = NumberField(x^2+43) @@ -2121,7 +2121,7 @@ cdef class OrderElement_quadratic(NumberFieldElement_quadratic): res._reduce_c_() return res - cpdef RingElement _div_(self, RingElement other): + cpdef _div_(self, RingElement other): r""" Implement division, checking that the result has the right parent. It's not so crucial what the parent actually diff --git a/src/sage/rings/padics/CA_template.pxi b/src/sage/rings/padics/CA_template.pxi index 26557694de0..a177e9418e2 100644 --- a/src/sage/rings/padics/CA_template.pxi +++ b/src/sage/rings/padics/CA_template.pxi @@ -163,7 +163,7 @@ cdef class CAElement(pAdicTemplateElement): """ return unpickle_cae_v2, (self.__class__, self.parent(), cpickle(self.value, self.prime_pow), self.absprec) - cpdef ModuleElement _neg_(self): + cpdef _neg_(self): """ Return the additive inverse of this element. @@ -180,7 +180,7 @@ cdef class CAElement(pAdicTemplateElement): creduce_small(ans.value, ans.value, ans.absprec, ans.prime_pow) return ans - cpdef ModuleElement _add_(self, ModuleElement _right): + cpdef _add_(self, ModuleElement _right): """ Return the sum of this element and ``_right``. @@ -204,7 +204,7 @@ cdef class CAElement(pAdicTemplateElement): creduce(ans.value, ans.value, ans.absprec, ans.prime_pow) return ans - cpdef ModuleElement _sub_(self, ModuleElement _right): + cpdef _sub_(self, ModuleElement _right): """ Return the difference of this element and ``_right``. @@ -246,7 +246,7 @@ cdef class CAElement(pAdicTemplateElement): """ return ~self.parent().fraction_field()(self) - cpdef RingElement _mul_(self, RingElement _right): + cpdef _mul_(self, RingElement _right): """ Return the product of this element and ``_right``. @@ -269,7 +269,7 @@ cdef class CAElement(pAdicTemplateElement): creduce(ans.value, ans.value, ans.absprec, ans.prime_pow) return ans - cpdef RingElement _div_(self, RingElement right): + cpdef _div_(self, RingElement right): """ Return the quotient of this element and ``right``. diff --git a/src/sage/rings/padics/CR_template.pxi b/src/sage/rings/padics/CR_template.pxi index a919df34d86..205ea23d999 100644 --- a/src/sage/rings/padics/CR_template.pxi +++ b/src/sage/rings/padics/CR_template.pxi @@ -273,7 +273,7 @@ cdef class CRElement(pAdicTemplateElement): """ return unpickle_cre_v2, (self.__class__, self.parent(), cpickle(self.unit, self.prime_pow), self.ordp, self.relprec) - cpdef ModuleElement _neg_(self): + cpdef _neg_(self): """ Return the additive inverse of this element. @@ -297,7 +297,7 @@ cdef class CRElement(pAdicTemplateElement): creduce(ans.unit, ans.unit, ans.relprec, ans.prime_pow) return ans - cpdef ModuleElement _add_(self, ModuleElement _right): + cpdef _add_(self, ModuleElement _right): """ Return the sum of this element and ``_right``. @@ -339,7 +339,7 @@ cdef class CRElement(pAdicTemplateElement): creduce(ans.unit, ans.unit, ans.relprec, ans.prime_pow) return ans - cpdef ModuleElement _sub_(self, ModuleElement _right): + cpdef _sub_(self, ModuleElement _right): """ Return the difference of this element and ``_right``. @@ -413,7 +413,7 @@ cdef class CRElement(pAdicTemplateElement): cinvert(ans.unit, self.unit, ans.relprec, ans.prime_pow) return ans - cpdef RingElement _mul_(self, RingElement _right): + cpdef _mul_(self, RingElement _right): r""" Return the product of this element and ``_right``. @@ -444,7 +444,7 @@ cdef class CRElement(pAdicTemplateElement): check_ordp(ans.ordp) return ans - cpdef RingElement _div_(self, RingElement _right): + cpdef _div_(self, RingElement _right): """ Return the quotient of this element and ``right``. @@ -758,7 +758,7 @@ cdef class CRElement(pAdicTemplateElement): ans._normalize() return ans - cpdef RingElement _floordiv_(self, RingElement _right): + cpdef _floordiv_(self, RingElement _right): """ Floor division. diff --git a/src/sage/rings/padics/FM_template.pxi b/src/sage/rings/padics/FM_template.pxi index ac1e1bc3b8d..d033b1965e2 100644 --- a/src/sage/rings/padics/FM_template.pxi +++ b/src/sage/rings/padics/FM_template.pxi @@ -158,7 +158,7 @@ cdef class FMElement(pAdicTemplateElement): """ return unpickle_fme_v2, (self.__class__, self.parent(), cpickle(self.value, self.prime_pow)) - cpdef ModuleElement _neg_(self): + cpdef _neg_(self): r""" Return the additive inverse of this element. @@ -173,7 +173,7 @@ cdef class FMElement(pAdicTemplateElement): creduce_small(ans.value, ans.value, ans.prime_pow.prec_cap, ans.prime_pow) return ans - cpdef ModuleElement _add_(self, ModuleElement _right): + cpdef _add_(self, ModuleElement _right): r""" Return the sum of this element and ``_right``. @@ -193,7 +193,7 @@ cdef class FMElement(pAdicTemplateElement): creduce_small(ans.value, ans.value, ans.prime_pow.prec_cap, ans.prime_pow) return ans - cpdef ModuleElement _sub_(self, ModuleElement _right): + cpdef _sub_(self, ModuleElement _right): r""" Return the difference of this element and ``_right``. @@ -238,7 +238,7 @@ cdef class FMElement(pAdicTemplateElement): cinvert(ans.value, self.value, ans.prime_pow.prec_cap, ans.prime_pow) return ans - cpdef RingElement _mul_(self, RingElement _right): + cpdef _mul_(self, RingElement _right): r""" Return the product of this element and ``_right``. @@ -256,7 +256,7 @@ cdef class FMElement(pAdicTemplateElement): creduce(ans.value, ans.value, ans.prime_pow.prec_cap, ans.prime_pow) return ans - cpdef RingElement _div_(self, RingElement _right): + cpdef _div_(self, RingElement _right): r""" Return the quotient of this element and ``right``. ``right`` must have valuation zero. diff --git a/src/sage/rings/padics/local_generic_element.pxd b/src/sage/rings/padics/local_generic_element.pxd index dc563f267bc..9111d2f173c 100644 --- a/src/sage/rings/padics/local_generic_element.pxd +++ b/src/sage/rings/padics/local_generic_element.pxd @@ -1,7 +1,4 @@ -import sage.structure.element -cimport sage.structure.element -from sage.structure.element cimport RingElement, ModuleElement, CommutativeRingElement +from sage.structure.element cimport CommutativeRingElement cdef class LocalGenericElement(CommutativeRingElement): - cpdef RingElement _div_(self, RingElement right) - cpdef ModuleElement _sub_(self, ModuleElement right) + pass diff --git a/src/sage/rings/padics/local_generic_element.pyx b/src/sage/rings/padics/local_generic_element.pyx index 6346a139074..9d51e94902a 100644 --- a/src/sage/rings/padics/local_generic_element.pyx +++ b/src/sage/rings/padics/local_generic_element.pyx @@ -36,10 +36,10 @@ from sage.structure.element cimport ModuleElement, RingElement, CommutativeRingE from sage.structure.element import coerce_binop cdef class LocalGenericElement(CommutativeRingElement): - #cpdef ModuleElement _add_(self, ModuleElement right): + #cpdef _add_(self, ModuleElement right): # raise NotImplementedError - cpdef RingElement _div_(self, RingElement right): + cpdef _div_(self, RingElement right): r""" Returns the quotient of ``self`` by ``right``. @@ -369,7 +369,7 @@ cdef class LocalGenericElement(CommutativeRingElement): #def __mod__(self, right): # raise NotImplementedError - #cpdef RingElement _mul_(self, RingElement right): + #cpdef _mul_(self, RingElement right): # raise NotImplementedError #cdef _neg_(self): @@ -378,7 +378,7 @@ cdef class LocalGenericElement(CommutativeRingElement): #def __pow__(self, right): # raise NotImplementedError - cpdef ModuleElement _sub_(self, ModuleElement right): + cpdef _sub_(self, ModuleElement right): r""" Returns the difference between ``self`` and ``right``. diff --git a/src/sage/rings/padics/padic_ZZ_pX_CA_element.pyx b/src/sage/rings/padics/padic_ZZ_pX_CA_element.pyx index ac8818ae0f7..6c619a0fbb6 100644 --- a/src/sage/rings/padics/padic_ZZ_pX_CA_element.pyx +++ b/src/sage/rings/padics/padic_ZZ_pX_CA_element.pyx @@ -1110,7 +1110,7 @@ cdef class pAdicZZpXCAElement(pAdicZZpXElement): return ans return self._rshift_c(mpz_get_si((shift).value)) - cpdef ModuleElement _neg_(self): + cpdef _neg_(self): """ Returns ``-self``. @@ -1377,7 +1377,7 @@ cdef class pAdicZZpXCAElement(pAdicZZpXElement): sig_off() return ans - cpdef ModuleElement _add_(self, ModuleElement _right): + cpdef _add_(self, ModuleElement _right): """ Computes the sum of ``self`` and ``right``. @@ -1416,7 +1416,7 @@ cdef class pAdicZZpXCAElement(pAdicZZpXElement): ZZ_pX_add(ans.value, tmpP, right.value) return ans - cpdef ModuleElement _sub_(self, ModuleElement _right): + cpdef _sub_(self, ModuleElement _right): """ Returns the difference of ``self`` and ``right``. @@ -1458,7 +1458,7 @@ cdef class pAdicZZpXCAElement(pAdicZZpXElement): ZZ_pX_sub(ans.value, tmpP, right.value) return ans - cpdef RingElement _mul_(self, RingElement _right): + cpdef _mul_(self, RingElement _right): """ Returns the product of ``self`` and ``right``. @@ -1511,7 +1511,7 @@ cdef class pAdicZZpXCAElement(pAdicZZpXElement): ZZ_pX_MulMod_pre(ans.value, self_adapted, right_adapted, self.prime_pow.get_modulus_capdiv(ans_absprec)[0]) return ans - cpdef RingElement _div_(self, RingElement right): + cpdef _div_(self, RingElement right): """ Returns the quotient of ``self`` by ``right``. diff --git a/src/sage/rings/padics/padic_ZZ_pX_CR_element.pyx b/src/sage/rings/padics/padic_ZZ_pX_CR_element.pyx index 7e99cb69809..1fe39db5109 100644 --- a/src/sage/rings/padics/padic_ZZ_pX_CR_element.pyx +++ b/src/sage/rings/padics/padic_ZZ_pX_CR_element.pyx @@ -1766,7 +1766,7 @@ cdef class pAdicZZpXCRElement(pAdicZZpXElement): return ans return self._rshift_c(mpz_get_si((shift).value)) - cpdef ModuleElement _neg_(self): + cpdef _neg_(self): """ Returns ``-self``. @@ -2047,7 +2047,7 @@ cdef class pAdicZZpXCRElement(pAdicZZpXElement): sig_off() return ans - cpdef ModuleElement _add_(self, ModuleElement _right): + cpdef _add_(self, ModuleElement _right): """ Computes the sum of ``self`` and ``right``. @@ -2166,7 +2166,7 @@ cdef class pAdicZZpXCRElement(pAdicZZpXElement): ans.relprec = -ans.relprec return ans - cpdef ModuleElement _sub_(self, ModuleElement right): + cpdef _sub_(self, ModuleElement right): """ Returns the difference of ``self`` and ``right``. @@ -2192,7 +2192,7 @@ cdef class pAdicZZpXCRElement(pAdicZZpXElement): # For now, a simple implementation return self + (-right) - cpdef RingElement _mul_(self, RingElement _right): + cpdef _mul_(self, RingElement _right): """ Returns the product of ``self`` and ``right``. @@ -2246,7 +2246,7 @@ cdef class pAdicZZpXCRElement(pAdicZZpXElement): sig_off() return ans - cpdef RingElement _div_(self, RingElement right): + cpdef _div_(self, RingElement right): """ Returns the quotient of ``self`` by ``right``. diff --git a/src/sage/rings/padics/padic_ZZ_pX_FM_element.pyx b/src/sage/rings/padics/padic_ZZ_pX_FM_element.pyx index 109d05983dd..e009d781ebc 100644 --- a/src/sage/rings/padics/padic_ZZ_pX_FM_element.pyx +++ b/src/sage/rings/padics/padic_ZZ_pX_FM_element.pyx @@ -647,7 +647,7 @@ cdef class pAdicZZpXFMElement(pAdicZZpXElement): return ans return self._rshift_c(mpz_get_si((shift).value)) - cpdef ModuleElement _neg_(self): + cpdef _neg_(self): """ Returns ``-self``. @@ -734,7 +734,7 @@ cdef class pAdicZZpXFMElement(pAdicZZpXElement): sig_off() return ans - cpdef ModuleElement _add_(self, ModuleElement right): + cpdef _add_(self, ModuleElement right): """ Returns ``self`` + ``right``. @@ -753,7 +753,7 @@ cdef class pAdicZZpXFMElement(pAdicZZpXElement): ZZ_pX_add(ans.value, self.value, (right).value) return ans - cpdef RingElement _mul_(self, RingElement right): + cpdef _mul_(self, RingElement right): """ Returns the product of ``self`` and ``right``. @@ -776,7 +776,7 @@ cdef class pAdicZZpXFMElement(pAdicZZpXElement): ZZ_pX_MulMod_pre(ans.value, self.value, (right).value, self.prime_pow.get_top_modulus()[0]) return ans - cpdef ModuleElement _sub_(self, ModuleElement right): + cpdef _sub_(self, ModuleElement right): """ Returns the difference of ``self`` and ``right``. @@ -797,7 +797,7 @@ cdef class pAdicZZpXFMElement(pAdicZZpXElement): ZZ_pX_sub(ans.value, self.value, (right).value) return ans - cpdef RingElement _div_(self, RingElement _right): + cpdef _div_(self, RingElement _right): """ Returns the quotient of ``self`` by ``right``. diff --git a/src/sage/rings/padics/padic_generic_element.pxd b/src/sage/rings/padics/padic_generic_element.pxd index 8def33790f5..5b4641ddf44 100644 --- a/src/sage/rings/padics/padic_generic_element.pxd +++ b/src/sage/rings/padics/padic_generic_element.pxd @@ -39,5 +39,3 @@ cdef class pAdicGenericElement(LocalGenericElement): cpdef abs(self, prec=*) cpdef bint _is_base_elt(self, p) except -1 - - cpdef RingElement _floordiv_(self, RingElement right) diff --git a/src/sage/rings/padics/padic_generic_element.pyx b/src/sage/rings/padics/padic_generic_element.pyx index f1997eafc62..a10c55ceaa5 100644 --- a/src/sage/rings/padics/padic_generic_element.pyx +++ b/src/sage/rings/padics/padic_generic_element.pyx @@ -287,7 +287,7 @@ cdef class pAdicGenericElement(LocalGenericElement): raise ZeroDivisionError("cannot divide by zero") return self._floordiv_(right) - cpdef RingElement _floordiv_(self, RingElement right): + cpdef _floordiv_(self, RingElement right): """ Implements floor division. diff --git a/src/sage/rings/polynomial/laurent_polynomial.pyx b/src/sage/rings/polynomial/laurent_polynomial.pyx index c537e3bb972..f8896df555e 100644 --- a/src/sage/rings/polynomial/laurent_polynomial.pyx +++ b/src/sage/rings/polynomial/laurent_polynomial.pyx @@ -496,7 +496,7 @@ cdef class LaurentPolynomial_univariate(LaurentPolynomial_generic): self.__u = self.__u._parent(coeffs) self.__normalize() - cpdef ModuleElement _add_(self, ModuleElement right_m): + cpdef _add_(self, ModuleElement right_m): """ Add two Laurent polynomials with the same parent. @@ -545,7 +545,7 @@ cdef class LaurentPolynomial_univariate(LaurentPolynomial_generic): # 3. Add return LaurentPolynomial_univariate(self._parent, f1 + f2, m) - cpdef ModuleElement _sub_(self, ModuleElement right_m): + cpdef _sub_(self, ModuleElement right_m): """ Subtract two Laurent polynomials with the same parent. @@ -608,7 +608,7 @@ cdef class LaurentPolynomial_univariate(LaurentPolynomial_generic): """ return LaurentPolynomial_univariate(self._parent, -self.__u, self.__n) - cpdef RingElement _mul_(self, RingElement right_r): + cpdef _mul_(self, RingElement right_r): """ EXAMPLES:: @@ -623,7 +623,7 @@ cdef class LaurentPolynomial_univariate(LaurentPolynomial_generic): self.__u * right.__u, self.__n + right.__n) - cpdef ModuleElement _rmul_(self, RingElement c): + cpdef _rmul_(self, RingElement c): """ EXAMPLES:: @@ -634,7 +634,7 @@ cdef class LaurentPolynomial_univariate(LaurentPolynomial_generic): """ return LaurentPolynomial_univariate(self._parent, self.__u._rmul_(c), self.__n) - cpdef ModuleElement _lmul_(self, RingElement c): + cpdef _lmul_(self, RingElement c): """ EXAMPLES:: @@ -685,7 +685,7 @@ cdef class LaurentPolynomial_univariate(LaurentPolynomial_generic): raise ValueError("exponent must be an integer") return LaurentPolynomial_univariate(self._parent, self.__u**right, self.__n*right) - cpdef RingElement _floordiv_(self, RingElement rhs): + cpdef _floordiv_(self, RingElement rhs): """ Perform division with remainder and return the quotient. @@ -755,7 +755,7 @@ cdef class LaurentPolynomial_univariate(LaurentPolynomial_generic): """ return LaurentPolynomial_univariate(self._parent, self.__u, self.__n - k) - cpdef RingElement _div_(self, RingElement rhs): + cpdef _div_(self, RingElement rhs): """ EXAMPLES:: @@ -1915,7 +1915,7 @@ cdef class LaurentPolynomial_mpair(LaurentPolynomial_generic): denom *= var[i] ** (-j) return (numer, denom) - cpdef ModuleElement _add_(self, ModuleElement _right): + cpdef _add_(self, ModuleElement _right): """ Returns the Laurent polynomial self + right. @@ -1940,7 +1940,7 @@ cdef class LaurentPolynomial_mpair(LaurentPolynomial_generic): ans._poly += right._poly return ans - cpdef ModuleElement _sub_(self, ModuleElement _right): + cpdef _sub_(self, ModuleElement _right): """ Returns the Laurent polynomial self - right. @@ -1967,7 +1967,7 @@ cdef class LaurentPolynomial_mpair(LaurentPolynomial_generic): ans._poly -= right._poly return ans - cpdef RingElement _div_(self, RingElement rhs): + cpdef _div_(self, RingElement rhs): """ Return the division of ``self`` by ``rhs``. @@ -2021,7 +2021,7 @@ cdef class LaurentPolynomial_mpair(LaurentPolynomial_generic): d = self._poly.dict() return len(d) == 1 and 1 in d.values() - cpdef ModuleElement _neg_(self): + cpdef _neg_(self): """ Returns -self. @@ -2038,7 +2038,7 @@ cdef class LaurentPolynomial_mpair(LaurentPolynomial_generic): ans._poly = -self._poly return ans - cpdef ModuleElement _lmul_(self, RingElement right): + cpdef _lmul_(self, RingElement right): """ Returns self * right where right is in self's base ring. @@ -2055,7 +2055,7 @@ cdef class LaurentPolynomial_mpair(LaurentPolynomial_generic): ans._poly = self._poly * right return ans - cpdef ModuleElement _rmul_(self, RingElement left): + cpdef _rmul_(self, RingElement left): """ Returns left*self where left is in self's base ring. @@ -2072,7 +2072,7 @@ cdef class LaurentPolynomial_mpair(LaurentPolynomial_generic): ans._poly = left * self._poly return ans - cpdef RingElement _mul_(self, RingElement right): + cpdef _mul_(self, RingElement right): """ Return self*right. @@ -2089,7 +2089,7 @@ cdef class LaurentPolynomial_mpair(LaurentPolynomial_generic): ans._poly = self._poly * (right)._poly return ans - cpdef RingElement _floordiv_(self, RingElement right): + cpdef _floordiv_(self, RingElement right): """ Perform division with remainder and return the quotient. diff --git a/src/sage/rings/polynomial/multi_polynomial_libsingular.pyx b/src/sage/rings/polynomial/multi_polynomial_libsingular.pyx index 381a7e1cdb1..e89bbd6c34e 100644 --- a/src/sage/rings/polynomial/multi_polynomial_libsingular.pyx +++ b/src/sage/rings/polynomial/multi_polynomial_libsingular.pyx @@ -2209,7 +2209,7 @@ cdef class MPolynomial_libsingular(sage.rings.polynomial.multi_polynomial.MPolyn cdef ring *r = (left)._parent_ring return singular_polynomial_cmp(p, q, r) - cpdef ModuleElement _add_(left, ModuleElement right): + cpdef _add_(left, ModuleElement right): """ Add left and right. @@ -2225,7 +2225,7 @@ cdef class MPolynomial_libsingular(sage.rings.polynomial.multi_polynomial.MPolyn (right)._poly, r) return new_MP((left)._parent, _p) - cpdef ModuleElement _sub_(left, ModuleElement right): + cpdef _sub_(left, ModuleElement right): """ Subtract left and right. @@ -2242,7 +2242,7 @@ cdef class MPolynomial_libsingular(sage.rings.polynomial.multi_polynomial.MPolyn _ring) return new_MP((left)._parent, _p) - cpdef ModuleElement _rmul_(self, RingElement left): + cpdef _rmul_(self, RingElement left): """ Multiply self with a base ring element. @@ -2260,7 +2260,7 @@ cdef class MPolynomial_libsingular(sage.rings.polynomial.multi_polynomial.MPolyn singular_polynomial_rmul(&_p, self._poly, left, _ring) return new_MP((self)._parent, _p) - cpdef ModuleElement _lmul_(self, RingElement right): + cpdef _lmul_(self, RingElement right): """ Multiply left and right. @@ -2276,7 +2276,7 @@ cdef class MPolynomial_libsingular(sage.rings.polynomial.multi_polynomial.MPolyn # So, calling _rmul_ is the correct thing to do. return self._rmul_(right) - cpdef RingElement _mul_(left, RingElement right): + cpdef _mul_(left, RingElement right): """ Multiply left and right. @@ -2299,7 +2299,7 @@ cdef class MPolynomial_libsingular(sage.rings.polynomial.multi_polynomial.MPolyn (left)._parent_ring) return new_MP((left)._parent,_p) - cpdef RingElement _div_(left, RingElement right_ringelement): + cpdef _div_(left, RingElement right_ringelement): """ Divide left by right @@ -3886,7 +3886,7 @@ cdef class MPolynomial_libsingular(sage.rings.polynomial.multi_polynomial.MPolyn else: return False - cpdef RingElement _floordiv_(self, RingElement right): + cpdef _floordiv_(self, RingElement right): """ Perform division with remainder and return the quotient. diff --git a/src/sage/rings/polynomial/pbori.pyx b/src/sage/rings/polynomial/pbori.pyx index 625909a08b8..e4a764f5fe9 100644 --- a/src/sage/rings/polynomial/pbori.pyx +++ b/src/sage/rings/polynomial/pbori.pyx @@ -2583,7 +2583,7 @@ cdef class BooleanMonomial(MonoidElement): """ return new_BMI_from_BooleanMonomial(self) - cpdef MonoidElement _mul_(left, MonoidElement right): + cpdef _mul_(left, MonoidElement right): """ Multiply this boolean monomial with another boolean monomial. @@ -2969,7 +2969,7 @@ cdef class BooleanPolynomial(MPolynomial): R = self.parent().cover_ring() return R(self)._latex_() - cpdef ModuleElement _add_(left, ModuleElement right): + cpdef _add_(left, ModuleElement right): """ EXAMPLE:: @@ -2984,7 +2984,7 @@ cdef class BooleanPolynomial(MPolynomial): p._pbpoly.iadd( (right)._pbpoly ) return p - cpdef ModuleElement _sub_(left, ModuleElement right): + cpdef _sub_(left, ModuleElement right): """ EXAMPLE:: @@ -2996,7 +2996,7 @@ cdef class BooleanPolynomial(MPolynomial): """ return left._add_(right) - cpdef ModuleElement _rmul_(self, RingElement left): + cpdef _rmul_(self, RingElement left): """ EXAMPLE:: @@ -3011,7 +3011,7 @@ cdef class BooleanPolynomial(MPolynomial): else: return self._parent.zero() - cpdef ModuleElement _lmul_(self, RingElement right): + cpdef _lmul_(self, RingElement right): """ EXAMPLE:: @@ -3023,7 +3023,7 @@ cdef class BooleanPolynomial(MPolynomial): """ return self._rmul_(right) - cpdef RingElement _mul_(left, RingElement right): + cpdef _mul_(left, RingElement right): """ EXAMPLE:: @@ -3038,7 +3038,7 @@ cdef class BooleanPolynomial(MPolynomial): p._pbpoly.imul( (right)._pbpoly ) return p - cpdef RingElement _div_(left, RingElement right): + cpdef _div_(left, RingElement right): """ EXAMPLE:: diff --git a/src/sage/rings/polynomial/plural.pyx b/src/sage/rings/polynomial/plural.pyx index adbb8564651..7cfa2f7039e 100644 --- a/src/sage/rings/polynomial/plural.pyx +++ b/src/sage/rings/polynomial/plural.pyx @@ -1460,7 +1460,7 @@ cdef class NCPolynomial_plural(RingElement): cdef ring *r = (left._parent)._ring return singular_polynomial_cmp(p, q, r) - cpdef ModuleElement _add_( left, ModuleElement right): + cpdef _add_( left, ModuleElement right): """ Adds left and right. @@ -1479,7 +1479,7 @@ cdef class NCPolynomial_plural(RingElement): (left._parent)._ring) return new_NCP((left._parent), _p) - cpdef ModuleElement _sub_( left, ModuleElement right): + cpdef _sub_( left, ModuleElement right): """ Subtract left and right. @@ -1501,7 +1501,7 @@ cdef class NCPolynomial_plural(RingElement): _ring) return new_NCP((left._parent), _p) - cpdef ModuleElement _rmul_(self, RingElement left): + cpdef _rmul_(self, RingElement left): """ Multiply ``self`` with a base ring element. @@ -1522,7 +1522,7 @@ cdef class NCPolynomial_plural(RingElement): singular_polynomial_rmul(&_p, self._poly, left, _ring) return new_NCP((self._parent),_p) - cpdef ModuleElement _lmul_(self, RingElement right): + cpdef _lmul_(self, RingElement right): """ Multiply ``self`` with a base ring element. @@ -1568,7 +1568,7 @@ cdef class NCPolynomial_plural(RingElement): (left._parent)._ring) return new_NCP((left._parent),_p) - cpdef RingElement _div_(left, RingElement right): + cpdef _div_(left, RingElement right): """ Divide left by right diff --git a/src/sage/rings/polynomial/polynomial_element.pxd b/src/sage/rings/polynomial/polynomial_element.pxd index e35185bd752..8657b0524fe 100644 --- a/src/sage/rings/polynomial/polynomial_element.pxd +++ b/src/sage/rings/polynomial/polynomial_element.pxd @@ -5,7 +5,6 @@ from polynomial_compiled import CompiledPolynomialFunction from polynomial_compiled cimport CompiledPolynomialFunction cdef class Polynomial(CommutativeAlgebraElement): - cpdef ModuleElement _neg_(self) cdef char _is_gen cdef CompiledPolynomialFunction _compiled cpdef Polynomial truncate(self, long n) diff --git a/src/sage/rings/polynomial/polynomial_element.pyx b/src/sage/rings/polynomial/polynomial_element.pyx index 12d568993b5..90b77aedaf8 100644 --- a/src/sage/rings/polynomial/polynomial_element.pyx +++ b/src/sage/rings/polynomial/polynomial_element.pyx @@ -252,7 +252,7 @@ cdef class Polynomial(CommutativeAlgebraElement): v[i] = z return v - cpdef ModuleElement _add_(self, ModuleElement right): + cpdef _add_(self, ModuleElement right): r""" Add two polynomials. @@ -281,7 +281,7 @@ cdef class Polynomial(CommutativeAlgebraElement): low = [x[i] + y[i] for i in range(min)] return self._parent(low + high) - cpdef ModuleElement _neg_(self): + cpdef _neg_(self): return self._parent([-x for x in self.list()]) cpdef bint is_zero(self): @@ -365,7 +365,7 @@ cdef class Polynomial(CommutativeAlgebraElement): return point(z, *args, **kwds) raise NotImplementedError("plotting of polynomials over %s not implemented"%R) - cpdef ModuleElement _lmul_(self, RingElement left): + cpdef _lmul_(self, RingElement left): """ Multiply self on the left by a scalar. @@ -385,7 +385,7 @@ cdef class Polynomial(CommutativeAlgebraElement): return self.parent().zero() return self.parent()(left) * self - cpdef ModuleElement _rmul_(self, RingElement right): + cpdef _rmul_(self, RingElement right): """ Multiply self on the right by a scalar. @@ -1484,7 +1484,7 @@ cdef class Polynomial(CommutativeAlgebraElement): raise TypeError("cannot coerce nonconstant polynomial to long") return long(self[0]) - cpdef RingElement _mul_(self, RingElement right): + cpdef _mul_(self, RingElement right): """ EXAMPLES:: @@ -2365,7 +2365,7 @@ cdef class Polynomial(CommutativeAlgebraElement): """ raise IndexError("polynomials are immutable") - cpdef RingElement _floordiv_(self, RingElement right): + cpdef _floordiv_(self, RingElement right): """ Quotient of division of self by other. This is denoted //. @@ -8815,7 +8815,7 @@ cdef class Polynomial_generic_dense(Polynomial): res.__normalize() return res - cpdef ModuleElement _add_(self, ModuleElement right): + cpdef _add_(self, ModuleElement right): r""" Add two polynomials. @@ -8846,7 +8846,7 @@ cdef class Polynomial_generic_dense(Polynomial): else: return self._new_c(low + high, self._parent) - cpdef ModuleElement _sub_(self, ModuleElement right): + cpdef _sub_(self, ModuleElement right): cdef Polynomial_generic_dense res cdef Py_ssize_t check=0, i, min x = (self).__coeffs @@ -8867,7 +8867,7 @@ cdef class Polynomial_generic_dense(Polynomial): else: return self._new_c(low + high, self._parent) - cpdef ModuleElement _rmul_(self, RingElement c): + cpdef _rmul_(self, RingElement c): if len(self.__coeffs) == 0: return self if c._parent is not (self.__coeffs[0])._parent: @@ -8879,7 +8879,7 @@ cdef class Polynomial_generic_dense(Polynomial): res.__normalize() return res - cpdef ModuleElement _lmul_(self, RingElement c): + cpdef _lmul_(self, RingElement c): if len(self.__coeffs) == 0: return self if c._parent is not (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 f7fce57bd3e..bc3870ba836 100644 --- a/src/sage/rings/polynomial/polynomial_integer_dense_flint.pyx +++ b/src/sage/rings/polynomial/polynomial_integer_dense_flint.pyx @@ -587,7 +587,7 @@ cdef class Polynomial_integer_dense_flint(Polynomial): name = self.parent().latex_variable_names()[0] return self._repr(name=name, latex=True) - cpdef ModuleElement _add_(self, ModuleElement right): + cpdef _add_(self, ModuleElement right): r""" Returns self plus right. @@ -607,7 +607,7 @@ cdef class Polynomial_integer_dense_flint(Polynomial): return x - cpdef ModuleElement _sub_(self, ModuleElement right): + cpdef _sub_(self, ModuleElement right): r""" Return self minus right. @@ -627,7 +627,7 @@ cdef class Polynomial_integer_dense_flint(Polynomial): return x - cpdef ModuleElement _neg_(self): + cpdef _neg_(self): r""" Returns negative of self. @@ -879,7 +879,7 @@ cdef class Polynomial_integer_dense_flint(Polynomial): return self._parent(rr), ss, tt - cpdef RingElement _mul_(self, RingElement right): + cpdef _mul_(self, RingElement right): r""" Returns self multiplied by right. @@ -927,7 +927,7 @@ cdef class Polynomial_integer_dense_flint(Polynomial): sig_off() return x - cpdef ModuleElement _lmul_(self, RingElement right): + cpdef _lmul_(self, RingElement right): r""" Returns self multiplied by right, where right is a scalar (integer). @@ -946,7 +946,7 @@ cdef class Polynomial_integer_dense_flint(Polynomial): return x - cpdef ModuleElement _rmul_(self, RingElement right): + cpdef _rmul_(self, RingElement 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 d32a0580066..ad42320b115 100644 --- a/src/sage/rings/polynomial/polynomial_integer_dense_ntl.pyx +++ b/src/sage/rings/polynomial/polynomial_integer_dense_ntl.pyx @@ -422,7 +422,7 @@ cdef class Polynomial_integer_dense_ntl(Polynomial): name = self.parent().latex_variable_names()[0] return self._repr(name, latex=True) - cpdef ModuleElement _add_(self, ModuleElement right): + cpdef _add_(self, ModuleElement right): r""" Returns self plus right. @@ -440,7 +440,7 @@ cdef class Polynomial_integer_dense_ntl(Polynomial): return x - cpdef ModuleElement _sub_(self, ModuleElement right): + cpdef _sub_(self, ModuleElement right): r""" Return self minus right. @@ -458,7 +458,7 @@ cdef class Polynomial_integer_dense_ntl(Polynomial): return x - cpdef ModuleElement _neg_(self): + cpdef _neg_(self): r""" Returns negative of self. @@ -664,7 +664,7 @@ cdef class Polynomial_integer_dense_ntl(Polynomial): return S(rr), ss, tt - cpdef RingElement _mul_(self, RingElement right): + cpdef _mul_(self, RingElement right): r""" Returns self multiplied by right. @@ -680,7 +680,7 @@ cdef class Polynomial_integer_dense_ntl(Polynomial): return x - cpdef ModuleElement _lmul_(self, RingElement right): + cpdef _lmul_(self, RingElement right): r""" Returns self multiplied by right, where right is a scalar (integer). @@ -700,7 +700,7 @@ cdef class Polynomial_integer_dense_ntl(Polynomial): return x - cpdef ModuleElement _rmul_(self, RingElement right): + cpdef _rmul_(self, RingElement 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 185f2981edd..1f51acb829f 100644 --- a/src/sage/rings/polynomial/polynomial_modn_dense_ntl.pyx +++ b/src/sage/rings/polynomial/polynomial_modn_dense_ntl.pyx @@ -219,10 +219,10 @@ cdef class Polynomial_dense_mod_n(Polynomial): return (~self)**(-n) return self.parent()(self.__poly**n, construct=True) - cpdef ModuleElement _add_(self, ModuleElement right): + cpdef _add_(self, ModuleElement right): return self.parent()(self.__poly + (right).__poly, construct=True) - cpdef RingElement _mul_(self, RingElement right): + cpdef _mul_(self, RingElement right): """ EXAMPLES:: @@ -232,13 +232,13 @@ cdef class Polynomial_dense_mod_n(Polynomial): """ return self.parent()(self.__poly * (right).__poly, construct=True) - cpdef ModuleElement _rmul_(self, RingElement c): + cpdef _rmul_(self, RingElement 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 raise TypeError(msg) - cpdef ModuleElement _lmul_(self, RingElement c): + cpdef _lmul_(self, RingElement 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 @@ -289,7 +289,7 @@ cdef class Polynomial_dense_mod_n(Polynomial): return self.parent()(self.__poly.left_shift(n), construct=True) - cpdef ModuleElement _sub_(self, ModuleElement right): + cpdef _sub_(self, ModuleElement right): return self.parent()(self.__poly - (right).__poly, construct=True) def __floordiv__(self, right): @@ -675,7 +675,7 @@ cdef class Polynomial_dense_modn_ntl_zz(Polynomial_dense_mod_n): self.c.restore_c() zz_pX_SetCoeff_long(self.x, n, value) - cpdef ModuleElement _add_(self, ModuleElement _right): + cpdef _add_(self, ModuleElement _right): """ TESTS:: @@ -692,7 +692,7 @@ cdef class Polynomial_dense_modn_ntl_zz(Polynomial_dense_mod_n): if do_sig: sig_off() return r - cpdef ModuleElement _sub_(self, ModuleElement _right): + cpdef _sub_(self, ModuleElement _right): """ TESTS:: @@ -709,7 +709,7 @@ cdef class Polynomial_dense_modn_ntl_zz(Polynomial_dense_mod_n): if do_sig: sig_off() return r - cpdef RingElement _mul_(self, RingElement _right): + cpdef _mul_(self, RingElement _right): """ TESTS:: @@ -767,7 +767,7 @@ cdef class Polynomial_dense_modn_ntl_zz(Polynomial_dense_mod_n): if do_sig: sig_off() return r - cpdef ModuleElement _rmul_(self, RingElement c): + cpdef _rmul_(self, RingElement c): """ TESTS:: @@ -783,7 +783,7 @@ cdef class Polynomial_dense_modn_ntl_zz(Polynomial_dense_mod_n): if do_sig: sig_off() return r - cpdef ModuleElement _lmul_(self, RingElement c): + cpdef _lmul_(self, RingElement c): """ TESTS:: @@ -893,7 +893,7 @@ cdef class Polynomial_dense_modn_ntl_zz(Polynomial_dense_mod_n): sig_off() return q, r - cpdef RingElement _floordiv_(self, RingElement right): + cpdef _floordiv_(self, RingElement right): """ Returns the whole part of self/right, without remainder. @@ -1226,7 +1226,7 @@ cdef class Polynomial_dense_modn_ntl_ZZ(Polynomial_dense_mod_n): cdef ntl_ZZ_p val = ntl_ZZ_p(a, self.c) ZZ_pX_SetCoeff(self.x, n, val.x) - cpdef ModuleElement _add_(self, ModuleElement _right): + cpdef _add_(self, ModuleElement _right): """ TESTS:: @@ -1243,7 +1243,7 @@ cdef class Polynomial_dense_modn_ntl_ZZ(Polynomial_dense_mod_n): if do_sig: sig_off() return r - cpdef ModuleElement _sub_(self, ModuleElement _right): + cpdef _sub_(self, ModuleElement _right): """ TESTS:: @@ -1260,7 +1260,7 @@ cdef class Polynomial_dense_modn_ntl_ZZ(Polynomial_dense_mod_n): if do_sig: sig_off() return r - cpdef RingElement _mul_(self, RingElement _right): + cpdef _mul_(self, RingElement _right): """ TESTS:: @@ -1318,7 +1318,7 @@ cdef class Polynomial_dense_modn_ntl_ZZ(Polynomial_dense_mod_n): if do_sig: sig_off() return r - cpdef ModuleElement _rmul_(self, RingElement c): + cpdef _rmul_(self, RingElement c): """ TESTS:: @@ -1335,7 +1335,7 @@ cdef class Polynomial_dense_modn_ntl_ZZ(Polynomial_dense_mod_n): if do_sig: sig_off() return r - cpdef ModuleElement _lmul_(self, RingElement c): + cpdef _lmul_(self, RingElement c): """ TESTS:: @@ -1429,7 +1429,7 @@ cdef class Polynomial_dense_modn_ntl_ZZ(Polynomial_dense_mod_n): sig_off() return q, r - cpdef RingElement _floordiv_(self, RingElement right): + cpdef _floordiv_(self, RingElement right): """ Returns the whole part of self/right, without remainder. diff --git a/src/sage/rings/polynomial/polynomial_rational_flint.pyx b/src/sage/rings/polynomial/polynomial_rational_flint.pyx index 5381125e0b2..a04064aba6a 100644 --- a/src/sage/rings/polynomial/polynomial_rational_flint.pyx +++ b/src/sage/rings/polynomial/polynomial_rational_flint.pyx @@ -778,7 +778,7 @@ cdef class Polynomial_rational_flint(Polynomial): # Arithmetic # ########################################################################### - cpdef ModuleElement _add_(self, ModuleElement right): + cpdef _add_(self, ModuleElement right): """ Returns the sum of two rational polynomials. @@ -806,7 +806,7 @@ cdef class Polynomial_rational_flint(Polynomial): if do_sig: sig_off() return res - cpdef ModuleElement _sub_(self, ModuleElement right): + cpdef _sub_(self, ModuleElement right): """ Returns the difference of two rational polynomials. @@ -834,7 +834,7 @@ cdef class Polynomial_rational_flint(Polynomial): if do_sig: sig_off() return res - cpdef ModuleElement _neg_(self): + cpdef _neg_(self): """ Returns the difference of two rational polynomials. @@ -988,7 +988,7 @@ cdef class Polynomial_rational_flint(Polynomial): sig_off() return d, s, t - cpdef RingElement _mul_(self, RingElement right): + cpdef _mul_(self, RingElement right): """ Returns the product of self and right. @@ -1054,7 +1054,7 @@ cdef class Polynomial_rational_flint(Polynomial): if do_sig: sig_off() return res - cpdef ModuleElement _rmul_(self, RingElement left): + cpdef _rmul_(self, RingElement left): r""" Returns left * self, where left is a rational number. @@ -1074,7 +1074,7 @@ cdef class Polynomial_rational_flint(Polynomial): if do_sig: sig_off() return res - cpdef ModuleElement _lmul_(self, RingElement right): + cpdef _lmul_(self, RingElement 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 3eefe39c229..67a27853302 100644 --- a/src/sage/rings/polynomial/polynomial_real_mpfr_dense.pyx +++ b/src/sage/rings/polynomial/polynomial_real_mpfr_dense.pyx @@ -378,7 +378,7 @@ cdef class PolynomialRealDense(Polynomial): mpfr_neg(f._coeffs[i], self._coeffs[i], rnd) return f - cpdef ModuleElement _add_(left, ModuleElement _right): + cpdef _add_(left, ModuleElement _right): """ EXAMPLES:: @@ -411,7 +411,7 @@ cdef class PolynomialRealDense(Polynomial): f._normalize() return f - cpdef ModuleElement _sub_(left, ModuleElement _right): + cpdef _sub_(left, ModuleElement _right): """ EXAMPLES:: @@ -442,10 +442,10 @@ cdef class PolynomialRealDense(Polynomial): f._normalize() return f - cpdef ModuleElement _rmul_(self, RingElement c): + cpdef _rmul_(self, RingElement c): return self._lmul_(c) - cpdef ModuleElement _lmul_(self, RingElement c): + cpdef _lmul_(self, RingElement c): """ EXAMPLES:: @@ -467,7 +467,7 @@ cdef class PolynomialRealDense(Polynomial): mpfr_mul(f._coeffs[i], self._coeffs[i], a.value, rnd) return f - cpdef RingElement _mul_(left, RingElement _right): + cpdef _mul_(left, RingElement _right): """ Here we use the naive `O(n^2)` algorithm, as asymptotically faster algorithms such as Karatsuba can have very inaccurate results due to intermediate rounding errors. diff --git a/src/sage/rings/polynomial/polynomial_template.pxi b/src/sage/rings/polynomial/polynomial_template.pxi index 436df32923c..e71d9cb0f51 100644 --- a/src/sage/rings/polynomial/polynomial_template.pxi +++ b/src/sage/rings/polynomial/polynomial_template.pxi @@ -222,7 +222,7 @@ cdef class Polynomial_template(Polynomial): """ celement_destruct(&self.x, (self)._cparent) - cpdef ModuleElement _add_(self, ModuleElement right): + cpdef _add_(self, ModuleElement right): """ EXAMPLE:: @@ -240,7 +240,7 @@ cdef class Polynomial_template(Polynomial): #assert(r._parent(pari(self) + pari(right)) == r) return r - cpdef ModuleElement _sub_(self, ModuleElement right): + cpdef _sub_(self, ModuleElement right): """ EXAMPLE:: @@ -274,7 +274,7 @@ cdef class Polynomial_template(Polynomial): #assert(r._parent(-pari(self)) == r) return r - cpdef ModuleElement _rmul_(self, RingElement left): + cpdef _rmul_(self, RingElement left): """ EXAMPLES:: @@ -304,7 +304,7 @@ cdef class Polynomial_template(Polynomial): celement_mul_scalar(&r.x, &(self).x, left, (self)._cparent) return r - cpdef ModuleElement _lmul_(self, RingElement right): + cpdef _lmul_(self, RingElement right): """ EXAMPLES:: @@ -325,7 +325,7 @@ cdef class Polynomial_template(Polynomial): # all currently implemented rings are commutative return self._rmul_(right) - cpdef RingElement _mul_(self, RingElement right): + cpdef _mul_(self, RingElement right): """ EXAMPLE:: @@ -412,7 +412,7 @@ cdef class Polynomial_template(Polynomial): #assert(t._parent(tp) == t) return r,s,t - cpdef RingElement _floordiv_(self, RingElement right): + cpdef _floordiv_(self, RingElement right): """ EXAMPLES:: diff --git a/src/sage/rings/polynomial/polynomial_zmod_flint.pxd b/src/sage/rings/polynomial/polynomial_zmod_flint.pxd index 9809d8f0813..d8cef40282f 100644 --- a/src/sage/rings/polynomial/polynomial_zmod_flint.pxd +++ b/src/sage/rings/polynomial/polynomial_zmod_flint.pxd @@ -13,5 +13,5 @@ cdef class Polynomial_zmod_flint(Polynomial_template): cdef Polynomial_template _new(self) cdef int _set_list(self, x) except -1 cdef int _set_fmpz_poly(self, fmpz_poly_t) except -1 - cpdef _mul_trunc_opposite(self, Polynomial_zmod_flint other, length) + cpdef Polynomial _mul_trunc_opposite(self, Polynomial_zmod_flint other, length) cpdef rational_reconstruct(self, m, n_deg=?, d_deg=?) diff --git a/src/sage/rings/polynomial/polynomial_zmod_flint.pyx b/src/sage/rings/polynomial/polynomial_zmod_flint.pyx index e2d8532ea97..ffc62fd8a61 100644 --- a/src/sage/rings/polynomial/polynomial_zmod_flint.pyx +++ b/src/sage/rings/polynomial/polynomial_zmod_flint.pyx @@ -496,7 +496,7 @@ cdef class Polynomial_zmod_flint(Polynomial_template): _mul_short = _mul_trunc_ - cpdef _mul_trunc_opposite(self, Polynomial_zmod_flint other, n): + cpdef Polynomial _mul_trunc_opposite(self, Polynomial_zmod_flint other, n): """ Return the product of this polynomial and other ignoring the least significant `n` terms of the result which may be set to anything. diff --git a/src/sage/rings/polynomial/polynomial_zz_pex.pyx b/src/sage/rings/polynomial/polynomial_zz_pex.pyx index dabff28e310..d863fcb9925 100644 --- a/src/sage/rings/polynomial/polynomial_zz_pex.pyx +++ b/src/sage/rings/polynomial/polynomial_zz_pex.pyx @@ -193,7 +193,7 @@ cdef class Polynomial_ZZ_pEX(Polynomial_template): K = self._parent.base_ring() return [K(ZZ_pE_c_to_list(ZZ_pEX_coeff(self.x, i))) for i in range(celement_len(&self.x, (self)._cparent))] - cpdef ModuleElement _rmul_(self, RingElement left): + cpdef _rmul_(self, RingElement left): """ EXAMPLE:: sage: K.=GF(next_prime(2**60)**3) diff --git a/src/sage/rings/power_series_mpoly.pyx b/src/sage/rings/power_series_mpoly.pyx index 6642a0f515c..70dcb373541 100644 --- a/src/sage/rings/power_series_mpoly.pyx +++ b/src/sage/rings/power_series_mpoly.pyx @@ -103,7 +103,7 @@ cdef class PowerSeries_mpoly(PowerSeries): def _mpoly(self): return self.__f - cpdef RingElement _mul_(self, RingElement right_r): + cpdef _mul_(self, RingElement right_r): """ Return the product of two power series. """ @@ -127,7 +127,7 @@ cdef class PowerSeries_mpoly(PowerSeries): return PowerSeries_mpoly(self._parent, -self.__f, self._prec, check=False) - cpdef ModuleElement _add_(self, ModuleElement right_m): + cpdef _add_(self, ModuleElement right_m): """ EXAMPLES: """ @@ -135,7 +135,7 @@ cdef class PowerSeries_mpoly(PowerSeries): return PowerSeries_mpoly(self._parent, self.__f + right.__f, \ self.common_prec_c(right), check=True) - cpdef ModuleElement _sub_(self, ModuleElement right_m): + cpdef _sub_(self, ModuleElement right_m): """ Return difference of two power series. @@ -145,10 +145,10 @@ cdef class PowerSeries_mpoly(PowerSeries): return PowerSeries_mpoly(self._parent, self.__f - right.__f, \ self.common_prec_c(right), check=True) - cpdef ModuleElement _rmul_(self, RingElement c): + cpdef _rmul_(self, RingElement c): return PowerSeries_mpoly(self._parent, self.__f._rmul_(c), self._prec, check=False) - cpdef ModuleElement _lmul_(self, RingElement c): + cpdef _lmul_(self, RingElement c): return PowerSeries_mpoly(self._parent, self.__f._lmul_(c), self._prec, check=False) diff --git a/src/sage/rings/power_series_poly.pyx b/src/sage/rings/power_series_poly.pyx index 9ef90db4695..6b1705df6b5 100644 --- a/src/sage/rings/power_series_poly.pyx +++ b/src/sage/rings/power_series_poly.pyx @@ -467,7 +467,7 @@ cdef class PowerSeries_poly(PowerSeries): return PowerSeries_poly(self._parent, -self.__f, self._prec, check=False) - cpdef ModuleElement _add_(self, ModuleElement right_m): + cpdef _add_(self, ModuleElement right_m): """ EXAMPLES:: @@ -498,7 +498,7 @@ cdef class PowerSeries_poly(PowerSeries): return PowerSeries_poly(self._parent, self.__f + right.__f, \ self.common_prec_c(right), check=True) - cpdef ModuleElement _sub_(self, ModuleElement right_m): + cpdef _sub_(self, ModuleElement right_m): """ Return the difference of two power series. @@ -513,7 +513,7 @@ cdef class PowerSeries_poly(PowerSeries): return PowerSeries_poly(self._parent, self.__f - right.__f, \ self.common_prec_c(right), check=True) - cpdef RingElement _mul_(self, RingElement right_r): + cpdef _mul_(self, RingElement right_r): """ Return the product of two power series. @@ -529,7 +529,7 @@ cdef class PowerSeries_poly(PowerSeries): prec = prec, check = True) # check, since truncation may be needed - cpdef ModuleElement _rmul_(self, RingElement c): + cpdef _rmul_(self, RingElement c): """ Multiply self on the right by a scalar. @@ -542,7 +542,7 @@ cdef class PowerSeries_poly(PowerSeries): """ return PowerSeries_poly(self._parent, self.__f * c, self._prec, check=False) - cpdef ModuleElement _lmul_(self, RingElement c): + cpdef _lmul_(self, RingElement c): """ Multiply self on the left by a scalar. diff --git a/src/sage/rings/power_series_ring_element.pyx b/src/sage/rings/power_series_ring_element.pyx index 2c891df0e2b..63a90ecf1dc 100644 --- a/src/sage/rings/power_series_ring_element.pyx +++ b/src/sage/rings/power_series_ring_element.pyx @@ -1005,7 +1005,7 @@ cdef class PowerSeries(AlgebraElement): v[k-n] = x return self._parent(v, self.prec()-n) - cpdef RingElement _div_(self, RingElement denom_r): + cpdef _div_(self, RingElement denom_r): """ EXAMPLES:: @@ -1039,7 +1039,7 @@ cdef class PowerSeries(AlgebraElement): num = self return num*inv - cpdef RingElement _floordiv_(self, RingElement denom): + cpdef _floordiv_(self, RingElement denom): """ Euclidean division (over fields) or ordinary division (over other rings; deprecated). diff --git a/src/sage/rings/rational.pyx b/src/sage/rings/rational.pyx index 4cd4ec1fc96..b01193bd656 100644 --- a/src/sage/rings/rational.pyx +++ b/src/sage/rings/rational.pyx @@ -2076,7 +2076,7 @@ cdef class Rational(sage.structure.element.FieldElement): ################################################################ # Optimized arithmetic ################################################################ - cpdef ModuleElement _add_(self, ModuleElement right): + cpdef _add_(self, ModuleElement right): """ Return ``right`` plus ``self``. @@ -2092,7 +2092,7 @@ cdef class Rational(sage.structure.element.FieldElement): mpq_add(x.value, self.value, (right).value) return x - cpdef ModuleElement _sub_(self, ModuleElement right): + cpdef _sub_(self, ModuleElement right): """ Return ``self`` minus ``right``. @@ -2107,7 +2107,7 @@ cdef class Rational(sage.structure.element.FieldElement): mpq_sub(x.value, self.value, (right).value) return x - cpdef ModuleElement _neg_(self): + cpdef _neg_(self): """ Negate ``self``. @@ -2121,7 +2121,7 @@ cdef class Rational(sage.structure.element.FieldElement): mpq_neg(x.value, self.value) return x - cpdef RingElement _mul_(self, RingElement right): + cpdef _mul_(self, RingElement right): """ Return ``self`` times ``right``. @@ -2143,7 +2143,7 @@ cdef class Rational(sage.structure.element.FieldElement): mpq_mul(x.value, self.value, (right).value) return x - cpdef RingElement _div_(self, RingElement right): + cpdef _div_(self, RingElement right): """ Return ``self`` divided by ``right``. diff --git a/src/sage/rings/real_arb.pyx b/src/sage/rings/real_arb.pyx index f97557eab33..acb9375c6da 100644 --- a/src/sage/rings/real_arb.pyx +++ b/src/sage/rings/real_arb.pyx @@ -2610,7 +2610,7 @@ cdef class RealBall(RingElement): if _do_sig(prec(self)): sig_off() return res - cpdef ModuleElement _add_(self, ModuleElement other): + cpdef _add_(self, ModuleElement other): """ Return the sum of two balls, rounded to the ambient field's precision. @@ -2628,7 +2628,7 @@ cdef class RealBall(RingElement): if _do_sig(prec(self)): sig_off() return res - cpdef ModuleElement _sub_(self, ModuleElement other): + cpdef _sub_(self, ModuleElement other): """ Return the difference of two balls, rounded to the ambient field's precision. @@ -2647,7 +2647,7 @@ cdef class RealBall(RingElement): if _do_sig(prec(self)): sig_off() return res - cpdef RingElement _mul_(self, RingElement other): + cpdef _mul_(self, RingElement other): """ Return the product of two balls, rounded to the ambient field's precision. @@ -2666,7 +2666,7 @@ cdef class RealBall(RingElement): if _do_sig(prec(self)): sig_off() return res - cpdef RingElement _div_(self, RingElement other): + cpdef _div_(self, RingElement other): """ Return the quotient of two balls, rounded to the ambient field's precision. diff --git a/src/sage/rings/real_double.pyx b/src/sage/rings/real_double.pyx index 8add1808723..21334f557e6 100644 --- a/src/sage/rings/real_double.pyx +++ b/src/sage/rings/real_double.pyx @@ -1218,7 +1218,7 @@ cdef class RealDoubleElement(FieldElement): x._value = 1.0 / self._value return x - cpdef ModuleElement _add_(self, ModuleElement right): + cpdef _add_(self, ModuleElement right): """ Add two real numbers with the same parent. @@ -1231,7 +1231,7 @@ cdef class RealDoubleElement(FieldElement): x._value = self._value + (right)._value return x - cpdef ModuleElement _sub_(self, ModuleElement right): + cpdef _sub_(self, ModuleElement right): """ Subtract two real numbers with the same parent. @@ -1244,7 +1244,7 @@ cdef class RealDoubleElement(FieldElement): x._value = self._value - (right)._value return x - cpdef RingElement _mul_(self, RingElement right): + cpdef _mul_(self, RingElement right): """ Multiply two real numbers with the same parent. @@ -1257,7 +1257,7 @@ cdef class RealDoubleElement(FieldElement): x._value = self._value * (right)._value return x - cpdef RingElement _div_(self, RingElement right): + cpdef _div_(self, RingElement right): """ Divide ``self`` by ``right``. diff --git a/src/sage/rings/real_interval_absolute.pyx b/src/sage/rings/real_interval_absolute.pyx index a319194da53..da2749191be 100644 --- a/src/sage/rings/real_interval_absolute.pyx +++ b/src/sage/rings/real_interval_absolute.pyx @@ -634,7 +634,7 @@ cdef class RealIntervalAbsoluteElement(FieldElement): else: return self._new_c(zero, max(-self._mantissa, self._mantissa + self._diameter)) - cpdef ModuleElement _add_(self, ModuleElement _other): + cpdef _add_(self, ModuleElement _other): """ TESTS:: @@ -652,7 +652,7 @@ cdef class RealIntervalAbsoluteElement(FieldElement): cdef RealIntervalAbsoluteElement other = _other return self._new_c(self._mantissa + other._mantissa, self._diameter + other._diameter) - cpdef ModuleElement _sub_(self, ModuleElement _other): + cpdef _sub_(self, ModuleElement _other): """ TESTS:: @@ -672,7 +672,7 @@ cdef class RealIntervalAbsoluteElement(FieldElement): cdef RealIntervalAbsoluteElement other = _other return self._new_c(self._mantissa - other._mantissa - other._diameter, self._diameter + other._diameter) - cpdef RingElement _mul_(self, RingElement _other): + cpdef _mul_(self, RingElement _other): """ TESTS:: @@ -832,7 +832,7 @@ cdef class RealIntervalAbsoluteElement(FieldElement): res = -res return res - cpdef RingElement _div_(self, RingElement _other): + cpdef _div_(self, RingElement _other): """ TESTS:: diff --git a/src/sage/rings/real_lazy.pyx b/src/sage/rings/real_lazy.pyx index 2e9c2a5b4c2..42a4a6878cf 100644 --- a/src/sage/rings/real_lazy.pyx +++ b/src/sage/rings/real_lazy.pyx @@ -545,7 +545,7 @@ cdef int get_new_prec(R, int depth) except -1: cdef class LazyFieldElement(FieldElement): - cpdef ModuleElement _add_(left, ModuleElement right): + cpdef _add_(left, ModuleElement right): """ Add ``left`` with ``right``. @@ -561,7 +561,7 @@ cdef class LazyFieldElement(FieldElement): pass return left._new_binop(left, right, add) - cpdef ModuleElement _sub_(left, ModuleElement right): + cpdef _sub_(left, ModuleElement right): """ Subtract ``right`` from ``left``. @@ -577,7 +577,7 @@ cdef class LazyFieldElement(FieldElement): pass return left._new_binop(left, right, sub) - cpdef RingElement _mul_(left, RingElement right): + cpdef _mul_(left, RingElement right): """ Mutliply ``left`` with ``right``. @@ -593,7 +593,7 @@ cdef class LazyFieldElement(FieldElement): pass return left._new_binop(left, right, mul) - cpdef RingElement _div_(left, RingElement right): + cpdef _div_(left, RingElement right): """ Divide ``left`` by ``right``. diff --git a/src/sage/rings/real_mpfi.pyx b/src/sage/rings/real_mpfi.pyx index d07a54b29ad..69a98b4c39d 100644 --- a/src/sage/rings/real_mpfi.pyx +++ b/src/sage/rings/real_mpfi.pyx @@ -2562,7 +2562,7 @@ cdef class RealIntervalFieldElement(RingElement): # Basic Arithmetic ######################## - cpdef ModuleElement _add_(self, ModuleElement other): + cpdef _add_(self, ModuleElement other): """ Add two real intervals with the same parent. @@ -2608,7 +2608,7 @@ cdef class RealIntervalFieldElement(RingElement): mpfi_inv(x.value, self.value) return x - cpdef ModuleElement _sub_(self, ModuleElement right): + cpdef _sub_(self, ModuleElement right): """ Subtract two real intervals with the same parent. @@ -2627,7 +2627,7 @@ cdef class RealIntervalFieldElement(RingElement): mpfi_sub(x.value, self.value, (right).value) return x - cpdef RingElement _mul_(self, RingElement right): + cpdef _mul_(self, RingElement right): """ Multiply two real intervals with the same parent. @@ -2665,7 +2665,7 @@ cdef class RealIntervalFieldElement(RingElement): return x - cpdef RingElement _div_(self, RingElement right): + cpdef _div_(self, RingElement right): """ Divide ``self`` by ``right``, where both are real intervals with the same parent. @@ -2693,7 +2693,7 @@ cdef class RealIntervalFieldElement(RingElement): (right).value) return x - cpdef ModuleElement _neg_(self): + cpdef _neg_(self): """ Return the additive "inverse" of this interval. (Technically, non-precise intervals don't have additive inverses.) diff --git a/src/sage/rings/real_mpfr.pyx b/src/sage/rings/real_mpfr.pyx index f27a21c76ac..88b56987c61 100644 --- a/src/sage/rings/real_mpfr.pyx +++ b/src/sage/rings/real_mpfr.pyx @@ -2194,7 +2194,7 @@ cdef class RealNumber(sage.structure.element.RingElement): # Basic Arithmetic ######################## - cpdef ModuleElement _add_(self, ModuleElement other): + cpdef _add_(self, ModuleElement other): """ Add two real numbers with the same parent. @@ -2223,7 +2223,7 @@ cdef class RealNumber(sage.structure.element.RingElement): """ return self._parent(1) / self - cpdef ModuleElement _sub_(self, ModuleElement right): + cpdef _sub_(self, ModuleElement right): """ Subtract two real numbers with the same parent. @@ -2253,7 +2253,7 @@ cdef class RealNumber(sage.structure.element.RingElement): import sympy return sympy.simplify(float(self)) - cpdef RingElement _mul_(self, RingElement right): + cpdef _mul_(self, RingElement right): """ Multiply two real numbers with the same parent. @@ -2286,7 +2286,7 @@ cdef class RealNumber(sage.structure.element.RingElement): return x - cpdef RingElement _div_(self, RingElement right): + cpdef _div_(self, RingElement right): """ Divide ``self`` by other, where both are real numbers with the same parent. @@ -2306,7 +2306,7 @@ cdef class RealNumber(sage.structure.element.RingElement): (right).value, (self._parent).rnd) return x - cpdef ModuleElement _neg_(self): + cpdef _neg_(self): """ Return the negative of ``self``. diff --git a/src/sage/rings/semirings/tropical_semiring.pyx b/src/sage/rings/semirings/tropical_semiring.pyx index fa06154e1e6..4ab47ab06d2 100644 --- a/src/sage/rings/semirings/tropical_semiring.pyx +++ b/src/sage/rings/semirings/tropical_semiring.pyx @@ -210,7 +210,7 @@ cdef class TropicalSemiringElement(RingElement): return 1 return 0 - cpdef ModuleElement _add_(left, ModuleElement right): + cpdef _add_(left, ModuleElement right): """ Add ``left`` to ``right``. @@ -264,7 +264,7 @@ cdef class TropicalSemiringElement(RingElement): return self raise ArithmeticError("cannot negate any non-infinite element") - cpdef RingElement _mul_(left, RingElement right): + cpdef _mul_(left, RingElement right): """ Multiply ``left`` and ``right``. @@ -290,7 +290,7 @@ cdef class TropicalSemiringElement(RingElement): x._val = self._val + rhs._val return x - cpdef RingElement _div_(left, RingElement right): + cpdef _div_(left, RingElement right): """ Divide ``left`` by ``right``. diff --git a/src/sage/schemes/toric/divisor_class.pyx b/src/sage/schemes/toric/divisor_class.pyx index d6b355eaa69..aa1c95c8aa1 100644 --- a/src/sage/schemes/toric/divisor_class.pyx +++ b/src/sage/schemes/toric/divisor_class.pyx @@ -209,7 +209,7 @@ cdef class ToricRationalDivisorClass(Vector_rational_dense): # Now let the standard framework work... return Vector_rational_dense._act_on_(self, other, self_on_left) - cpdef Element _dot_product_(self, Vector right): + cpdef _dot_product_(self, Vector right): r""" Raise a ``TypeError`` exception. diff --git a/src/sage/structure/element.pxd b/src/sage/structure/element.pxd index 87b586c7d80..95b16ef7d41 100644 --- a/src/sage/structure/element.pxd +++ b/src/sage/structure/element.pxd @@ -50,36 +50,34 @@ cdef class ModuleElement(Element) # forward declaration cdef class RingElement(ModuleElement) # forward declaration cdef class ModuleElement(Element): - - cpdef ModuleElement _add_(self, ModuleElement right) - cpdef ModuleElement _sub_(self, ModuleElement right) - cpdef ModuleElement _neg_(self) + cpdef _add_(self, ModuleElement right) + cpdef _sub_(self, ModuleElement right) + cpdef _neg_(self) # self._rmul_(x) is x * self - cpdef ModuleElement _lmul_(self, RingElement right) + cpdef _lmul_(self, RingElement right) # self._lmul_(x) is self * x, to abide with Python conventions. - cpdef ModuleElement _rmul_(self, RingElement left) + cpdef _rmul_(self, RingElement left) - cdef ModuleElement _mul_long(self, long n) + cdef _mul_long(self, long n) # Coerce x to the base ring of self and return the result. cdef RingElement coerce_to_base_ring(self, x) cdef class MonoidElement(Element): - cpdef MonoidElement _mul_(self, MonoidElement right) + cpdef _mul_(self, MonoidElement right) cdef class MultiplicativeGroupElement(MonoidElement): - cpdef MultiplicativeGroupElement _div_(self, MultiplicativeGroupElement right) - + cpdef _div_(self, MultiplicativeGroupElement right) cdef class AdditiveGroupElement(ModuleElement): pass cdef class RingElement(ModuleElement): - cpdef RingElement _mul_(self, RingElement right) - cpdef RingElement _div_(self, RingElement right) - cpdef RingElement _floordiv_(self, RingElement right) + cpdef _mul_(self, RingElement right) + cpdef _div_(self, RingElement right) + cpdef _floordiv_(self, RingElement right) - cdef RingElement _add_long(self, long n) + cdef _add_long(self, long n) cdef class CommutativeRingElement(RingElement): pass @@ -118,10 +116,10 @@ cdef class Vector(ModuleElement): # Return the dot product using the simple metric # $e_i \cdot e_j = \delta_{ij}$. The first assumes that the parents # are equal, both assume that the degrees are equal. - cpdef Element _dot_product_(Vector left, Vector right) - cpdef Element _dot_product_coerce_(Vector left, Vector right) + cpdef _dot_product_(Vector left, Vector right) + cpdef _dot_product_coerce_(Vector left, Vector right) - cpdef Vector _pairwise_product_(Vector left, Vector right) # override, call if parents the same + cpdef _pairwise_product_(Vector left, Vector right) # override, call if parents the same cdef bint is_sparse_c(self) cdef bint is_dense_c(self) @@ -132,9 +130,9 @@ cdef class Matrix(ModuleElement): cdef Py_ssize_t _nrows cdef Py_ssize_t _ncols - cdef Vector _vector_times_matrix_(matrix_right, Vector vector_left) # OK to override, AND call directly - cdef Vector _matrix_times_vector_(matrix_left, Vector vector_right) # OK to override, AND call directly - cdef Matrix _matrix_times_matrix_(left, Matrix right) # OK to override, AND call directly + cdef _vector_times_matrix_(matrix_right, Vector vector_left) # OK to override, AND call directly + cdef _matrix_times_vector_(matrix_left, Vector vector_right) # OK to override, AND call directly + cdef _matrix_times_matrix_(left, Matrix right) # OK to override, AND call directly cdef bint is_sparse_c(self) cdef bint is_dense_c(self) diff --git a/src/sage/structure/element.pyx b/src/sage/structure/element.pyx index 2e7dea3a8c8..8e7f5bed4b7 100644 --- a/src/sage/structure/element.pyx +++ b/src/sage/structure/element.pyx @@ -1308,7 +1308,7 @@ cdef class ModuleElement(Element): return (left)._add_(right) return coercion_model.bin_op(left, right, add) - cpdef ModuleElement _add_(left, ModuleElement right): + cpdef _add_(left, ModuleElement right): raise TypeError(arith_error_message(left, right, add)) def __iadd__(ModuleElement self, right): @@ -1329,7 +1329,7 @@ cdef class ModuleElement(Element): return (left)._sub_(right) return coercion_model.bin_op(left, right, sub) - cpdef ModuleElement _sub_(left, ModuleElement right): + cpdef _sub_(left, ModuleElement right): # default implementation is to use the negation and addition # dispatchers: return left._add_(-right) @@ -1351,7 +1351,7 @@ cdef class ModuleElement(Element): """ return self._neg_() - cpdef ModuleElement _neg_(self): + cpdef _neg_(self): # default implementation is to try multiplying by -1. if self._parent._base is None: return coercion_model.bin_op(-1, self, mul) @@ -1376,7 +1376,7 @@ cdef class ModuleElement(Element): return coercion_model.bin_op(left, right, imul) # rmul -- left * self - cpdef ModuleElement _rmul_(self, RingElement left): + cpdef _rmul_(self, RingElement left): """ Default module left scalar multiplication, which is to try to canonically coerce the scalar to the integers and do that @@ -1388,7 +1388,7 @@ cdef class ModuleElement(Element): # lmul -- self * right - cpdef ModuleElement _lmul_(self, RingElement right): + cpdef _lmul_(self, RingElement right): """ Default module left scalar multiplication, which is to try to canonically coerce the scalar to the integers and do that @@ -1398,7 +1398,7 @@ cdef class ModuleElement(Element): """ return None - cdef ModuleElement _mul_long(self, long n): + cdef _mul_long(self, long n): """ Generic path for multiplying by a C long, assumed to commute. """ @@ -1462,7 +1462,7 @@ cdef class MonoidElement(Element): raise - cpdef MonoidElement _mul_(left, MonoidElement right): + cpdef _mul_(left, MonoidElement right): """ Cython classes should override this function to implement multiplication. See extensive documentation at the top of element.pyx. @@ -1537,10 +1537,10 @@ cdef class AdditiveGroupElement(ModuleElement): def __invert__(self): raise NotImplementedError("multiplicative inverse not defined for additive group elements") - cpdef ModuleElement _rmul_(self, RingElement left): + cpdef _rmul_(self, RingElement left): return self._lmul_(left) - cpdef ModuleElement _lmul_(self, RingElement right): + cpdef _lmul_(self, RingElement right): """ Default module left scalar multiplication, which is to try to canonically coerce the scalar to the integers and do that @@ -1598,7 +1598,7 @@ cdef class MultiplicativeGroupElement(MonoidElement): return (left)._div_(right) return coercion_model.bin_op(left, right, div) - cpdef MultiplicativeGroupElement _div_(self, MultiplicativeGroupElement right): + cpdef _div_(self, MultiplicativeGroupElement right): """ Cython classes should override this function to implement division. See extensive documentation at the top of element.pyx. @@ -1643,7 +1643,7 @@ cdef class RingElement(ModuleElement): return (right)._add_long(PyInt_AS_LONG(left)) return coercion_model.bin_op(left, right, add) - cdef RingElement _add_long(self, long n): + cdef _add_long(self, long n): """ Generic path for adding a C long, assumed to commute. """ @@ -1669,11 +1669,11 @@ cdef class RingElement(ModuleElement): # Multiplication ################################## - cpdef ModuleElement _lmul_(self, RingElement right): + cpdef _lmul_(self, RingElement right): # We return None to invoke the default action of coercing into self return None - cpdef ModuleElement _rmul_(self, RingElement left): + cpdef _rmul_(self, RingElement left): # We return None to invoke the default action of coercing into self return None @@ -1797,7 +1797,7 @@ cdef class RingElement(ModuleElement): return (right)._mul_long(PyInt_AS_LONG(left)) return coercion_model.bin_op(left, right, mul) - cpdef RingElement _mul_(self, RingElement right): + cpdef _mul_(self, RingElement right): """ Cython classes should override this function to implement multiplication. See extensive documentation at the top of element.pyx. @@ -1951,7 +1951,7 @@ cdef class RingElement(ModuleElement): return (self)._div_(right) return coercion_model.bin_op(self, right, div) - cpdef RingElement _div_(self, RingElement right): + cpdef _div_(self, RingElement right): """ Cython classes should override this function to implement division. See extensive documentation at the top of element.pyx. @@ -1997,7 +1997,7 @@ cdef class RingElement(ModuleElement): return (self)._floordiv_(right) return coercion_model.bin_op(self, right, floordiv) - cpdef RingElement _floordiv_(self, RingElement right): + cpdef _floordiv_(self, RingElement right): """ Cython classes should override this function to implement floor division. See extensive documentation at the top of element.pyx. @@ -2697,13 +2697,13 @@ cdef class Vector(ModuleElement): return (left)._dot_product_(right) return coercion_model.bin_op(left, right, mul) - cpdef Element _dot_product_(Vector left, Vector right): + cpdef _dot_product_(Vector left, Vector right): return left._dot_product_coerce_(right) - cpdef Element _dot_product_coerce_(Vector left, Vector right): + cpdef _dot_product_coerce_(Vector left, Vector right): raise TypeError(arith_error_message(left, right, mul)) - cpdef Vector _pairwise_product_(Vector left, Vector right): + cpdef _pairwise_product_(Vector left, Vector right): raise TypeError("unsupported operation for '%s' and '%s'"%(parent_c(left), parent_c(right))) def __truediv__(self, right): @@ -3042,13 +3042,13 @@ cdef class Matrix(ModuleElement): return left * ~right return coercion_model.bin_op(left, right, div) - cdef Vector _vector_times_matrix_(matrix_right, Vector vector_left): + cdef _vector_times_matrix_(matrix_right, Vector vector_left): raise TypeError - cdef Vector _matrix_times_vector_(matrix_left, Vector vector_right): + cdef _matrix_times_vector_(matrix_left, Vector vector_right): raise TypeError - cdef Matrix _matrix_times_matrix_(left, Matrix right): + cdef _matrix_times_matrix_(left, Matrix right): raise TypeError @@ -3135,7 +3135,7 @@ cdef class EuclideanDomainElement(PrincipalIdealDomainElement): x, y = canonical_coercion(self, other) return x.quo_rem(y) - cpdef RingElement _floordiv_(self, RingElement right): + cpdef _floordiv_(self, RingElement right): """ Quotient of division of ``self`` by other. This is denoted //. @@ -3194,7 +3194,7 @@ def is_FieldElement(x): return isinstance(x, FieldElement) cdef class FieldElement(CommutativeRingElement): - cpdef RingElement _floordiv_(self, RingElement right): + cpdef _floordiv_(self, RingElement right): """ Return the quotient of self and other. Since these are field elements, the floor division is exactly the same as usual division. diff --git a/src/sage/symbolic/expression.pyx b/src/sage/symbolic/expression.pyx index 3d53cac55f4..2fd32e87116 100644 --- a/src/sage/symbolic/expression.pyx +++ b/src/sage/symbolic/expression.pyx @@ -2822,7 +2822,7 @@ cdef class Expression(CommutativeRingElement): except TypeError: return self._parent._coerce_(z) - cpdef ModuleElement _add_(left, ModuleElement right): + cpdef _add_(left, ModuleElement right): """ Add left and right. @@ -2917,7 +2917,7 @@ cdef class Expression(CommutativeRingElement): x = gadd(left._gobj, _right._gobj) return new_Expression_from_GEx(left._parent, x) - cpdef ModuleElement _sub_(left, ModuleElement right): + cpdef _sub_(left, ModuleElement right): """ EXAMPLES:: @@ -2969,7 +2969,7 @@ cdef class Expression(CommutativeRingElement): x = gsub(left._gobj, _right._gobj) return new_Expression_from_GEx(left._parent, x) - cpdef RingElement _mul_(left, RingElement right): + cpdef _mul_(left, RingElement right): """ Multiply left and right. @@ -3202,7 +3202,7 @@ cdef class Expression(CommutativeRingElement): x = gmul(left._gobj, _right._gobj) return new_Expression_from_GEx(left._parent, x) - cpdef RingElement _div_(left, RingElement right): + cpdef _div_(left, RingElement right): """ Divide left and right.