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

Commit

Permalink
Change the internal base ring for two-step extensions to not show pre…
Browse files Browse the repository at this point in the history
…cision when printing, fix bug in base ring coercion
  • Loading branch information
roed314 committed Nov 15, 2017
1 parent 635021a commit 67c1f14
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions src/sage/rings/padics/relative_extension_leaves.py
Expand Up @@ -31,7 +31,10 @@ def __init__(self, R, S):
Morphism.__init__(self, Hom(R, S, SetsWithPartialMaps()))

def _call_(self, x):
return self.codomain()([x])
if x.is_zero():
return self.codomain()(0,x.precision_absolute())
else:
return self.codomain()([x])

def _call_with_args(self, x, args=(), kwds={}):
return self.codomain()([x], *args, **kwds)
Expand All @@ -57,7 +60,7 @@ class RelativeRamifiedExtensionRingFixedMod(EisensteinExtensionGeneric, pAdicFix
def __init__(self, exact_modulus, approx_modulus, prec, print_mode, shift_seed, names, implementation):
self._exact_modulus = exact_modulus
unram_prec = (prec + approx_modulus.degree() - 1) // approx_modulus.degree()
KFP = approx_modulus.base_ring().change(field=False, type='floating-point')
KFP = approx_modulus.base_ring().change(field=False, show_prec=False, type='floating-point')
self.prime_pow = PowComputer_relative_maker(approx_modulus.base_ring().prime(), max(min(unram_prec - 1, 30), 1), unram_prec, prec, False, exact_modulus.change_ring(KFP), shift_seed.change_ring(KFP), 'fixed-mod')
self._implementation = 'Polynomial'
EisensteinExtensionGeneric.__init__(self, approx_modulus, prec, print_mode, names, RelativeRamifiedFixedModElement)
Expand All @@ -70,7 +73,7 @@ class RelativeRamifiedExtensionRingCappedAbsolute(EisensteinExtensionGeneric, pA
def __init__(self, exact_modulus, approx_modulus, prec, print_mode, shift_seed, names, implementation):
self._exact_modulus = exact_modulus
unram_prec = (prec + approx_modulus.degree() - 1) // approx_modulus.degree()
KFP = approx_modulus.base_ring().change(field=False, type='floating-point')
KFP = approx_modulus.base_ring().change(field=False, show_prec=False, type='floating-point')
self.prime_pow = PowComputer_relative_maker(approx_modulus.base_ring().prime(), max(min(unram_prec - 1, 30), 1), unram_prec, prec, False, exact_modulus.change_ring(KFP), shift_seed.change_ring(KFP), 'capped-abs')
self._implementation = 'Polynomial'
EisensteinExtensionGeneric.__init__(self, approx_modulus, prec, print_mode, names, RelativeRamifiedCappedAbsoluteElement)
Expand All @@ -83,7 +86,7 @@ class RelativeRamifiedExtensionRingCappedRelative(EisensteinExtensionGeneric, pA
def __init__(self, exact_modulus, approx_modulus, prec, print_mode, shift_seed, names, implementation):
self._exact_modulus = exact_modulus
unram_prec = (prec + approx_modulus.degree() - 1) // approx_modulus.degree()
KFP = approx_modulus.base_ring().change(field=False, type='floating-point')
KFP = approx_modulus.base_ring().change(field=False, show_prec=False, type='floating-point')
self.prime_pow = PowComputer_relative_maker(approx_modulus.base_ring().prime(), max(min(unram_prec - 1, 30), 1), unram_prec, prec, False, exact_modulus.change_ring(KFP), shift_seed.change_ring(KFP), 'capped-rel')
self._implementation = 'Polynomial'
EisensteinExtensionGeneric.__init__(self, approx_modulus, prec, print_mode, names, RelativeRamifiedCappedRelativeElement)
Expand All @@ -96,7 +99,7 @@ class RelativeRamifiedExtensionFieldCappedRelative(EisensteinExtensionGeneric, p
def __init__(self, exact_modulus, approx_modulus, prec, print_mode, shift_seed, names, implementation):
self._exact_modulus = exact_modulus
unram_prec = (prec + approx_modulus.degree() - 1) // approx_modulus.degree()
KFP = approx_modulus.base_ring().change(field=False, type='floating-point')
KFP = approx_modulus.base_ring().change(field=False, show_prec=False, type='floating-point')
self.prime_pow = PowComputer_relative_maker(approx_modulus.base_ring().prime(), max(min(unram_prec - 1, 30), 1), unram_prec, prec, False, exact_modulus.change_ring(KFP), shift_seed.change_ring(KFP), 'capped-rel')
self._implementation = 'Polynomial'
EisensteinExtensionGeneric.__init__(self, approx_modulus, prec, print_mode, names, RelativeRamifiedCappedRelativeElement)
Expand All @@ -109,7 +112,7 @@ class RelativeRamifiedExtensionRingFloatingPoint(EisensteinExtensionGeneric, pAd
def __init__(self, exact_modulus, approx_modulus, prec, print_mode, shift_seed, names, implementation):
self._exact_modulus = exact_modulus
unram_prec = (prec + approx_modulus.degree() - 1) // approx_modulus.degree()
KFP = approx_modulus.base_ring().change(field=False)
KFP = approx_modulus.base_ring().change(field=False, show_prec=False)
self.prime_pow = PowComputer_relative_maker(approx_modulus.base_ring().prime(), max(min(unram_prec - 1, 30), 1), unram_prec, prec, False, exact_modulus.change_ring(KFP), shift_seed.change_ring(KFP), 'capped-rel')
self._implementation = 'Polynomial'
EisensteinExtensionGeneric.__init__(self, approx_modulus, prec, print_mode, names, RelativeRamifiedFloatingPointElement)
Expand All @@ -122,7 +125,7 @@ class RelativeRamifiedExtensionFieldFloatingPoint(EisensteinExtensionGeneric, pA
def __init__(self, exact_modulus, approx_modulus, prec, print_mode, shift_seed, names, implementation):
self._exact_modulus = exact_modulus
unram_prec = (prec + approx_modulus.degree() - 1) // approx_modulus.degree()
KFP = approx_modulus.base_ring().change(field=False)
KFP = approx_modulus.base_ring().change(field=False, show_prec=False)
self.prime_pow = PowComputer_relative_maker(approx_modulus.base_ring().prime(), max(min(unram_prec - 1, 30), 1), unram_prec, prec, False, exact_modulus.change_ring(KFP), shift_seed.change_ring(KFP), 'capped-rel')
self._implementation = 'Polynomial'
EisensteinExtensionGeneric.__init__(self, approx_modulus, prec, print_mode, names, RelativeRamifiedFloatingPointElement)
Expand Down

0 comments on commit 67c1f14

Please sign in to comment.