Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doc tweaks in padics #39360

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
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
20 changes: 13 additions & 7 deletions src/sage/rings/padics/common_conversion.pyx
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
r"""
Tools for creation of `p`-adic elements

The functions in this file are used in creating new `p`-adic elements.

When creating a `p`-adic element, the user can specify that the absolute
Expand Down Expand Up @@ -49,7 +51,7 @@ cdef Rational rat_temp = PY_NEW(Rational)

cdef long get_ordp(x, PowComputer_class prime_pow) except? -10000:
"""
This function determines the valuation of the `p`-adic element
Determine the valuation of the `p`-adic element
that will result from the given data ``x``.

Note that the valuation can differ depending on the ring: if the
Expand Down Expand Up @@ -160,7 +162,7 @@ cdef long get_ordp(x, PowComputer_class prime_pow) except? -10000:

cdef long get_preccap(x, PowComputer_class prime_pow) except? -10000:
"""
This function determines the maximum absolute precision possible
Determine the maximum absolute precision possible
for an element created from the given data ``x``.

Note that the valuation can differ depending on the ring: if the
Expand Down Expand Up @@ -231,7 +233,7 @@ cdef long get_preccap(x, PowComputer_class prime_pow) except? -10000:

cdef long comb_prec(iprec, long prec) except? -10000:
"""
This function returns the minimum of iprec and prec.
Return the minimum of ``iprec`` and ``prec``.

INPUT:

Expand All @@ -255,7 +257,7 @@ cdef long comb_prec(iprec, long prec) except? -10000:

cdef int _process_args_and_kwds(long *aprec, long *rprec, args, kwds, bint absolute, PowComputer_class prime_pow) except -1:
"""
This function obtains values for absprec and relprec from a
Obtain values for ``absprec`` and ``relprec`` from a
combination of positional and keyword arguments.

When creating a `p`-adic element, the user can pass in two arguments: ``absprec`` and ``relprec``.
Expand Down Expand Up @@ -332,7 +334,7 @@ cdef inline long cconv_mpq_t_shared(mpz_t out, mpq_t x, long prec, bint absolute

OUTPUT:

- If ``absolute`` is False then returns the valuation that was
- If ``absolute`` is ``False`` then returns the valuation that was
extracted (``maxordp`` when `x = 0`).
"""
cdef long numval, denval
Expand Down Expand Up @@ -364,6 +366,8 @@ cdef inline int cconv_mpq_t_out_shared(mpq_t out, mpz_t x, long valshift, long p
"""
Convert the underlying `p`-adic element into a rational.

INPUT:

- ``out`` -- gives a rational approximating the input. Currently uses
rational reconstruction but may change in the future to use a more naive
method
Expand Down Expand Up @@ -447,11 +451,11 @@ cdef inline int cconv_shared(mpz_t out, x, long prec, long valshift, PowComputer
else:
raise NotImplementedError
else:
raise NotImplementedError("No conversion defined for %s which is a %s in %s"%(x,type(x),x.parent() if hasattr(x,"parent") else "no parent"))
raise NotImplementedError("No conversion defined for %s which is a %s in %s" % (x, type(x), x.parent() if hasattr(x, "parent") else "no parent"))

cdef inline long cconv_mpz_t_shared(mpz_t out, mpz_t x, long prec, bint absolute, PowComputer_class prime_pow) except -2:
"""
A fast pathway for conversion of integers that doesn't require
A fast pathway for conversion of integers that does not require
precomputation of the valuation.

INPUT:
Expand Down Expand Up @@ -485,6 +489,8 @@ cdef inline int cconv_mpz_t_out_shared(mpz_t out, mpz_t x, long valshift, long p
"""
Convert the underlying `p`-adic element into an integer if possible.

INPUT:

- ``out`` -- stores the resulting integer as an integer between 0
and `p^{prec + valshift}`
- ``x`` -- an ``mpz_t`` giving the underlying `p`-adic element
Expand Down
10 changes: 5 additions & 5 deletions src/sage/rings/padics/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,16 @@
- Ander Steele
- Kiran Kedlaya (modified gauss_sum 2017/09)
"""
#*****************************************************************************
# ****************************************************************************
# Copyright (C) 2007-2013 David Roe <[email protected]>
# William Stein <[email protected]>
#
# Distributed under the terms of the GNU General Public License (GPL)
# as published by the Free Software Foundation; either version 2 of
# the License, or (at your option) any later version.
#
# http://www.gnu.org/licenses/
#*****************************************************************************
# https://www.gnu.org/licenses/
# ****************************************************************************

from sage.rings.infinity import infinity

Expand Down Expand Up @@ -214,7 +214,7 @@ def precprint(prec_type, prec_cap, p):

def trim_zeros(L):
r"""
Strips trailing zeros/empty lists from a list.
Strip trailing zeros/empty lists from a list.

EXAMPLES::

Expand All @@ -228,7 +228,7 @@ def trim_zeros(L):
sage: trim_zeros([])
[]

Zeros are also trimmed from nested lists (one deep):
Zeros are also trimmed from nested lists (one deep)::

sage: trim_zeros([[1,0]])
[[1]]
Expand Down
Loading