diff --git a/src/sage/rings/complex_arb.pyx b/src/sage/rings/complex_arb.pyx index 70a5e3f2423..095de7b6774 100644 --- a/src/sage/rings/complex_arb.pyx +++ b/src/sage/rings/complex_arb.pyx @@ -1261,6 +1261,7 @@ class ComplexBallField(UniqueRepresentation, sage.rings.abc.ComplexBallField): return res + cdef inline bint _do_sig(long prec) noexcept: """ Whether signal handlers should be installed for calls to FLINT. diff --git a/src/sage/rings/complex_double.pyx b/src/sage/rings/complex_double.pyx index aa4e284f231..460d546b200 100644 --- a/src/sage/rings/complex_double.pyx +++ b/src/sage/rings/complex_double.pyx @@ -505,7 +505,6 @@ cdef class ComplexDoubleField_class(sage.rings.abc.ComplexDoubleField): from sage.rings.complex_mpfr import ComplexField return ComplexField(prec) - def gen(self, n=0): """ Return the generator of the complex double field. @@ -699,6 +698,7 @@ cdef ComplexDoubleElement new_ComplexDoubleElement(): z = ComplexDoubleElement.__new__(ComplexDoubleElement) return z + def is_ComplexDoubleElement(x): """ Return ``True`` if ``x`` is a :class:`ComplexDoubleElement`. @@ -1530,7 +1530,6 @@ cdef class ComplexDoubleElement(FieldElement): else: return z - def is_square(self): r""" This function always returns ``True`` as `\CC` is algebraically closed. @@ -2018,7 +2017,6 @@ cdef class ComplexDoubleElement(FieldElement): """ return self._new_c(gsl_complex_tanh(self._complex)) - def sech(self): r""" This function returns the complex hyperbolic secant of the complex @@ -2594,8 +2592,6 @@ cdef class ComplexToCDF(Morphism): return "Native" - - ##################################################### # unique objects ##################################################### @@ -2604,6 +2600,7 @@ _CDF = ComplexDoubleField_class() CDF = _CDF # external interface cdef ComplexDoubleElement I = ComplexDoubleElement(0,1) + def ComplexDoubleField(): """ Returns the field of double precision complex numbers. @@ -2617,6 +2614,7 @@ def ComplexDoubleField(): """ return _CDF + from sage.misc.parser import Parser cdef cdf_parser = Parser(float, float, {"I" : _CDF.gen(), "i" : _CDF.gen()}) diff --git a/src/sage/rings/complex_mpc.pyx b/src/sage/rings/complex_mpc.pyx index 1a4c49504c0..eda06a9fc2c 100644 --- a/src/sage/rings/complex_mpc.pyx +++ b/src/sage/rings/complex_mpc.pyx @@ -95,6 +95,7 @@ AA = None QQbar = None CDF = CLF = RLF = None + def late_import(): """ Import the objects/modules after build (when needed). @@ -112,6 +113,7 @@ def late_import(): from sage.rings.real_lazy import CLF, RLF from sage.rings.complex_double import CDF + _mpfr_rounding_modes = ['RNDN', 'RNDZ', 'RNDU', 'RNDD'] _mpc_rounding_modes = [ 'RNDNN', 'RNDZN', 'RNDUN', 'RNDDN', @@ -233,6 +235,8 @@ cpdef inline split_complex_string(string, int base=10): # their parent via direct C calls, which will be faster. cache = {} + + def MPComplexField(prec=53, rnd="RNDNN", names=None): """ Return the complex field with real and imaginary parts having @@ -2412,6 +2416,7 @@ cdef inline mp_exp_t max_exp(MPComplexNumber z) noexcept: return mpfr_get_exp(z.value.im) return max_exp_t(mpfr_get_exp(z.value.re), mpfr_get_exp(z.value.im)) + def __create__MPComplexField_version0 (prec, rnd): """ Create a :class:`MPComplexField`. @@ -2424,6 +2429,7 @@ def __create__MPComplexField_version0 (prec, rnd): """ return MPComplexField(prec, rnd) + def __create__MPComplexNumber_version0 (parent, s, base=10): """ Create a :class:`MPComplexNumber`. @@ -2439,6 +2445,7 @@ def __create__MPComplexNumber_version0 (parent, s, base=10): """ return MPComplexNumber(parent, s, base=base) + # original version of the file had this with only 1 underscore - TCS __create_MPComplexNumber_version0 = __create__MPComplexNumber_version0 diff --git a/src/sage/rings/complex_mpfr.pyx b/src/sage/rings/complex_mpfr.pyx index 6022d4147b9..e1ce333d57d 100644 --- a/src/sage/rings/complex_mpfr.pyx +++ b/src/sage/rings/complex_mpfr.pyx @@ -69,6 +69,8 @@ NumberFieldElement_quadratic = () AA = None QQbar = None CDF = CLF = RLF = None + + def late_import(): """ Import the objects/modules after build (when needed). @@ -89,12 +91,14 @@ def late_import(): from sage.rings.real_lazy import CLF, RLF from sage.rings.complex_double import CDF + cdef object numpy_complex_interface = {'typestr': '=c16'} cdef object numpy_object_interface = {'typestr': '|O'} cdef mpfr_rnd_t rnd rnd = MPFR_RNDN + def set_global_complex_round_mode(n): """ Set the global complex rounding mode. @@ -111,6 +115,7 @@ def set_global_complex_round_mode(n): global rnd rnd = n + def is_ComplexNumber(x): r""" Return ``True`` if ``x`` is a complex number. In particular, if ``x`` is @@ -145,6 +150,8 @@ def is_ComplexNumber(x): cache = {} + + def ComplexField(prec=53, names=None): """ Return the complex field with real and imaginary parts having prec @@ -673,7 +680,6 @@ class ComplexField_class(sage.rings.abc.ComplexField): from sage.categories.pushout import AlgebraicClosureFunctor return (AlgebraicClosureFunctor(), self._real_field()) - def random_element(self, component_max=1, *args, **kwds): r""" Return a uniformly distributed random number inside a square @@ -857,6 +863,7 @@ class ComplexField_class(sage.rings.abc.ComplexField): return Factorization([(R(gg).monic(), e) for gg, e in zip(*F)], f.leading_coefficient()) + cdef class ComplexNumber(sage.structure.element.FieldElement): """ A floating point approximation to a complex number using any @@ -1429,7 +1436,6 @@ cdef class ComplexNumber(sage.structure.element.FieldElement): """ return gmpy2.GMPy_MPC_From_mpfr(self.__re, self.__im) - def _mpmath_(self, prec=None, rounding=None): """ Return an mpmath version of ``self``. @@ -2300,8 +2306,6 @@ cdef class ComplexNumber(sage.structure.element.FieldElement): mpfr_clear(ch) return z - - def eta(self, omit_frac=False): r""" Return the value of the Dedekind `\eta` function on ``self``, @@ -2367,7 +2371,6 @@ cdef class ComplexNumber(sage.structure.element.FieldElement): except sage.libs.pari.all.PariError: raise ValueError("value must be in the upper half plane") - def sin(self): """ Return the sine of ``self``. @@ -2461,7 +2464,6 @@ cdef class ComplexNumber(sage.structure.element.FieldElement): mpfr_clear(a) return z - def tanh(self): """ Return the hyperbolic tangent of ``self``. @@ -2729,7 +2731,6 @@ cdef class ComplexNumber(sage.structure.element.FieldElement): mpfr_atan2(x.value, self.__im, self.__re, rnd) return x - def arg(self): """ See :meth:`argument`. @@ -3080,7 +3081,6 @@ cdef class ComplexNumber(sage.structure.element.FieldElement): mpfr_clear(r) return zlist - def is_square(self): r""" This function always returns true as `\CC` is algebraically closed. @@ -3498,6 +3498,7 @@ cpdef int cmp_abs(ComplexNumber a, ComplexNumber b) noexcept: return res + def _format_complex_number(real, imag, format_spec): """ Construct a formatted string from real and imaginary parts. diff --git a/src/sage/rings/factorint.pyx b/src/sage/rings/factorint.pyx index 2144e6d71c7..5e8ae9ddd94 100644 --- a/src/sage/rings/factorint.pyx +++ b/src/sage/rings/factorint.pyx @@ -208,6 +208,7 @@ cpdef factor_aurifeuillian(n, check=True): return F return [n] + def factor_cunningham(m, proof=None): r""" Return factorization of ``self`` obtained using trial division @@ -251,6 +252,7 @@ def factor_cunningham(m, proof=None): else: return IntegerFactorization(L)*n.factor(proof=proof) + cpdef factor_trial_division(m, long limit=LONG_MAX): r""" Return partial factorization of ``self`` obtained using trial division diff --git a/src/sage/rings/finite_rings/element_givaro.pyx b/src/sage/rings/finite_rings/element_givaro.pyx index c9b9e323181..c1ab2de2aaf 100644 --- a/src/sage/rings/finite_rings/element_givaro.pyx +++ b/src/sage/rings/finite_rings/element_givaro.pyx @@ -1740,6 +1740,7 @@ def unpickle_FiniteField_givaroElement(parent, int x): """ return make_FiniteField_givaroElement(parent._cache, x) + from sage.misc.persist import register_unpickle_override register_unpickle_override('sage.rings.finite_field_givaro', 'unpickle_FiniteField_givaroElement', unpickle_FiniteField_givaroElement) diff --git a/src/sage/rings/finite_rings/element_ntl_gf2e.pyx b/src/sage/rings/finite_rings/element_ntl_gf2e.pyx index 399bb76815b..512ac4ec1d2 100644 --- a/src/sage/rings/finite_rings/element_ntl_gf2e.pyx +++ b/src/sage/rings/finite_rings/element_ntl_gf2e.pyx @@ -1314,5 +1314,6 @@ def unpickleFiniteField_ntl_gf2eElement(parent, elem): """ return parent(elem) + from sage.misc.persist import register_unpickle_override register_unpickle_override('sage.rings.finite_field_ntl_gf2e', 'unpickleFiniteField_ntl_gf2eElement', unpickleFiniteField_ntl_gf2eElement) diff --git a/src/sage/rings/finite_rings/finite_field_base.pyx b/src/sage/rings/finite_rings/finite_field_base.pyx index 661b2ba08e6..8be832999b2 100644 --- a/src/sage/rings/finite_rings/finite_field_base.pyx +++ b/src/sage/rings/finite_rings/finite_field_base.pyx @@ -277,7 +277,6 @@ cdef class FiniteField(Field): return "GF(%s,Variable=>symbol %s)" % (self.order(), self.variable_name()) - def _sage_input_(self, sib, coerced): r""" Produce an expression which will reproduce this value when evaluated. @@ -1115,7 +1114,6 @@ cdef class FiniteField(Field): """ return self.order() - 1 - def random_element(self, *args, **kwds): r""" A random element of the finite field. Passes arguments to @@ -2162,6 +2160,7 @@ cdef class FiniteField(Field): python_int = int.from_bytes(input_bytes, byteorder=byteorder) return self.from_integer(python_int) + def unpickle_FiniteField_ext(_type, order, variable_name, modulus, kwargs): r""" Used to unpickle extensions of finite fields. Now superseded (hence no @@ -2177,6 +2176,7 @@ def unpickle_FiniteField_prm(_type, order, variable_name, kwargs): """ return _type(order, variable_name, **kwargs) + register_unpickle_override( 'sage.rings.ring', 'unpickle_FiniteField_prm', unpickle_FiniteField_prm) diff --git a/src/sage/rings/finite_rings/integer_mod.pyx b/src/sage/rings/finite_rings/integer_mod.pyx index 94a82bc3d47..097f8ac87d3 100644 --- a/src/sage/rings/finite_rings/integer_mod.pyx +++ b/src/sage/rings/finite_rings/integer_mod.pyx @@ -163,6 +163,7 @@ mod = Mod register_unpickle_override('sage.rings.integer_mod', 'Mod', Mod) register_unpickle_override('sage.rings.integer_mod', 'mod', mod) + def IntegerMod(parent, value): """ Create an integer modulo `n` with the given parent. @@ -3462,7 +3463,6 @@ cdef class IntegerMod_int64(IntegerMod_abstract): """ return self._new_c((self.ivalue * (right).ivalue) % self._modulus.int64) - cpdef _div_(self, right): """ EXAMPLES:: @@ -3995,6 +3995,7 @@ def square_root_mod_prime_power(IntegerMod_abstract a, p, e): x *= p**(val//2) return x + cpdef square_root_mod_prime(IntegerMod_abstract a, p=None): r""" Calculates the square root of `a`, where `a` is an diff --git a/src/sage/rings/finite_rings/residue_field.pyx b/src/sage/rings/finite_rings/residue_field.pyx index e4e617a33eb..5e9d74844e3 100644 --- a/src/sage/rings/finite_rings/residue_field.pyx +++ b/src/sage/rings/finite_rings/residue_field.pyx @@ -919,6 +919,7 @@ class ResidueField_generic(Field): """ return 1 + hash(self.ideal()) + cdef class ReductionMap(Map): """ A reduction map from a (subset) of a number field or function field to @@ -1685,6 +1686,7 @@ cdef class LiftingMap(Section): """ return "Lifting" + class ResidueFiniteField_prime_modn(ResidueField_generic, FiniteField_prime_modn): """ The class representing residue fields of number fields that have diff --git a/src/sage/rings/function_field/element.pyx b/src/sage/rings/function_field/element.pyx index 2765b805aba..4c4719f0f31 100644 --- a/src/sage/rings/function_field/element.pyx +++ b/src/sage/rings/function_field/element.pyx @@ -86,6 +86,7 @@ def is_FunctionFieldElement(x): from sage.rings.function_field.function_field import is_FunctionField return is_FunctionField(x.parent()) + def make_FunctionFieldElement(parent, element_class, representing_element): """ Used for unpickling FunctionFieldElement objects (and subclasses). diff --git a/src/sage/rings/function_field/hermite_form_polynomial.pyx b/src/sage/rings/function_field/hermite_form_polynomial.pyx index 12881615315..2aa4516000c 100644 --- a/src/sage/rings/function_field/hermite_form_polynomial.pyx +++ b/src/sage/rings/function_field/hermite_form_polynomial.pyx @@ -49,13 +49,14 @@ AUTHORS: # Distributed under the terms of the GNU General Public License (GPL) # as published by the Free Software Foundation; either version 2 of # the License, or (at your option) any later version. -# http://www.gnu.org/licenses/ +# https://www.gnu.org/licenses/ # **************************************************************************** from sage.matrix.matrix cimport Matrix from sage.rings.polynomial.polynomial_element cimport Polynomial from sage.matrix.constructor import identity_matrix + def reversed_hermite_form(Matrix mat, bint transformation=False): """ Transform the matrix in place to reversed hermite normal form and diff --git a/src/sage/rings/integer_ring.pyx b/src/sage/rings/integer_ring.pyx index d0fb7ac3bc5..4c384622ff9 100644 --- a/src/sage/rings/integer_ring.pyx +++ b/src/sage/rings/integer_ring.pyx @@ -87,6 +87,7 @@ cdef int number_of_integer_rings = 0 # sigma, we do not recreate the sampler but take it from this "cache". _prev_discrete_gaussian_integer_sampler = (None, None) + def is_IntegerRing(x): r""" Internal function: return ``True`` iff ``x`` is the ring `\ZZ` of integers. @@ -105,6 +106,7 @@ def is_IntegerRing(x): """ return isinstance(x, IntegerRing_class) + cdef class IntegerRing_class(CommutativeRing): r""" The ring of integers. @@ -1406,7 +1408,6 @@ cdef class IntegerRing_class(CommutativeRing): g = g.gcd(R( {e[j] - e[i_min]: c[j] for j in range(i_min, k)} )) - cdef list cc cdef list ee cdef int m1, m2 @@ -1609,6 +1610,7 @@ cdef class IntegerRing_class(CommutativeRing): ZZ = IntegerRing_class() Z = ZZ + def IntegerRing(): """ Return the integer ring. @@ -1622,6 +1624,7 @@ def IntegerRing(): """ return ZZ + def crt_basis(X, xgcd=None): r""" Compute and return a Chinese Remainder Theorem basis for the list ``X`` 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 f48df864b74..54d8c9cc329 100644 --- a/src/sage/rings/number_field/number_field_element_quadratic.pyx +++ b/src/sage/rings/number_field/number_field_element_quadratic.pyx @@ -79,6 +79,7 @@ def __make_NumberFieldElement_quadratic0(parent, a, b, denom): """ return NumberFieldElement_quadratic(parent, (a, b, denom)) + def __make_NumberFieldElement_quadratic1(parent, cls, a, b, denom): """ Used in unpickling elements of number fields. @@ -410,13 +411,11 @@ cdef class NumberFieldElement_quadratic(NumberFieldElement_absolute): mpz_init(self.b) mpz_init(self.denom) - def __dealloc__(self): mpz_clear(self.a) mpz_clear(self.b) mpz_clear(self.denom) - def __reduce__(self): """ Used for pickling. @@ -472,7 +471,6 @@ cdef class NumberFieldElement_quadratic(NumberFieldElement_absolute): self._reduce_c_() return 0 # No error - def _lift_cyclotomic_element(self, new_parent, bint check=True, int rel=0): """ Creates an element of the passed field from this field. This @@ -1317,7 +1315,6 @@ cdef class NumberFieldElement_quadratic(NumberFieldElement_absolute): mpz_neg(self.b, self.b) mpz_clear(gcd) - cpdef _add_(self, other_m): """ EXAMPLES:: @@ -1375,7 +1372,6 @@ cdef class NumberFieldElement_quadratic(NumberFieldElement_absolute): res._reduce_c_() return res - cpdef _sub_(self, other_m): """ EXAMPLES:: @@ -1423,7 +1419,6 @@ cdef class NumberFieldElement_quadratic(NumberFieldElement_absolute): res._reduce_c_() return res - def __neg__(self): """ EXAMPLES:: diff --git a/src/sage/rings/number_field/number_field_morphisms.pyx b/src/sage/rings/number_field/number_field_morphisms.pyx index e61b63117f1..9ef71586355 100644 --- a/src/sage/rings/number_field/number_field_morphisms.pyx +++ b/src/sage/rings/number_field/number_field_morphisms.pyx @@ -444,6 +444,7 @@ cpdef closest(target, values, margin=1): else: return None + def root_from_approx(f, a): """ Return an exact root of the polynomial `f` closest to `a`. @@ -505,6 +506,7 @@ def root_from_approx(f, a): raise ValueError("{} is not a root of {}".format(a, f)) return a + def create_embedding_from_approx(K, gen_image): """ Return an embedding of ``K`` determined by ``gen_image``. diff --git a/src/sage/rings/number_field/totallyreal.pyx b/src/sage/rings/number_field/totallyreal.pyx index f50de987968..624e04c1641 100644 --- a/src/sage/rings/number_field/totallyreal.pyx +++ b/src/sage/rings/number_field/totallyreal.pyx @@ -466,6 +466,7 @@ def enumerate_totallyreal_fields_prim(n, B, a = [], verbose=0, return_seqs=False return [[ZZ(s[0]), Px([QQ(x) for x in s[1].list()])] for s in S] + def weed_fields(S, Py_ssize_t lenS=0): r""" Function used internally by the :func:`~enumerate_totallyreal_fields_prim` diff --git a/src/sage/rings/number_field/totallyreal_data.pyx b/src/sage/rings/number_field/totallyreal_data.pyx index 32efb720668..e02a3074cce 100644 --- a/src/sage/rings/number_field/totallyreal_data.pyx +++ b/src/sage/rings/number_field/totallyreal_data.pyx @@ -109,6 +109,7 @@ def hermite_constant(n): return gamma + cdef double eval_seq_as_poly(int *f, int n, double x) noexcept: r""" Evaluates the sequence a, thought of as a polynomial with @@ -291,11 +292,10 @@ cpdef lagrange_degree_3(int n, int an1, int an2, int an3): 3*nrsq*s1sq*s2sq - 3*nr*s1fo*s2 + \ s1sq*s1fo - fcoeff = [ int(coeffs[i]) for i in range(7) ] f = ZZx(fcoeff) df = ZZx([i*coeffs[i] for i in range(1,7)]) - f = f//gcd(f,df) + f = f//gcd(f, df) fcoeff = [int(c) for c in f.list()] rts = RRx(fcoeff).roots() @@ -315,6 +315,7 @@ primessq_py = [4, 9, 25, 49, 121, 169, 289, 361, 529, 841, 961, 1369, 1681, 1849 for i from 0 <= i < 46: primessq[i] = primessq_py[i] + def int_has_small_square_divisor(sage.rings.integer.Integer d): r""" Return the largest `a` such that `a^2` divides `d` and `a` has prime divisors `< 200`. @@ -343,6 +344,7 @@ def int_has_small_square_divisor(sage.rings.integer.Integer d): return asq + cdef int eval_seq_as_poly_int(int *f, int n, int x) noexcept: r""" Evaluates the sequence a, thought of as a polynomial with @@ -406,6 +408,7 @@ cdef int easy_is_irreducible(int *a, int n) noexcept: return 1 + def easy_is_irreducible_py(f): """ Used solely for testing easy_is_irreducible. @@ -424,7 +427,6 @@ def easy_is_irreducible_py(f): return easy_is_irreducible(a, len(f)-1) - #**************************************************************************** # Main class and routine #**************************************************************************** @@ -512,7 +514,6 @@ cdef class tr_data: self.beta[i] = 0 self.gnk[i] = 0 - # Initialize variables. if a == []: # No starting input, all polynomials will be found; initialize to zero. @@ -841,7 +842,6 @@ cdef class tr_data: if tmp_dbl > akmin: akmin = tmp_dbl - akmax = -eval_seq_as_poly(gnkm, n-k, betak[nk]) \ +fabs(eval_seq_as_poly(gnkm1, n-(k+1), betak[nk]))*eps_global for i from 1 <= i < nk/2+1: diff --git a/src/sage/rings/padics/padic_ZZ_pX_element.pyx b/src/sage/rings/padics/padic_ZZ_pX_element.pyx index b88bd5053bf..bf892956a16 100644 --- a/src/sage/rings/padics/padic_ZZ_pX_element.pyx +++ b/src/sage/rings/padics/padic_ZZ_pX_element.pyx @@ -738,6 +738,7 @@ def _find_val_aprec_test(R, L): """ return find_val_aprec(R.prime_pow, L) + cdef find_val_aprec(PowComputer_ext pp, L): r""" Given a list ``L``, finds the minimum valuation, minimum absolute @@ -843,6 +844,7 @@ def _test_get_val_prec(R, a): """ return get_val_prec(R.prime_pow, a) + cdef get_val_prec(PowComputer_ext pp, a): r""" Return valuation, absolute precision and type of an input element. diff --git a/src/sage/rings/padics/padic_generic_element.pyx b/src/sage/rings/padics/padic_generic_element.pyx index f7a7ab19ceb..145371c28c9 100644 --- a/src/sage/rings/padics/padic_generic_element.pyx +++ b/src/sage/rings/padics/padic_generic_element.pyx @@ -4515,6 +4515,7 @@ def _compute_g(p, n, prec, terms): g[i+1] = -(g[i]/(v-v**2)).integral() return [x.truncate(terms) for x in g] + cpdef dwork_mahler_coeffs(R, int bd=20): r""" Compute Dwork's formula for Mahler coefficients of `p`-adic Gamma. diff --git a/src/sage/rings/padics/padic_printing.pyx b/src/sage/rings/padics/padic_printing.pyx index fc9f15b07b1..f134c5afc45 100644 --- a/src/sage/rings/padics/padic_printing.pyx +++ b/src/sage/rings/padics/padic_printing.pyx @@ -294,6 +294,7 @@ class pAdicPrinterDefaults(SageObject): else: self._alphabet = tuple(alphabet) + _printer_defaults = pAdicPrinterDefaults() diff --git a/src/sage/rings/padics/pow_computer_ext.pyx b/src/sage/rings/padics/pow_computer_ext.pyx index 89a073550f5..8ce4953fadf 100644 --- a/src/sage/rings/padics/pow_computer_ext.pyx +++ b/src/sage/rings/padics/pow_computer_ext.pyx @@ -298,6 +298,7 @@ def ZZ_pX_eis_shift_test(_shifter, _a, _n, _finalprec): ZZ_pX_eis_shift_p(shifter, &x.x, &a.x, n, finalprec) return x + cdef int ZZ_pX_eis_shift_p(PowComputer_ZZ_pX self, ZZ_pX_c* x, ZZ_pX_c* a, long n, long finalprec) except -1: """ Eis-shifts a over by n and puts the result into x. diff --git a/src/sage/rings/polynomial/multi_polynomial.pyx b/src/sage/rings/polynomial/multi_polynomial.pyx index 6a30e521302..2f4a33dc358 100644 --- a/src/sage/rings/polynomial/multi_polynomial.pyx +++ b/src/sage/rings/polynomial/multi_polynomial.pyx @@ -20,12 +20,14 @@ from itertools import chain from sage.misc.misc_c import prod + def is_MPolynomial(x): from sage.misc.superseded import deprecation deprecation(32709, "the function is_MPolynomial is deprecated; use isinstance(x, sage.rings.polynomial.multi_polynomial.MPolynomial) instead") return isinstance(x, MPolynomial) + from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing from sage.categories.map cimport Map from sage.rings.rational_field import QQ diff --git a/src/sage/rings/polynomial/polynomial_modn_dense_ntl.pyx b/src/sage/rings/polynomial/polynomial_modn_dense_ntl.pyx index 04bef814741..29c75a19d30 100644 --- a/src/sage/rings/polynomial/polynomial_modn_dense_ntl.pyx +++ b/src/sage/rings/polynomial/polynomial_modn_dense_ntl.pyx @@ -55,9 +55,11 @@ from sage.libs.ntl.lzz_p cimport * from sage.libs.ntl.lzz_pX cimport * from sage.libs.ntl.ZZ_pX cimport * + def make_element(parent, args): return parent(*args) + zz_p_max = NTL_SP_BOUND cdef class Polynomial_dense_mod_n(Polynomial): @@ -126,7 +128,6 @@ cdef class Polynomial_dense_mod_n(Polynomial): R = parent.base_ring() x = _dict_to_list(x, R(0)) - elif isinstance(x, ZZX): self._poly = x.copy() return @@ -288,7 +289,6 @@ cdef class Polynomial_dense_mod_n(Polynomial): q, _ = self.quo_rem(right) return q - def degree(self, gen=None): """ Return the degree of this polynomial. @@ -425,6 +425,7 @@ cdef class Polynomial_dense_mod_n(Polynomial): """ return small_roots(self, *args, **kwds) + def small_roots(self, X=None, beta=1.0, epsilon=None, **kwds): r""" Let `N` be the characteristic of the base ring this polynomial @@ -623,6 +624,7 @@ def small_roots(self, X=None, beta=1.0, epsilon=None, **kwds): Nbeta = N**beta return [root for root in roots if N.gcd(ZZ(self(root))) >= Nbeta] + cdef class Polynomial_dense_modn_ntl_zz(Polynomial_dense_mod_n): r""" Polynomial on `\ZZ/n\ZZ` implemented via NTL. @@ -1233,7 +1235,6 @@ cdef class Polynomial_dense_modn_ntl_zz(Polynomial_dense_mod_n): return self._parent(int(fx)) - cdef class Polynomial_dense_modn_ntl_ZZ(Polynomial_dense_mod_n): def __init__(self, parent, v=None, check=True, is_gen=False, construct=False): @@ -1260,7 +1261,6 @@ cdef class Polynomial_dense_modn_ntl_ZZ(Polynomial_dense_mod_n): y._parent = self._parent return y - cpdef list list(self, bint copy=True): return [self.get_unsafe(n) for n from 0 <= n <= self.degree()] @@ -1596,7 +1596,6 @@ cdef class Polynomial_dense_modn_ntl_ZZ(Polynomial_dense_mod_n): ZZ_pX_RightShift(r.x, self.x, n) return r - def _derivative(self, var=None): r""" Return the formal derivative of ``self`` with respect to ``var``. @@ -1636,7 +1635,6 @@ cdef class Polynomial_dense_modn_ntl_ZZ(Polynomial_dense_mod_n): ZZ_pX_diff(r.x, self.x) return r - def reverse(self, degree=None): """ Return the reverse of the input polynomial thought as a polynomial of diff --git a/src/sage/rings/power_series_poly.pyx b/src/sage/rings/power_series_poly.pyx index 27b1c93f7ea..cb0b0fcad1e 100644 --- a/src/sage/rings/power_series_poly.pyx +++ b/src/sage/rings/power_series_poly.pyx @@ -864,7 +864,6 @@ cdef class PowerSeries_poly(PowerSeries): except AttributeError: raise ValueError('cannot differentiate with respect to {}'.format(var)) - # compute formal derivative with respect to generator return PowerSeries_poly(self._parent, self.__f._derivative(), self.prec()-1, check=False) @@ -1246,6 +1245,7 @@ def make_powerseries_poly_v0(parent, f, prec, is_gen): """ return PowerSeries_poly(parent, f, prec, 0, is_gen) + cdef class BaseRingFloorDivAction(Action): """ The floor division action of the base ring on a formal power series. diff --git a/src/sage/rings/real_arb.pyx b/src/sage/rings/real_arb.pyx index 971e9fc13bf..73232348a01 100644 --- a/src/sage/rings/real_arb.pyx +++ b/src/sage/rings/real_arb.pyx @@ -1148,6 +1148,7 @@ class RealBallField(UniqueRepresentation, sage.rings.abc.RealBallField): """ return ARF_PREC_EXACT + cdef inline bint _do_sig(long prec) noexcept: """ Whether signal handlers should be installed for calls to FLINT. @@ -1162,6 +1163,7 @@ cdef inline bint _do_sig(long prec) noexcept: cdef inline long prec(RealBall ball) noexcept: return ball._parent._prec + def create_RealBall(parent, serialized): r""" Create a RealBall from a serialized representation. @@ -1186,6 +1188,7 @@ def create_RealBall(parent, serialized): else: return res + cdef class RealBall(RingElement): """ Hold one ``arb_t`` diff --git a/src/sage/rings/real_lazy.pyx b/src/sage/rings/real_lazy.pyx index 1ba394741fa..4b241818d84 100644 --- a/src/sage/rings/real_lazy.pyx +++ b/src/sage/rings/real_lazy.pyx @@ -354,6 +354,7 @@ class RealLazyField_class(LazyField): RLF = RealLazyField_class() + def RealLazyField(): """ Return the lazy real field. @@ -509,6 +510,7 @@ class ComplexLazyField_class(LazyField): CLF = ComplexLazyField_class() + def ComplexLazyField(): """ Returns the lazy complex field. @@ -523,7 +525,6 @@ def ComplexLazyField(): return CLF - cdef int get_new_prec(R, int depth) except -1: """ There are depth operations, so we want at least that many more digits of @@ -917,6 +918,7 @@ def make_element(parent, *args): """ return parent(*args) + cdef class LazyWrapper(LazyFieldElement): cpdef int depth(self) noexcept: diff --git a/src/sage/rings/semirings/tropical_semiring.pyx b/src/sage/rings/semirings/tropical_semiring.pyx index 2922298e286..aa3ea3da761 100644 --- a/src/sage/rings/semirings/tropical_semiring.pyx +++ b/src/sage/rings/semirings/tropical_semiring.pyx @@ -418,6 +418,7 @@ cdef class TropicalSemiringElement(Element): return infinity return self._val + class TropicalSemiring(Parent, UniqueRepresentation): r""" The tropical semiring. @@ -651,6 +652,7 @@ class TropicalSemiring(Parent, UniqueRepresentation): """ return (self.element_class(self, self.base().one()), self.infinity()) + cdef class TropicalToTropical(Map): """ Map from the tropical semiring to itself (possibly with different bases).