Skip to content

Commit

Permalink
Docstring edits
Browse files Browse the repository at this point in the history
More work in `rings`.
  • Loading branch information
gmou3 committed Jul 2, 2024
1 parent be0d4dc commit 7ab69d4
Show file tree
Hide file tree
Showing 100 changed files with 1,561 additions and 1,966 deletions.
2 changes: 1 addition & 1 deletion src/sage/combinat/dlx.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def __init__(self, ones, initialsolution=None):
described by Knuth.
Consider a matrix M with entries of 0 and 1, and compute a subset
of the rows of this matrix which sum to the vector of all 1's.
of the rows of this matrix which sum to the vector of all 1s.
The dancing links algorithm works particularly well for sparse
matrices, so the input is a list of lists of the form: (note the
Expand Down
2 changes: 1 addition & 1 deletion src/sage/combinat/integer_vector.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ def gale_ryser_theorem(p1, p2, algorithm='gale',
* Construct the `m \times n` matrix `B` from `r` by defining
the `i`-th row of `B` to be the vector whose first `r_i`
entries are `1`, and the remainder are 0's, `1 \leq i \leq m`.
entries are `1`, and the remainder are 0s, `1 \leq i \leq m`.
This maximal matrix `B` with row sum `r` and ones left
justified has column sum `r^{*}`.
Expand Down
2 changes: 1 addition & 1 deletion src/sage/combinat/matrices/dlxcpp.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def DLXCPP(rows):
described by Knuth.
Consider a matrix M with entries of 0 and 1, and compute a subset
of the rows of this matrix which sum to the vector of all 1's.
of the rows of this matrix which sum to the vector of all 1s.
The dancing links algorithm works particularly well for sparse
matrices, so the input is a list of lists of the form::
Expand Down
2 changes: 1 addition & 1 deletion src/sage/combinat/parking_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ class ParkingFunction(ClonableArray, metaclass=InheritComparisonClasscallMetacla
- ``area_sequence`` -- (default: ``None``) an area sequence of a Dyck path
- ``labelled_dyck_word`` -- (default: ``None``) a Dyck word with 1's
- ``labelled_dyck_word`` -- (default: ``None``) a Dyck word with 1s
replaced by labelling
OUTPUT: a parking function
Expand Down
2 changes: 1 addition & 1 deletion src/sage/combinat/root_system/dynkin_diagram.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ def DynkinDiagram(*args, **kwds):
TESTS:
Check that :issue:`15277` is fixed by not having edges from 0's::
Check that :issue:`15277` is fixed by not having edges from 0s::
sage: CM = CartanMatrix([[2,-1,0,0],[-3,2,-2,-2],[0,-1,2,-1],[0,-1,-1,2]])
sage: CM
Expand Down
4 changes: 2 additions & 2 deletions src/sage/rings/asymptotic/growth_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -1425,7 +1425,7 @@ def _rpow_element_(self, base):
- ``base`` -- an element
OUTPUT: nothing since a ``ValueError`` is raised in this generic method
OUTPUT: nothing since a :exc:`ValueError` is raised in this generic method
TESTS::
Expand Down Expand Up @@ -3028,7 +3028,7 @@ def _rpow_element_(self, base, locals=None):
The parent of the result can be different from the parent
of this element.
A ``ValueError`` is raised if the calculation is not possible
A :exc:`ValueError` is raised if the calculation is not possible
within this method. (Then the calling method should take care
of the calculation.)
Expand Down
2 changes: 1 addition & 1 deletion src/sage/rings/asymptotic/growth_group_cartesian.py
Original file line number Diff line number Diff line change
Expand Up @@ -1080,7 +1080,7 @@ def _rpow_element_(self, base):
The parent of the result can be different from the parent
of this element.
A ``ValueError`` is raised if the calculation is not possible
A :exc:`ValueError` is raised if the calculation is not possible
within this method. (Then the calling method should take care
of the calculation.)
Expand Down
2 changes: 1 addition & 1 deletion src/sage/rings/asymptotic/term_monoid.py
Original file line number Diff line number Diff line change
Expand Up @@ -2431,7 +2431,7 @@ def __invert__(self):
OUTPUT:
A :class:`ZeroDivisionError` since `O`-terms cannot be inverted.
A :exc:`ZeroDivisionError` since `O`-terms cannot be inverted.
TESTS::
Expand Down
10 changes: 5 additions & 5 deletions src/sage/rings/finite_rings/element_base.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -829,9 +829,9 @@ cdef class FinitePolyExtElement(FiniteRingElement):
- ``n`` -- integer `\geq 1`
- ``extend`` -- boolean (default: ``False``); if ``True``, return an `n`-th
root in an extension ring, if necessary. Otherwise, raise a
ValueError if the root is not in the base ring. Warning:
- ``extend`` -- boolean (default: ``False``); if ``True``, return an
`n`-th root in an extension ring, if necessary. Otherwise, raise a
:exc:`ValueError` if the root is not in the base ring. Warning:
this option is not implemented!
- ``all`` -- boolean (default: ``False``); if ``True``, return all `n`-th
Expand All @@ -846,8 +846,8 @@ cdef class FinitePolyExtElement(FiniteRingElement):
If ``self`` has an `n`-th root, returns one (if ``all`` is ``False``) or a
list of all of them (if ``all`` is ``True``).
Otherwise, raises a ``ValueError`` (if ``extend`` is ``False``)
or a ``NotImplementedError`` (if ``extend`` is ``True``).
Otherwise, raises a :exc:`ValueError` (if ``extend`` is ``False``)
or a :exc:`NotImplementedError` (if ``extend`` is ``True``).
.. warning::
Expand Down
42 changes: 19 additions & 23 deletions src/sage/rings/finite_rings/element_givaro.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ cdef void late_import() noexcept:


cdef class Cache_givaro(Cache_base):
def __init__(self, parent, unsigned int p, unsigned int k, modulus, repr="poly", cache=False):
def __init__(self, parent, unsigned int p, unsigned int k, modulus, repr='poly', cache=False):
"""
Finite Field.
Expand All @@ -120,16 +120,16 @@ cdef class Cache_givaro(Cache_base):
- ``name`` -- variable used for poly_repr (default: ``'a'``)
- ``modulus`` -- a polynomial to use as modulus.
- ``modulus`` -- a polynomial to use as modulus
- ``repr`` -- (default: 'poly') controls the way elements are printed
- ``repr`` -- (default: ``'poly'``) controls the way elements are printed
to the user:
- 'log': repr is :meth:`~FiniteField_givaroElement.log_repr()`
- 'int': repr is :meth:`~FiniteField_givaroElement.int_repr()`
- 'poly': repr is :meth:`~FiniteField_givaroElement.poly_repr()`
- ``cache`` -- (default: ``False``) if ``True`` a cache of all
- ``cache`` -- boolean (default: ``False``); if ``True`` a cache of all
elements of this field is created. Thus, arithmetic does not
create new elements which speeds calculations up. Also, if many
elements are needed during a calculation this cache reduces the
Expand Down Expand Up @@ -299,7 +299,7 @@ cdef class Cache_givaro(Cache_base):
INPUT:
- ``e`` -- data to coerce in.
- ``e`` -- data to coerce in
EXAMPLES::
Expand Down Expand Up @@ -841,7 +841,7 @@ cdef class FiniteField_givaroElement(FinitePolyExtElement):

def __init__(FiniteField_givaroElement self, parent):
"""
Initializes an element in parent. It's much better to use
Initialize an element in parent. It's much better to use
parent(<value>) or any specialized method of parent
like gen() instead. In general do not call this
constructor directly.
Expand All @@ -862,7 +862,6 @@ cdef class FiniteField_givaroElement(FinitePolyExtElement):
sage: from sage.rings.finite_rings.element_givaro import FiniteField_givaroElement
sage: FiniteField_givaroElement(k)
0
"""
FinitePolyExtElement.__init__(self, parent)
self._cache = parent._cache
Expand Down Expand Up @@ -936,7 +935,7 @@ cdef class FiniteField_givaroElement(FinitePolyExtElement):

def is_unit(FiniteField_givaroElement self):
"""
Return ``True`` if self is nonzero, so it is a unit as an element of
Return ``True`` if ``self`` is nonzero, so it is a unit as an element of
the finite field.
EXAMPLES::
Expand All @@ -956,7 +955,7 @@ cdef class FiniteField_givaroElement(FinitePolyExtElement):

def is_square(FiniteField_givaroElement self):
"""
Return ``True`` if ``self`` is a square in ``self.parent()``
Return ``True`` if ``self`` is a square in ``self.parent()``.
ALGORITHM:
Expand Down Expand Up @@ -998,20 +997,20 @@ cdef class FiniteField_givaroElement(FinitePolyExtElement):
def sqrt(FiniteField_givaroElement self, extend=False, all=False):
"""
Return a square root of this finite field element in its
parent, if there is one. Otherwise, raise a ``ValueError``.
parent, if there is one. Otherwise, raise a :exc:`ValueError`.
INPUT:
- ``extend`` -- bool (default: ``True``); if ``True``, return a
- ``extend`` -- boolean (default: ``True``); if ``True``, return a
square root in an extension ring, if necessary. Otherwise,
raise a ``ValueError`` if the root is not in the base ring.
raise a :exc:`ValueError` if the root is not in the base ring.
.. WARNING::
this option is not implemented!
- ``all`` -- bool (default: ``False``); if ``True``, return all square
roots of ``self``, instead of just one.
- ``all`` -- boolean (default: ``False``); if ``True``, return all
square roots of ``self``, instead of just one
.. WARNING::
Expand Down Expand Up @@ -1053,7 +1052,6 @@ cdef class FiniteField_givaroElement(FinitePolyExtElement):
sage: K.<a> = FiniteField(9)
sage: a.sqrt(extend = False, all = True)
[]
"""
if all:
if self.is_square():
Expand Down Expand Up @@ -1106,7 +1104,7 @@ cdef class FiniteField_givaroElement(FinitePolyExtElement):

cpdef _div_(self, right):
"""
Divide two elements
Divide two elements.
EXAMPLES::
Expand Down Expand Up @@ -1183,7 +1181,6 @@ cdef class FiniteField_givaroElement(FinitePolyExtElement):
Traceback (most recent call last):
...
ZeroDivisionError: division by zero in finite field
"""
cdef int r = 0
if self.element == 0:
Expand Down Expand Up @@ -1325,7 +1322,6 @@ cdef class FiniteField_givaroElement(FinitePolyExtElement):
Traceback (most recent call last):
...
TypeError: Cannot coerce element to an integer.
"""
cdef int self_int = self._cache.log_to_int(self.element)
if self_int % self._cache.characteristic() != self_int:
Expand Down Expand Up @@ -1470,7 +1466,7 @@ cdef class FiniteField_givaroElement(FinitePolyExtElement):

def polynomial(FiniteField_givaroElement self, name=None):
"""
Return self viewed as a polynomial over
Return ``self`` viewed as a polynomial over
``self.parent().prime_subfield()``.
EXAMPLES::
Expand Down Expand Up @@ -1501,7 +1497,7 @@ cdef class FiniteField_givaroElement(FinitePolyExtElement):

def _magma_init_(self, magma):
"""
Return a string representation of self that MAGMA can
Return a string representation of ``self`` that MAGMA can
understand.
EXAMPLES::
Expand Down Expand Up @@ -1610,8 +1606,8 @@ cdef class FiniteField_givaroElement(FinitePolyExtElement):
Return a string that evaluates to the GAP representation of
this element.
A ``NotImplementedError`` is raised if ``self.parent().modulus()`` is
not a Conway polynomial, as the isomorphism of finite fields is
A :exc:`NotImplementedError` is raised if ``self.parent().modulus()``
is not a Conway polynomial, as the isomorphism of finite fields is
not implemented yet.
EXAMPLES::
Expand Down Expand Up @@ -1666,7 +1662,7 @@ cdef class FiniteField_givaroElement(FinitePolyExtElement):
INPUT:
- ``reverse`` -- reverse the order of the bits from little endian to
big endian.
big endian
EXAMPLES::
Expand Down
4 changes: 2 additions & 2 deletions src/sage/rings/finite_rings/element_ntl_gf2e.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -1137,7 +1137,7 @@ cdef class FiniteField_ntl_gf2eElement(FinitePolyExtElement):
Return a string that evaluates to the GAP representation of
this element.
A ``NotImplementedError`` is raised if
A :exc:`NotImplementedError` is raised if
``self.parent().modulus()`` is not a Conway polynomial, as
the isomorphism of finite fields is not implemented yet.
Expand Down Expand Up @@ -1237,7 +1237,7 @@ cdef class FiniteField_ntl_gf2eElement(FinitePolyExtElement):
OUTPUT:
Integer `x` such that `a^x = b`, if it exists.
Raises a ``ValueError`` exception if no such `x` exists.
Raises a :exc:`ValueError` exception if no such `x` exists.
ALGORITHM: :pari:`fflog`
Expand Down
4 changes: 2 additions & 2 deletions src/sage/rings/finite_rings/element_pari_ffelt.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -1042,7 +1042,7 @@ cdef class FiniteFieldElement_pari_ffelt(FinitePolyExtElement):
If ``extend`` is ``True``, a square root is chosen in an
extension field if necessary. If ``extend`` is ``False``, a
:class:`ValueError` is raised if the element is not a square in the
:exc:`ValueError` is raised if the element is not a square in the
base field.
.. WARNING::
Expand Down Expand Up @@ -1112,7 +1112,7 @@ cdef class FiniteFieldElement_pari_ffelt(FinitePolyExtElement):
OUTPUT:
An integer `x` such that ``self`` equals ``base`` raised to
the power `x`. If no such `x` exists, a ``ValueError`` is
the power `x`. If no such `x` exists, a :exc:`ValueError` is
raised.
EXAMPLES::
Expand Down
Loading

0 comments on commit 7ab69d4

Please sign in to comment.