summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXavier Caruso <xavier.caruso@univ-rennes1.fr>2018-02-06 17:44:51 +0100
committerXavier Caruso <xavier.caruso@univ-rennes1.fr>2018-02-06 17:44:51 +0100
commit9780da5204bad7c32b559f112a0fafd809890b5d (patch)
tree254ff7a284470c9ab6ab265fafb6e5327e42eaee
parentDoctest for the class pRational (diff)
-rw-r--r--src/sage/rings/padics/lattice_precision.py88
-rw-r--r--src/sage/rings/padics/padic_lattice_element.py30
2 files changed, 118 insertions, 0 deletions
diff --git a/src/sage/rings/padics/lattice_precision.py b/src/sage/rings/padics/lattice_precision.py
index 4a78480..5c69780 100644
--- a/src/sage/rings/padics/lattice_precision.py
+++ b/src/sage/rings/padics/lattice_precision.py
@@ -568,6 +568,34 @@ class DifferentialPrecisionGeneric(UniqueRepresentation, SageObject):
differentiation
"""
def __init__(self, p, type, label):
+ """
+ Initialize this precision module
+
+ INPUT:
+
+ - ``p`` -- a prime number
+
+ - ``type`` -- either ``lattice`` or ``module``
+
+ - ``label`` -- a string, the label of the parents to which belong
+ the elements tracked by this precision module
+
+ NOTE:
+
+ The precision module is automatically initialized at the
+ creation of the parent.
+
+ TESTS::
+
+ sage: R = ZpLC(2, label='init') # indirect doctest
+ sage: prec = R.precision()
+ sage: prec
+ Precision lattice on 0 object (label: init)
+ sage: prec._type
+ 'lattice'
+ sage: prec.label()
+ 'init'
+ """
self._p = p
self._label = label
self._type = type
@@ -704,6 +732,8 @@ class DifferentialPrecisionGeneric(UniqueRepresentation, SageObject):
def _index(self, ref):
"""
Return the index of the element whose reference is ``ref``
+
+ Only for internal use!
"""
return self._elements.index(ref)
@@ -1305,6 +1335,34 @@ class PrecisionLattice(DifferentialPrecisionGeneric):
rows are generators of the lattice.
"""
def __init__(self, p, label):
+ """
+ Initialize this precision module
+
+ INPUT:
+
+ - ``p`` -- a prime number
+
+ - ``type`` -- either ``lattice`` or ``module``
+
+ - ``label`` -- a string, the label of the parents to which belong
+ the elements tracked by this precision module
+
+ NOTE:
+
+ The precision module is automatically initialized at the
+ creation of the parent.
+
+ TESTS::
+
+ sage: R = ZpLC(2, label='init')
+ sage: prec = R.precision()
+ sage: prec
+ Precision lattice on 0 object (label: init)
+ sage: prec._type
+ 'lattice'
+ sage: prec.label()
+ 'init'
+ """
DifferentialPrecisionGeneric.__init__(self, p, 'lattice', label)
self._absolute_precisions = { }
self._capped = { }
@@ -1312,6 +1370,8 @@ class PrecisionLattice(DifferentialPrecisionGeneric):
def _index(self, ref):
"""
Return the index of the element whose reference is ``ref``
+
+ Only for internal use!
"""
return len(self._matrix[ref]) - 1
@@ -1875,6 +1935,34 @@ class PrecisionModule(DifferentialPrecisionGeneric):
is stored as a matrix whose rows are generators.
"""
def __init__(self, p, label, prec):
+ """
+ Initialize this precision module
+
+ INPUT:
+
+ - ``p`` -- a prime number
+
+ - ``type`` -- either ``lattice`` or ``module``
+
+ - ``label`` -- a string, the label of the parents to which belong
+ the elements tracked by this precision module
+
+ NOTE:
+
+ The precision module is automatically initialized at the
+ creation of the parent.
+
+ TESTS::
+
+ sage: R = ZpLF(2, label='init')
+ sage: prec = R.precision()
+ sage: prec
+ Precision module on 0 object (label: init)
+ sage: prec._type
+ 'module'
+ sage: prec.label()
+ 'init'
+ """
DifferentialPrecisionGeneric.__init__(self, p, 'module', label)
self._absolute_precisions = { }
self._zero_cap = prec
diff --git a/src/sage/rings/padics/padic_lattice_element.py b/src/sage/rings/padics/padic_lattice_element.py
index 0ba4ded..c759812 100644
--- a/src/sage/rings/padics/padic_lattice_element.py
+++ b/src/sage/rings/padics/padic_lattice_element.py
@@ -16,6 +16,36 @@ class pAdicLatticeElement(pAdicGenericElement):
Constructs new element with given parent and value.
"""
def __init__(self, parent, x, prec=None, dx=[], dx_mode='linear_combinaison', valuation=None, check=True, reduce=True):
+ """
+ Initialize this element
+
+ INPUT:
+
+ - ``parent`` -- the parent of this element
+
+ - ``x`` -- the newly created element
+
+ - ``dx`` -- a dictionary representing the differential of ``x``
+
+ - ``dx_mode`` -- a string, either ``linear_combinaison`` (the default)
+ or ``values``
+
+ - ``valuation`` -- an integer or ``None`` (default: ``None``),
+ the valuation of this element
+
+ - ``check`` -- a boolean (default: ``True``), whether the function
+ should check that the given values are well formed and coherent
+
+ - ``reduce`` -- a boolean (default: ``True``), whether the given
+ values need to be reduced
+
+ TESTS::
+
+ sage: R = ZpLC(2)
+ sage: x = R(1,10) # indirect doctest
+ sage: x
+ 1 + O(2^10)
+ """
self._parent = parent
p = parent.prime()
pAdicGenericElement.__init__(self, parent)