Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

get rid of some ParentWithGens in real and complex fields #36684

Merged
merged 1 commit into from
Dec 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/sage/rings/complex_double.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,10 @@ cdef extern from "<complex.h>":
import sage.rings.abc
cimport sage.rings.ring
cimport sage.rings.integer
from sage.rings.ring import Ring

from sage.structure.element cimport Element, FieldElement
from sage.structure.parent cimport Parent
from sage.structure.parent_gens import ParentWithGens
from sage.structure.richcmp cimport rich_to_bool
from sage.categories.morphism cimport Morphism
from sage.structure.coerce cimport is_numpy_type
Expand Down Expand Up @@ -149,7 +149,7 @@ cdef class ComplexDoubleField_class(sage.rings.abc.ComplexDoubleField):
(-1.0, -1.0 + 1.2246...e-16*I, False)
"""
from sage.categories.fields import Fields
ParentWithGens.__init__(self, self, ('I',), normalize=False, category=Fields().Infinite().Metric().Complete())
Ring.__init__(self, self, ('I',), normalize=False, category=Fields().Infinite().Metric().Complete())
self._populate_coercion_lists_()

def __reduce__(self):
Expand Down
4 changes: 2 additions & 2 deletions src/sage/rings/complex_mpc.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,11 @@ from sage.cpython.string cimport str_to_bytes
from sage.libs.mpfr cimport *
from sage.libs.mpc cimport *
from sage.structure.parent cimport Parent
from sage.structure.parent_gens cimport ParentWithGens
from sage.structure.element cimport Element
from sage.structure.richcmp cimport rich_to_bool
from sage.categories.map cimport Map
from sage.libs.pari.all import pari
from sage.rings.ring import Ring

from .integer cimport Integer
from .complex_mpfr cimport ComplexNumber
Expand Down Expand Up @@ -319,7 +319,7 @@ cdef class MPComplexField_class(sage.rings.ring.Field):
self.__real_field = real_mpfr.RealField(prec, rnd=_mpfr_rounding_modes[rnd_re(n)])
self.__imag_field = real_mpfr.RealField(prec, rnd=_mpfr_rounding_modes[rnd_im(n)])

ParentWithGens.__init__(self, self._real_field(), ('I',), False, category=Fields().Infinite())
Ring.__init__(self, self._real_field(), ('I',), False, category=Fields().Infinite())
self._populate_coercion_lists_(coerce_list=[MPFRtoMPC(self._real_field(), self)])

cdef MPComplexNumber _new(self) noexcept:
Expand Down
4 changes: 2 additions & 2 deletions src/sage/rings/complex_mpfr.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ from sage.structure.element cimport RingElement, Element
from sage.structure.richcmp cimport rich_to_bool
from sage.categories.map cimport Map
from sage.structure.parent import Parent
from sage.structure.parent_gens import ParentWithGens
from sage.rings.ring import Ring

from sage.misc.sage_eval import sage_eval

Expand Down Expand Up @@ -277,7 +277,7 @@ class ComplexField_class(sage.rings.abc.ComplexField):
"""
self._prec = int(prec)
from sage.categories.fields import Fields
ParentWithGens.__init__(self, self._real_field(), ('I',), False, category=Fields().Infinite().Metric().Complete())
Ring.__init__(self, self._real_field(), ('I',), False, category=Fields().Infinite().Metric().Complete())
self._populate_coercion_lists_(coerce_list=[RRtoCC(self._real_field(), self)],
convert_method_name='_complex_mpfr_')

Expand Down
16 changes: 8 additions & 8 deletions src/sage/rings/real_mpfr.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -107,15 +107,15 @@ Make sure we don't have a new field for every new literal::
True
"""

#*****************************************************************************
# *****************************************************************************
# Copyright (C) 2005-2006 William Stein <wstein@gmail.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
# https://www.gnu.org/licenses/
#*****************************************************************************
# *****************************************************************************

import math # for log
import sys
Expand Down Expand Up @@ -158,8 +158,8 @@ from .real_double cimport RealDoubleElement
import sage.rings.rational_field

import sage.rings.infinity
from sage.rings.ring import Ring

from sage.structure.parent_gens cimport ParentWithGens
from sage.arith.numerical_approx cimport digits_to_bits
from sage.arith.constants cimport M_LN2_LN10
from sage.arith.long cimport is_small_python_int
Expand All @@ -169,11 +169,11 @@ cimport gmpy2
gmpy2.import_gmpy2()


#*****************************************************************************
# ****************************************************************************
#
# Implementation
#
#*****************************************************************************
# ****************************************************************************

_re_skip_zeroes = re.compile(r'^(.+?)0*$')

Expand Down Expand Up @@ -356,11 +356,11 @@ def mpfr_get_exp_max_max():
mpfr_set_exp_min(mpfr_get_emin_min())
mpfr_set_exp_max(mpfr_get_emax_max())

#*****************************************************************************
# *****************************************************************************
#
# Real Field
#
#*****************************************************************************
# *****************************************************************************
# The real field is in Cython, so mpfr elements will have access to
# their parent via direct C calls, which will be faster.

Expand Down Expand Up @@ -534,7 +534,7 @@ cdef class RealField_class(sage.rings.abc.RealField):
self.rnd_str = char_to_str(rnd_str + 5) # Strip "MPFR_"

from sage.categories.fields import Fields
ParentWithGens.__init__(self, self, tuple(), False, category=Fields().Infinite().Metric().Complete())
Ring.__init__(self, self, tuple(), False, category=Fields().Infinite().Metric().Complete())

# Initialize zero and one
cdef RealNumber rn
Expand Down
Loading