Skip to content

Commit

Permalink
sagemathgh-38137: some care for blank lines in pyx in rings
Browse files Browse the repository at this point in the history
some care for blank lines in pyx files in `rings` (only partial here)

### 📝 Checklist

- [x] The title is concise and informative.
- [x] The description explains in detail what this PR is about.

URL: sagemath#38137
Reported by: Frédéric Chapoton
Reviewer(s): Matthias Köppe
  • Loading branch information
Release Manager committed Jun 3, 2024
2 parents 552af2c + 8591081 commit ebe87d4
Show file tree
Hide file tree
Showing 29 changed files with 69 additions and 40 deletions.
4 changes: 2 additions & 2 deletions build/pkgs/configure/checksums.ini
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
tarball=configure-VERSION.tar.gz
sha1=022699b7eb21eccbc8f9d15fe354069f2cf125fc
sha256=1dc7bc34f697b658b026772bb2d3c10875c5fa3be96d2d58a4e1b794f4b6ac3d
sha1=9336ac1f8f45adde9e0f397a4ad4471703eddd47
sha256=2fc3095937c676d07394e84d7b10a89be5c037402e9b140ad38840353592ad34
2 changes: 1 addition & 1 deletion build/pkgs/configure/package-version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
973a7e3600d01aede4d21d94d1ff58e7d1631af1
ed59ca3c9bbeb41906aa7a98488f68d890cc1749
1 change: 1 addition & 0 deletions src/sage/rings/complex_arb.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
8 changes: 3 additions & 5 deletions src/sage/rings/complex_double.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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`.
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -2594,8 +2592,6 @@ cdef class ComplexToCDF(Morphism):
return "Native"




#####################################################
# unique objects
#####################################################
Expand All @@ -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.
Expand All @@ -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()})

Expand Down
7 changes: 7 additions & 0 deletions src/sage/rings/complex_mpc.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ AA = None
QQbar = None
CDF = CLF = RLF = None


def late_import():
"""
Import the objects/modules after build (when needed).
Expand All @@ -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',
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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`.
Expand All @@ -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`.
Expand All @@ -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

Expand Down
17 changes: 9 additions & 8 deletions src/sage/rings/complex_mpfr.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand All @@ -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.
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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``.
Expand Down Expand Up @@ -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``,
Expand Down Expand Up @@ -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``.
Expand Down Expand Up @@ -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``.
Expand Down Expand Up @@ -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`.
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down
2 changes: 2 additions & 0 deletions src/sage/rings/factorint.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions src/sage/rings/finite_rings/element_givaro.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
1 change: 1 addition & 0 deletions src/sage/rings/finite_rings/element_ntl_gf2e.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -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)
4 changes: 2 additions & 2 deletions src/sage/rings/finite_rings/finite_field_base.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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)

Expand Down
3 changes: 2 additions & 1 deletion src/sage/rings/finite_rings/integer_mod.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -3462,7 +3463,6 @@ cdef class IntegerMod_int64(IntegerMod_abstract):
"""
return self._new_c((self.ivalue * (<IntegerMod_int64>right).ivalue) % self._modulus.int64)


cpdef _div_(self, right):
"""
EXAMPLES::
Expand Down Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions src/sage/rings/finite_rings/residue_field.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions src/sage/rings/function_field/element.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand Down
3 changes: 2 additions & 1 deletion src/sage/rings/function_field/hermite_form_polynomial.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading

0 comments on commit ebe87d4

Please sign in to comment.