summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXavier Caruso <xavier.caruso@univ-rennes1.fr>2018-03-06 01:13:40 +0100
committerJulian Rüth <julian.rueth@fsfe.org>2018-03-06 01:13:40 +0100
commitb2b82e87e40f69b4f211598e82f6de2f647df9d7 (patch)
treeb80552b78f0e68826f7dfe020dd30e7ed8862d01
parentUpdated SageMath version to 8.2.beta7 (diff)
Lattice precision for p-adicsu/saraedum/lattice_precision
In several recent papers, David Roe, Tristan Vaccon, and Xavier Caruso explain that lattices allow a sharp track of precision. This approach is implemented here in a first experimental version. Co-authored-by: David Roe <roed.math@gmail.com> Co-authored-by: Julian Rüth <julian.rueth@fsfe.org>
-rw-r--r--src/doc/en/reference/references/index.rst7
-rw-r--r--src/sage/categories/pushout.py7
-rw-r--r--src/sage/rings/padics/all.py4
-rw-r--r--src/sage/rings/padics/factory.py651
-rw-r--r--src/sage/rings/padics/generic_nodes.py465
-rw-r--r--src/sage/rings/padics/lattice_precision.py2835
-rw-r--r--src/sage/rings/padics/local_generic.py79
-rw-r--r--src/sage/rings/padics/local_generic_element.pyx6
-rw-r--r--src/sage/rings/padics/misc.py4
-rw-r--r--src/sage/rings/padics/padic_base_generic.py40
-rw-r--r--src/sage/rings/padics/padic_base_leaves.py274
-rw-r--r--src/sage/rings/padics/padic_generic.py50
-rw-r--r--src/sage/rings/padics/padic_lattice_element.py1311
-rw-r--r--src/sage/rings/padics/padic_printing.pyx7
14 files changed, 5581 insertions, 159 deletions
diff --git a/src/doc/en/reference/references/index.rst b/src/doc/en/reference/references/index.rst
index 1cf229a..52190cf 100644
--- a/src/doc/en/reference/references/index.rst
+++ b/src/doc/en/reference/references/index.rst
@@ -673,6 +673,13 @@ REFERENCES:
.. [Crossproduct] Algebraic Properties of the Cross Product
:wikipedia:`Cross_product`
+.. [CRV2018] Xavier Caruso, David Roe and Tristan Vaccon.
+ *ZpL: a p-adic precision package*, (2018) :arxiv:`1802.08532`.
+
+.. [CRV2014] Xavier Caruso, David Roe and Tristan Vaccon.
+ *Tracking p-adic precision*,
+ LMS J. Comput. Math. **17** (2014), 274-294.
+
.. [CS1986] \J. Conway and N. Sloane. *Lexicographic codes:
error-correcting codes from game theory*, IEEE
Trans. Infor. Theory **32** (1986) 337-348.
diff --git a/src/sage/categories/pushout.py b/src/sage/categories/pushout.py
index 602117f..bccd0b5 100644
--- a/src/sage/categories/pushout.py
+++ b/src/sage/categories/pushout.py
@@ -2318,7 +2318,7 @@ class CompletionFunctor(ConstructionFunctor):
"""
rank = 4
_real_types = ['Interval', 'Ball', 'MPFR', 'RDF', 'RLF', 'RR']
- _dvr_types = [None, 'fixed-mod','floating-point','capped-abs','capped-rel','lazy']
+ _dvr_types = [None, 'fixed-mod', 'floating-point', 'capped-abs', 'capped-rel', 'lattice-cap', 'lattice-float']
def __init__(self, p, prec, extras=None):
"""
@@ -2329,14 +2329,15 @@ class CompletionFunctor(ConstructionFunctor):
- ``prec``: an integer, yielding the precision in bits. Note that
if ``p`` is prime then the ``prec`` is the *capped* precision,
while it is the *set* precision if ``p`` is ``+Infinity``.
+ In the ``lattice-cap`` precision case, ``prec`` will be a tuple instead.
- ``extras`` (optional dictionary): Information on how to print elements, etc.
If 'type' is given as a key, the corresponding value should be a string among the following:
- 'RDF', 'Interval', 'RLF', or 'RR' for completions at infinity
- - 'capped-rel', 'capped-abs', 'fixed-mod' or 'lazy' for completions at a finite place
- or ideal of a DVR.
+ - 'capped-rel', 'capped-abs', 'fixed-mod', 'lattice-cap' or 'lattice-float'
+ for completions at a finite place or ideal of a DVR.
TESTS::
diff --git a/src/sage/rings/padics/all.py b/src/sage/rings/padics/all.py
index 3e361a9..0c6d31d 100644
--- a/src/sage/rings/padics/all.py
+++ b/src/sage/rings/padics/all.py
@@ -1,7 +1,7 @@
from __future__ import absolute_import
from .generic_nodes import is_pAdicField, is_pAdicRing
-from .factory import Zp, Zq, Zp as pAdicRing, ZpCR, ZpCA, ZpFM, ZpFP, ZqCR, ZqCA, ZqFM, ZqFP #, ZpL, ZqL
-from .factory import Qp, Qq, Qp as pAdicField, QpCR, QpFP, QqCR, QqFP #, QpL, QqL
+from .factory import Zp, Zq, Zp as pAdicRing, ZpCR, ZpCA, ZpFM, ZpFP, ZpLC, ZpLF, ZqCR, ZqCA, ZqFM, ZqFP #, ZpL, ZqL
+from .factory import Qp, Qq, Qp as pAdicField, QpCR, QpFP, QpLC, QpLF, QqCR, QqFP #, QpL, QqL
from .factory import pAdicExtension
from .padic_generic import local_print_mode
from .pow_computer import PowComputer
diff --git a/src/sage/rings/padics/factory.py b/src/sage/rings/padics/factory.py
index 291172c..d3916b7 100644
--- a/src/sage/rings/padics/factory.py
+++ b/src/sage/rings/padics/factory.py
@@ -1,4 +1,4 @@
-"""
+r"""
Factory
This file contains the constructor classes and functions for `p`-adic rings and fields.
@@ -6,6 +6,15 @@ This file contains the constructor classes and functions for `p`-adic rings and
AUTHORS:
- David Roe
+
+TESTS::
+
+ sage: R = ZpLC(2)
+ doctest:...: FutureWarning: This class/method/function is marked as experimental. It, its functionality or its interface might change without a formal deprecation.
+ See http://trac.sagemath.org/23505 for details.
+ sage: R = ZpLF(2)
+ sage: R = QpLC(2)
+ sage: R = QpLF(2)
"""
#*****************************************************************************
@@ -20,8 +29,11 @@ AUTHORS:
#*****************************************************************************
from __future__ import absolute_import, print_function
+from sage.misc.superseded import experimental
+
from sage.structure.factory import UniqueFactory
from sage.rings.integer import Integer
+from sage.rings.infinity import Infinity
from sage.structure.factorization import Factorization
from sage.rings.integer_ring import ZZ
from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing
@@ -31,8 +43,10 @@ from .padic_base_leaves import (pAdicRingCappedRelative,
pAdicRingCappedAbsolute,
pAdicRingFixedMod,
pAdicRingFloatingPoint,
+ pAdicRingLattice,
pAdicFieldCappedRelative,
- pAdicFieldFloatingPoint)
+ pAdicFieldFloatingPoint,
+ pAdicFieldLattice)
from . import padic_printing
######################################################
@@ -47,35 +61,30 @@ from functools import reduce
ext_table = {}
ext_table['e', pAdicFieldCappedRelative] = EisensteinExtensionFieldCappedRelative
-#ext_table['e', pAdicFieldLazy] = EisensteinExtensionFieldLazy
ext_table['e', pAdicRingCappedAbsolute] = EisensteinExtensionRingCappedAbsolute
ext_table['e', pAdicRingCappedRelative] = EisensteinExtensionRingCappedRelative
ext_table['e', pAdicRingFixedMod] = EisensteinExtensionRingFixedMod
#ext_table['e', pAdicRingFloatingPoint] = EisensteinExtensionRingFloatingPoint
#ext_table['e', pAdicFieldFloatingPoint] = EisensteinExtensionFieldFloatingPoint
-#ext_table['e', pAdicRingLazy] = EisensteinExtensionRingLazy
#ext_table['p', pAdicFieldCappedRelative] = pAdicGeneralExtensionFieldCappedRelative
-#ext_table['p', pAdicFieldLazy] = pAdicGeneralExtensionFieldLazy
#ext_table['p', pAdicRingCappedAbsolute] = pAdicGeneralExtensionRingCappedAbsolute
#ext_table['p', pAdicRingCappedRelative] = pAdicGeneralExtensionRingCappedRelative
#ext_table['p', pAdicRingFixedMod] = pAdicGeneralExtensionRingFixedMod
-#ext_table['p', pAdicRingLazy] = pAdicGeneralExtensionRingLazy
ext_table['u', pAdicFieldCappedRelative] = UnramifiedExtensionFieldCappedRelative
-#ext_table['u', pAdicFieldLazy] = UnramifiedExtensionFieldLazy
ext_table['u', pAdicRingCappedAbsolute] = UnramifiedExtensionRingCappedAbsolute
ext_table['u', pAdicRingCappedRelative] = UnramifiedExtensionRingCappedRelative
ext_table['u', pAdicRingFixedMod] = UnramifiedExtensionRingFixedMod
ext_table['u', pAdicRingFloatingPoint] = UnramifiedExtensionRingFloatingPoint
ext_table['u', pAdicFieldFloatingPoint] = UnramifiedExtensionFieldFloatingPoint
-#ext_table['u', pAdicRingLazy] = UnramifiedExtensionRingLazy
def _default_show_prec(type, print_mode):
- """
+ r"""
Returns the default show_prec value for a given type and printing mode.
INPUT:
- - ``type`` -- a string: ``'capped-rel'``, ``'capped-abs'``, ``'fixed-mod'`` or ``'floating-point'``
+ - ``type`` -- a string: ``'capped-rel'``, ``'capped-abs'``, ``'fixed-mod'``, ``'floating-point'``,
+ ``'lattice-cap'`` or ``'lattice-float'``
- ``print_mode`` -- a string: ``'series'``, ``'terse'``, ``'val-unit'``, ``'digits'``, ``'bars'``
EXAMPLES::
@@ -95,8 +104,8 @@ def _default_show_prec(type, print_mode):
else:
return False
-def get_key_base(p, prec, type, print_mode, names, ram_name, print_pos, print_sep, print_alphabet, print_max_terms, show_prec, check, valid_non_lazy_types):
- """
+def get_key_base(p, prec, type, print_mode, names, ram_name, print_pos, print_sep, print_alphabet, print_max_terms, show_prec, check, valid_types, label=None):
+ r"""
This implements create_key for Zp and Qp: moving it here prevents code duplication.
It fills in unspecified values and checks for contradictions in the input. It also standardizes irrelevant options so that duplicate parents are not created.
@@ -105,19 +114,61 @@ def get_key_base(p, prec, type, print_mode, names, ram_name, print_pos, print_se
sage: from sage.rings.padics.factory import get_key_base
sage: get_key_base(11, 5, 'capped-rel', None, None, None, None, ':', None, None, False, True, ['capped-rel'])
- (11, 5, 'capped-rel', 'series', '11', True, '|', (), -1, False)
+ (11, 5, 'capped-rel', 'series', '11', True, '|', (), -1, False, None)
sage: get_key_base(12, 5, 'capped-rel', 'digits', None, None, None, None, None, None, True, False, ['capped-rel'])
- (12, 5, 'capped-rel', 'digits', '12', True, '|', ('0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B'), -1, True)
+ (12,
+ 5,
+ 'capped-rel',
+ 'digits',
+ '12',
+ True,
+ '|',
+ ('0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B'),
+ -1,
+ True,
+ None)
"""
- if prec is None:
- prec = DEFAULT_PREC
if check:
if not isinstance(p, Integer):
p = Integer(p)
- if not isinstance(prec, Integer):
- prec = Integer(prec)
if not p.is_prime():
raise ValueError("p must be prime")
+ if type == 'lattice-cap':
+ relative_cap = absolute_cap = None
+ if prec is not None:
+ try:
+ relative_cap, absolute_cap = prec
+ except (ValueError, TypeError):
+ relative_cap = prec
+ if relative_cap is not None:
+ if relative_cap is not Infinity:
+ try:
+ relative_cap = Intege