Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
Merge branch 'general-extensions' of gitlab.com:sagemath/dev/sage int…
Browse files Browse the repository at this point in the history
…o general-extensions
  • Loading branch information
xcaruso committed Feb 23, 2022
2 parents 8ef666b + 538345b commit b6d60a0
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 6 deletions.
5 changes: 4 additions & 1 deletion src/sage/rings/padics/padic_extension_generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -406,15 +406,17 @@ def exact_field(self):
:meth:`defining_polynomial`
:meth:`modulus`
"""
# TODO: see Merge Request 32 - exact_field)
Kex = self.base_ring().exact_field().extension(self.defining_polynomial(exact=True), self.variable_name(), check=False)
# TODO: (see Merge Request 32 - coercions)
# Register conversions to/from the Globalization of the fraction field.
pAdicMap_Recursive(self, Kex).register_as_conversion()
section = pAdicMap_Recursive(Kex, self)
if self in Fields():
section.register_as_coercion()
else:
section.register_as_conversion()
# TODO: How can we provide an exact_ring() when the defining polynomial is not integral?
# TODO: (see Merge Request 32 - non-integral)
# # Register conversions to/from the Globalization of the ring of integers.
# pAdicMap_Recursive(self, self.exact_ring()).register_as_conversion()
# pAdicMap_Recursive(self.exact_ring(), self).register_as_coercion()
Expand Down Expand Up @@ -555,6 +557,7 @@ def construction(self, forbid_frac_field=False):
sage: c(R) is K
True
"""
# TODO: (see Merge Request 32 - construction)
from sage.categories.pushout import AlgebraicExtensionFunctor, FractionField
if not forbid_frac_field and self.is_field():
return (FractionField(), self.integer_ring())
Expand Down
7 changes: 4 additions & 3 deletions src/sage/rings/padics/padic_general_extension.py
Original file line number Diff line number Diff line change
Expand Up @@ -926,7 +926,7 @@ def exact_ring(self):

@cached_method
def fraction_field(self):
# TODO: Is this the default implementation anyway?
# TODO: (see Merge Request 32 - integer_ring)
return self.construction()[0](self.base_ring().fraction_field())


Expand All @@ -937,7 +937,7 @@ def __init__(self, exact_modulus, approx_modulus, prec, print_mode, shift_seed,

pAdicGeneralExtension.__init__(self, exact_modulus=exact_modulus, approx_modulus=approx_modulus, prec=prec, print_mode=print_mode, shift_seed=shift_seed, names=names, element_class=pAdicGeneralFieldExtensionElement, category=category)

# TODO: We are currently ignoring implementation.
# TODO: (see Merge Request 32 - implementation)
defining_morphism, gen = self._create_backend()

self._backend = gen.parent()
Expand Down Expand Up @@ -966,7 +966,7 @@ def is_field(self, *args, **kwds):

@cached_method
def integer_ring(self):
# TODO: Is this the default implementation anyway?
# TODO: (see Merge Request 32 - integer_ring)
return self.construction()[0](self.base_ring().integer_ring())

def fraction_field(self):
Expand Down Expand Up @@ -1304,6 +1304,7 @@ def _create_backend(self):
Return a backend for this extension, i.e.,
a `p`-adic ring that is not a general extension itself.
"""
# TODO: (see Merge Request 32 - backend)
try:
return self._create_backend_padic()
except PrecisionError:
Expand Down
3 changes: 3 additions & 0 deletions src/sage/rings/padics/padic_generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -662,7 +662,10 @@ def extension(self, modulus, prec = None, names = None, print_mode = None, imple
else:
print_mode[option] = self._printer.dict()[option]
extension = ExtensionFactory(base=self, modulus=modulus, prec=prec, names=names, check = True, implementation=implementation, **print_mode)

# TODO (see Merge Request 32 - extension)
#assert extension.defining_polynomial()(extension.gen()) == 0

return extension

def absolute_ring(self, map=False):
Expand Down
3 changes: 2 additions & 1 deletion src/sage/structure/coerce.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ cdef class CoercionModel:
cdef readonly TripleDict _action_maps

cpdef canonical_coercion(self, x, y)
cpdef bin_op(self, x, y, op)
# TODO: (see Merge Request 32 - segfault)
# cpdef bin_op(self, x, y, op)
cpdef richcmp(self, x, y, int op)

cpdef coercion_maps(self, R, S)
Expand Down
2 changes: 1 addition & 1 deletion src/sage/structure/coerce.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -1101,7 +1101,7 @@ cdef class CoercionModel:
self._division_parents.set(P, None, None, ret)
return ret

cpdef bin_op(self, x, y, op):
def bin_op(self, x, y, op):
"""
Execute the operation op on x and y. It first looks for an action
corresponding to op, and failing that, it tries to coerces x and y
Expand Down

0 comments on commit b6d60a0

Please sign in to comment.