Skip to content
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
16 changes: 14 additions & 2 deletions src/sage/rings/padics/generic_nodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -1423,13 +1423,19 @@ def construction(self, forbid_frac_field=False):
sage: S = F(Z)
sage: S._precision_cap()
(31, 41)

The `secure` attribute for relaxed type is included in the functor::

sage: R = ZpER(5, secure=True)
sage: R.construction()
(Completion[5, prec=(20, 40, True)], Integer Ring)
"""
from sage.categories.pushout import CompletionFunctor
extras = {'print_mode':self._printer.dict(), 'type':self._prec_type(), 'names':self._names}
if hasattr(self, '_label'):
extras['label'] = self._label
if self._prec_type() == "relaxed":
prec = (self._default_prec, self._halting_prec)
prec = (self._default_prec, self._halting_prec, self._secure)
else:
prec = self._precision_cap()
return (CompletionFunctor(self.prime(), prec, extras), ZZ)
Expand Down Expand Up @@ -1595,14 +1601,20 @@ def construction(self, forbid_frac_field=False):
sage: S = F(Z)
sage: S._precision_cap()
(31, 41)

The `secure` attribute for relaxed type is included in the functor::

sage: K = QpER(5, secure=True)
sage: K.construction(forbid_frac_field=True)
(Completion[5, prec=(20, 40, True)], Rational Field)
"""
from sage.categories.pushout import FractionField, CompletionFunctor
if forbid_frac_field:
extras = {'print_mode':self._printer.dict(), 'type':self._prec_type(), 'names':self._names}
if hasattr(self, '_label'):
extras['label'] = self._label
if self._prec_type() == "relaxed":
prec = (self._default_prec, self._halting_prec)
prec = (self._default_prec, self._halting_prec, self._secure)
else:
prec = self._precision_cap()
return (CompletionFunctor(self.prime(), prec, extras), QQ)
Expand Down
19 changes: 19 additions & 0 deletions src/sage/rings/padics/local_generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,25 @@ def change(self, **kwds):
37-adic Ring with lattice-cap precision (label: change)
sage: S.change(label = "new")
37-adic Ring with lattice-cap precision (label: new)


TESTS:

The `secure` attribute for relaxed type is copied::

sage: R = ZpER(5, secure=True); R
5-adic Ring handled with relaxed arithmetics
sage: K = R.change(field=True); K
5-adic Field handled with relaxed arithmetics
sage: K.is_secure()
True

The `check=False` option works for relaxed type::

sage: R = ZpER(5) ; R
5-adic Ring handled with relaxed arithmetics
sage: K = R.change(field=True, check=False) ; K
5-adic Field handled with relaxed arithmetics
"""
# We support both print_* and * for *=mode, pos, sep, alphabet
for atr in ('print_mode', 'print_pos', 'print_sep', 'print_alphabet'):
Expand Down
4 changes: 4 additions & 0 deletions src/sage/rings/padics/padic_base_leaves.py
Original file line number Diff line number Diff line change
Expand Up @@ -1128,6 +1128,8 @@ def __init__(self, p, prec, print_mode, names):

sage: R = ZpER(7)
sage: TestSuite(R).run(skip=['_test_log', '_test_matrix_smith'])
sage: R = ZpER(7, secure=True)
sage: TestSuite(R).run(skip=['_test_log', '_test_matrix_smith'])
"""
from sage.rings.padics import padic_relaxed_element
self._default_prec, self._halting_prec, self._secure = prec
Expand Down Expand Up @@ -1163,6 +1165,8 @@ def __init__(self, p, prec, print_mode, names):

sage: K = QpER(7)
sage: TestSuite(K).run(skip=['_test_log', '_test_matrix_smith'])
sage: K = QpER(7, secure=True)
sage: TestSuite(K).run(skip=['_test_log', '_test_matrix_smith'])
"""
from sage.rings.padics import padic_relaxed_element
self._default_prec, self._halting_prec, self._secure = prec
Expand Down
8 changes: 7 additions & 1 deletion src/sage/rings/padics/padic_generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -478,14 +478,20 @@ def integer_ring(self, print_mode=None):
2-adic Ring with lattice-cap precision (label: test)
sage: R.integer_ring({'mode':'series'}) is R
True

The `secure` attribute for relaxed type is preserved::

sage: K = QpER(5, secure=True)
sage: K.integer_ring().is_secure()
True
"""
# Currently does not support fields with non integral defining
# polynomials. This should change when the padic_general_extension
# framework gets worked out.
if not self.is_field() and print_mode is None:
return self
if print_mode is None:
return self.change(field=False)
return self.change(field=False, check=False)
else:
from sage.misc.superseded import deprecation
deprecation(23227, "Use the change method if you want to change print options in integer_ring()")
Expand Down