From 6b3aefffe1c172dd7240042ef123a8e8554ab729 Mon Sep 17 00:00:00 2001 From: gmou3 Date: Sun, 23 Jun 2024 17:51:49 +0300 Subject: [PATCH] Docstring edits Work in `modules`, `monoids`, `parallel`, `probability`, `quivers`, `sandpiles`, `sat`, `stats`, and `typeset`. --- .../finite_dimensional_algebra.py | 2 +- src/sage/arith/misc.py | 30 +- src/sage/calculus/calculus.py | 4 +- src/sage/calculus/functional.py | 4 +- src/sage/categories/groups.py | 2 +- src/sage/coding/cyclic_code.py | 4 +- .../cluster_algebra_quiver/cluster_seed.py | 4 +- .../combinat/cluster_algebra_quiver/quiver.py | 4 +- src/sage/combinat/designs/twographs.py | 2 +- src/sage/combinat/diagram_algebras.py | 2 +- src/sage/combinat/ncsf_qsym/ncsf.py | 2 +- src/sage/combinat/ncsf_qsym/qsym.py | 2 +- src/sage/combinat/output.py | 2 +- src/sage/combinat/posets/posets.py | 4 +- .../root_system/reflection_group_element.pyx | 16 +- .../root_system/reflection_group_real.py | 2 +- src/sage/combinat/sf/elementary.py | 2 +- src/sage/combinat/sf/schur.py | 2 +- src/sage/combinat/sf/sfa.py | 4 +- src/sage/crypto/block_cipher/des.py | 4 +- src/sage/crypto/block_cipher/present.py | 2 +- .../ordered_arrangement.py | 2 +- .../combinatorial_polyhedron/conversions.pyx | 2 +- src/sage/geometry/toric_lattice.py | 2 +- src/sage/graphs/base/static_dense_graph.pyx | 2 +- src/sage/graphs/bipartite_graph.py | 22 +- src/sage/graphs/comparability.pyx | 6 +- src/sage/graphs/digraph_generators.py | 2 +- .../graphs/generators/classical_geometries.py | 2 +- src/sage/graphs/generators/families.py | 4 +- src/sage/graphs/generic_graph.py | 24 +- src/sage/graphs/graph.py | 10 +- src/sage/graphs/graph_coloring.pyx | 4 +- src/sage/graphs/graph_database.py | 2 +- src/sage/graphs/graph_generators.py | 32 +- src/sage/graphs/graph_latex.py | 16 +- src/sage/graphs/hyperbolicity.pyx | 2 +- src/sage/graphs/traversals.pyx | 18 +- src/sage/groups/finitely_presented.py | 2 +- src/sage/groups/perm_gps/permgroup.py | 2 +- src/sage/interfaces/giac.py | 8 +- src/sage/interfaces/gp.py | 2 +- src/sage/interfaces/maxima_abstract.py | 4 +- src/sage/interfaces/singular.py | 10 +- src/sage/knots/knotinfo.py | 6 +- src/sage/manifolds/differentiable/manifold.py | 2 +- .../pseudo_riemannian_submanifold.py | 2 +- src/sage/matrix/matrix1.pyx | 4 +- src/sage/matrix/matrix2.pyx | 47 +-- src/sage/matrix/matrix_double_dense.pyx | 28 +- src/sage/matrix/matrix_gfpn_dense.pyx | 2 +- src/sage/matrix/matrix_integer_dense.pyx | 8 +- .../matrix/matrix_modn_dense_template.pxi | 2 +- src/sage/matrix/special.py | 12 +- src/sage/misc/sagedoc.py | 4 +- src/sage/misc/verbose.py | 2 +- src/sage/modular/abvar/abvar.py | 8 +- .../modular/arithgroup/congroup_gammaH.py | 4 +- src/sage/modular/btquotients/btquotient.py | 4 +- .../modular/btquotients/pautomorphicform.py | 10 +- src/sage/modular/cusps_nf.py | 2 +- src/sage/modular/hecke/ambient_module.py | 4 +- src/sage/modular/modform/ring.py | 2 +- src/sage/modular/modsym/ambient.py | 4 +- src/sage/modular/modsym/space.py | 2 +- src/sage/modular/pollack_stevens/space.py | 2 +- src/sage/modules/diamond_cutting.py | 4 +- src/sage/modules/fg_pid/fgp_element.py | 18 +- src/sage/modules/fg_pid/fgp_module.py | 63 ++- src/sage/modules/fg_pid/fgp_morphism.py | 5 +- src/sage/modules/filtered_vector_space.py | 63 ++- src/sage/modules/finite_submodule_iter.pyx | 39 +- src/sage/modules/fp_graded/element.py | 10 +- src/sage/modules/fp_graded/free_element.py | 4 +- src/sage/modules/fp_graded/free_module.py | 18 +- src/sage/modules/fp_graded/free_morphism.py | 2 +- src/sage/modules/fp_graded/homspace.py | 5 +- src/sage/modules/fp_graded/module.py | 22 +- src/sage/modules/fp_graded/morphism.py | 26 +- src/sage/modules/fp_graded/steenrod/module.py | 9 +- .../modules/fp_graded/steenrod/morphism.py | 19 +- .../modules/fp_graded/steenrod/profile.py | 14 +- src/sage/modules/free_module.py | 396 +++++++++--------- src/sage/modules/free_module_element.pyx | 197 ++++----- src/sage/modules/free_module_homspace.py | 38 +- src/sage/modules/free_module_integer.py | 47 +-- src/sage/modules/free_module_morphism.py | 46 +- src/sage/modules/free_quadratic_module.py | 28 +- ...free_quadratic_module_integer_symmetric.py | 60 ++- src/sage/modules/matrix_morphism.py | 66 ++- src/sage/modules/module.pyx | 12 +- .../modules/multi_filtered_vector_space.py | 45 +- src/sage/modules/quotient_module.py | 8 +- src/sage/modules/tensor_operations.py | 40 +- src/sage/modules/torsion_quadratic_module.py | 36 +- .../modules/vector_callable_symbolic_dense.py | 2 +- .../modules/vector_complex_double_dense.pyx | 2 +- src/sage/modules/vector_double_dense.pyx | 46 +- src/sage/modules/vector_integer_dense.pyx | 4 +- src/sage/modules/vector_integer_sparse.pyx | 6 +- src/sage/modules/vector_numpy_dense.pyx | 15 +- src/sage/modules/vector_rational_dense.pyx | 2 +- src/sage/modules/vector_rational_sparse.pyx | 14 +- src/sage/modules/vector_real_double_dense.pyx | 4 +- src/sage/modules/vector_space_homspace.py | 13 +- src/sage/modules/vector_space_morphism.py | 16 +- src/sage/modules/vector_symbolic_dense.py | 3 +- src/sage/modules/vector_symbolic_sparse.py | 3 +- src/sage/modules/with_basis/cell_module.py | 2 +- .../modules/with_basis/indexed_element.pyx | 12 +- src/sage/modules/with_basis/invariant.py | 4 +- src/sage/modules/with_basis/morphism.py | 169 ++++---- src/sage/modules/with_basis/representation.py | 82 ++-- src/sage/modules/with_basis/subquotient.py | 22 +- src/sage/monoids/automatic_semigroup.py | 30 +- src/sage/monoids/free_abelian_monoid.py | 12 +- .../monoids/free_abelian_monoid_element.pyx | 2 +- src/sage/monoids/free_monoid.py | 2 +- src/sage/monoids/free_monoid_element.py | 2 +- src/sage/monoids/hecke_monoid.py | 4 +- src/sage/monoids/indexed_free_monoid.py | 4 +- src/sage/monoids/string_monoid.py | 20 +- src/sage/monoids/string_monoid_element.py | 22 +- src/sage/monoids/trace_monoid.py | 10 +- src/sage/parallel/decorate.py | 36 +- src/sage/parallel/map_reduce.py | 60 ++- src/sage/parallel/multiprocessing_sage.py | 10 +- src/sage/parallel/parallelism.py | 9 - src/sage/parallel/reference.py | 12 +- src/sage/parallel/use_fork.py | 28 +- .../probability/probability_distribution.pyx | 30 +- src/sage/probability/random_variable.py | 26 +- src/sage/quivers/algebra.py | 31 +- src/sage/quivers/algebra_elements.pyx | 31 +- src/sage/quivers/ar_quiver.py | 16 +- src/sage/quivers/homspace.py | 32 +- src/sage/quivers/morphism.py | 103 ++--- src/sage/quivers/path_semigroup.py | 54 +-- src/sage/quivers/paths.pyx | 50 +-- src/sage/quivers/representation.py | 167 +++----- src/sage/sandpiles/examples.py | 46 +- src/sage/sandpiles/sandpile.py | 228 +++++----- src/sage/sat/boolean_polynomials.py | 4 +- src/sage/sat/converters/polybori.py | 10 +- src/sage/sat/solvers/cryptominisat.py | 16 +- src/sage/sat/solvers/dimacs.py | 16 +- src/sage/sat/solvers/picosat.py | 6 +- src/sage/sat/solvers/sat_lp.py | 22 +- src/sage/sat/solvers/satsolver.pyx | 39 +- src/sage/stats/basic_stats.py | 45 +- src/sage/stats/distributions/dgs_gauss.h | 2 +- .../discrete_gaussian_integer.pyx | 48 +-- .../discrete_gaussian_lattice.py | 20 +- src/sage/stats/hmm/chmm.pyx | 45 +- src/sage/stats/hmm/distributions.pyx | 31 +- src/sage/stats/hmm/hmm.pyx | 67 ++- src/sage/stats/hmm/util.pyx | 12 +- src/sage/stats/intlist.pyx | 39 +- src/sage/stats/r.py | 4 +- src/sage/stats/time_series.pyx | 120 +++--- src/sage/typeset/ascii_art.py | 2 +- src/sage/typeset/character_art.py | 6 +- src/sage/typeset/character_art_factory.py | 14 +- src/sage/typeset/symbols.py | 32 +- src/sage/typeset/unicode_art.py | 3 +- 165 files changed, 1749 insertions(+), 2133 deletions(-) diff --git a/src/sage/algebras/finite_dimensional_algebras/finite_dimensional_algebra.py b/src/sage/algebras/finite_dimensional_algebras/finite_dimensional_algebra.py index 5df15853118..2e459ef4a18 100644 --- a/src/sage/algebras/finite_dimensional_algebras/finite_dimensional_algebra.py +++ b/src/sage/algebras/finite_dimensional_algebras/finite_dimensional_algebra.py @@ -439,7 +439,7 @@ def ideal(self, gens=None, given_by_matrix=False, side=None): - ``A`` -- a :class:`FiniteDimensionalAlgebra` - - ``gens`` -- (default: ``None``); either an element of `A` or a + - ``gens`` -- (default: ``None``) either an element of `A` or a list of elements of `A`, given as vectors, matrices, or FiniteDimensionalAlgebraElements. If ``given_by_matrix`` is ``True``, then ``gens`` should instead be a matrix whose rows diff --git a/src/sage/arith/misc.py b/src/sage/arith/misc.py index bdaef8160b2..3268f6b06c8 100644 --- a/src/sage/arith/misc.py +++ b/src/sage/arith/misc.py @@ -1683,17 +1683,17 @@ def plot(self, xmin=1, xmax=50, k=1, pointsize=30, rgbcolor=(0,0,1), join=True, INPUT: - - ``xmin`` -- default: 1 + - ``xmin`` -- (default: 1) - - ``xmax`` -- default: 50 + - ``xmax`` -- (default: 50) - - ``k`` -- default: 1 + - ``k`` -- (default: 1) - - ``pointsize`` -- default: 30 + - ``pointsize`` -- (default: 30) - - ``rgbcolor`` -- default: (0,0,1) + - ``rgbcolor`` -- (default: (0,0,1)) - - ``join`` -- default: ``True``; whether to join the points + - ``join`` -- (default: ``True``) whether to join the points - ``**kwds`` -- passed on @@ -3108,13 +3108,13 @@ def plot(self, xmin=1, xmax=50, pointsize=30, rgbcolor=(0, 0, 1), INPUT: - - ``xmin`` -- default: 1 + - ``xmin`` -- (default: 1) - - ``xmax`` -- default: 50 + - ``xmax`` -- (default: 50) - - ``pointsize`` -- default: 30 + - ``pointsize`` -- (default: 30) - - ``rgbcolor`` -- default: (0,0,1) + - ``rgbcolor`` -- (default: (0,0,1)) - ``join`` -- boolean (default: ``True``); whether to join the points @@ -4557,15 +4557,15 @@ def plot(self, xmin=0, xmax=50, pointsize=30, rgbcolor=(0,0,1), join=True, INPUT: - - ``xmin`` -- default: 0 + - ``xmin`` -- (default: 0) - - ``xmax`` -- default: 50 + - ``xmax`` -- (default: 50) - - ``pointsize`` -- default: 30 + - ``pointsize`` -- (default: 30) - - ``rgbcolor`` -- default: (0,0,1) + - ``rgbcolor`` -- (default: (0,0,1)) - - ``join`` -- default: ``True``; whether to join the points + - ``join`` -- (default: ``True``) whether to join the points (very helpful in seeing their order) - ``**kwds`` -- passed on diff --git a/src/sage/calculus/calculus.py b/src/sage/calculus/calculus.py index 7c85817ee97..856433c84f7 100644 --- a/src/sage/calculus/calculus.py +++ b/src/sage/calculus/calculus.py @@ -1167,12 +1167,12 @@ def limit(ex, dir=None, taylor=False, algorithm='maxima', **argv): INPUT: - - ``dir`` -- (default: ``None``); may have the value + - ``dir`` -- (default: ``None``) may have the value ``'plus'`` (or ``'+'`` or ``'right'`` or ``'above'``) for a limit from above, ``'minus'`` (or ``'-'`` or ``'left'`` or ``'below'``) for a limit from below, or may be omitted (implying a two-sided limit is to be computed). - - ``taylor`` -- (default: ``False``); if ``True``, use Taylor + - ``taylor`` -- (default: ``False``) if ``True``, use Taylor series, which allows more limits to be computed (but may also crash in some obscure cases due to bugs in Maxima). diff --git a/src/sage/calculus/functional.py b/src/sage/calculus/functional.py index 29c982dd158..8747e1df790 100644 --- a/src/sage/calculus/functional.py +++ b/src/sage/calculus/functional.py @@ -335,12 +335,12 @@ def limit(f, dir=None, taylor=False, **argv): INPUT: - - ``dir`` -- (default: ``None``); dir may have the value ``'plus'`` (or + - ``dir`` -- (default: ``None``) dir may have the value ``'plus'`` (or ``'above'``) for a limit from above, ``'minus'`` (or ``'below'``) for a limit from below, or may be omitted (implying a two-sided limit is to be computed). - - ``taylor`` -- (default: ``False``); if ``True``, use Taylor + - ``taylor`` -- (default: ``False``) if ``True``, use Taylor series, which allows more limits to be computed (but may also crash in some obscure cases due to bugs in Maxima). diff --git a/src/sage/categories/groups.py b/src/sage/categories/groups.py index 907337745b9..b2c8453b6d0 100644 --- a/src/sage/categories/groups.py +++ b/src/sage/categories/groups.py @@ -225,7 +225,7 @@ def cayley_table(self, names='letters', elements=None): * a list - a list of strings, where the length of the list equals the number of elements. - - ``elements`` -- (default: ``None``); A list of + - ``elements`` -- (default: ``None``) a list of elements of the group, in forms that can be coerced into the structure, eg. their string representations. This may be used to impose an diff --git a/src/sage/coding/cyclic_code.py b/src/sage/coding/cyclic_code.py index 3600b3994b3..3c844387fa2 100644 --- a/src/sage/coding/cyclic_code.py +++ b/src/sage/coding/cyclic_code.py @@ -150,7 +150,7 @@ def bch_bound(n, D, arithmetic=False): - ``D`` -- list of integers - - ``arithmetic`` -- (default: ``False``); if it is set to ``True``, then it + - ``arithmetic`` -- (default: ``False``) if it is set to ``True``, then it computes the BCH bound using the longest arithmetic sequence definition OUTPUT: @@ -763,7 +763,7 @@ def bch_bound(self, arithmetic=False): INPUT: - - ``arithmetic`` -- (default: ``False``); if it is set to ``True``, + - ``arithmetic`` -- (default: ``False``) if it is set to ``True``, then it computes the BCH bound using the longest arithmetic sequence definition diff --git a/src/sage/combinat/cluster_algebra_quiver/cluster_seed.py b/src/sage/combinat/cluster_algebra_quiver/cluster_seed.py index cabeebe3c52..7ce12de3e55 100644 --- a/src/sage/combinat/cluster_algebra_quiver/cluster_seed.py +++ b/src/sage/combinat/cluster_algebra_quiver/cluster_seed.py @@ -3756,10 +3756,10 @@ def cluster_class(self, depth=infinity, show_depth=False, up_to_equivalence=True - ``depth`` -- (default: infinity) integer, only seeds with distance at most ``depth`` from ``self`` are returned - - ``return_depth`` -- (default: ``False``); if ``True``, ignored if + - ``return_depth`` -- (default: ``False``) if ``True``, ignored if ``depth`` is set; returns the depth of the mutation class, i.e., the maximal distance from ``self`` of an element in the mutation class - - ``up_to_equivalence`` -- (default: ``True``); if ``True``, only + - ``up_to_equivalence`` -- (default: ``True``) if ``True``, only clusters up to equivalence are considered EXAMPLES: diff --git a/src/sage/combinat/cluster_algebra_quiver/quiver.py b/src/sage/combinat/cluster_algebra_quiver/quiver.py index a0e53078cea..4a0fab54272 100644 --- a/src/sage/combinat/cluster_algebra_quiver/quiver.py +++ b/src/sage/combinat/cluster_algebra_quiver/quiver.py @@ -1925,9 +1925,9 @@ def is_mutation_finite( self, nr_of_checks=None, return_path=False ): - ``nr_of_checks`` -- (default: ``None``) number of mutations applied; Standard is 500*(number of vertices of ``self``) - - ``return_path`` -- (default: ``False``); if ``True``, in case of + - ``return_path`` -- (default: ``False``) if ``True``, in case of ``self`` not being mutation finite, a path from ``self`` to a quiver - with an edge label `(a,-b)` and `a*b > 4` is returned. + with an edge label `(a,-b)` and `a*b > 4` is returned ALGORITHM: diff --git a/src/sage/combinat/designs/twographs.py b/src/sage/combinat/designs/twographs.py index f64afe716a7..dfffaed8bf8 100644 --- a/src/sage/combinat/designs/twographs.py +++ b/src/sage/combinat/designs/twographs.py @@ -271,7 +271,7 @@ def twograph_descendant(G, v, name=None): - ``v`` -- a vertex of ``G`` - - ``name`` -- (default: ``None``); no name, otherwise derive from the construction + - ``name`` -- (default: ``None``) no name, otherwise derive from the construction EXAMPLES: diff --git a/src/sage/combinat/diagram_algebras.py b/src/sage/combinat/diagram_algebras.py index 3512ef5471e..748d9f2fb62 100644 --- a/src/sage/combinat/diagram_algebras.py +++ b/src/sage/combinat/diagram_algebras.py @@ -1145,7 +1145,7 @@ class AbstractPartitionDiagrams(Parent, UniqueRepresentation): INPUT: - ``order`` -- integer or integer `+ 1/2`; the order of the diagrams - - ``category`` -- (default: ``FiniteEnumeratedSets()``); the category + - ``category`` -- (default: ``FiniteEnumeratedSets()``) the category All concrete classes should implement attributes diff --git a/src/sage/combinat/ncsf_qsym/ncsf.py b/src/sage/combinat/ncsf_qsym/ncsf.py index 30654707768..fa35c080dbb 100644 --- a/src/sage/combinat/ncsf_qsym/ncsf.py +++ b/src/sage/combinat/ncsf_qsym/ncsf.py @@ -1920,7 +1920,7 @@ def expand(self, n, alphabet='x'): - ``n`` -- nonnegative integer; the number of variables in the expansion - - ``alphabet`` -- (default: ``'x'``); the alphabet in + - ``alphabet`` -- (default: ``'x'``) the alphabet in which ``self`` is to be expanded OUTPUT: an expansion of ``self`` into the `n` variables diff --git a/src/sage/combinat/ncsf_qsym/qsym.py b/src/sage/combinat/ncsf_qsym/qsym.py index 6b75a985353..57d8437e616 100644 --- a/src/sage/combinat/ncsf_qsym/qsym.py +++ b/src/sage/combinat/ncsf_qsym/qsym.py @@ -1568,7 +1568,7 @@ def expand(self, n, alphabet='x'): - ``n`` -- nonnegative integer; the number of variables in the expansion - - ``alphabet`` -- (default: ``'x'``); the alphabet in + - ``alphabet`` -- (default: ``'x'``) the alphabet in which ``self`` is to be expanded OUTPUT: an expansion of ``self`` into the ``n`` variables diff --git a/src/sage/combinat/output.py b/src/sage/combinat/output.py index 810cd4ff6b5..1e2725448f9 100644 --- a/src/sage/combinat/output.py +++ b/src/sage/combinat/output.py @@ -353,7 +353,7 @@ def tex_from_skew_array(array, with_lines=False, align='b'): - ``with_lines`` -- (default: ``False``) if ``True`` lines are drawn, if ``False`` they are not - - ``align`` -- (default: ``'b'``); determine the alignment on the latex + - ``align`` -- (default: ``'b'``) determine the alignment on the latex array environments EXAMPLES:: diff --git a/src/sage/combinat/posets/posets.py b/src/sage/combinat/posets/posets.py index b0f8c9f8c37..8b43edf546f 100644 --- a/src/sage/combinat/posets/posets.py +++ b/src/sage/combinat/posets/posets.py @@ -363,7 +363,7 @@ def Poset(data=None, element_labels=None, cover_relations=False, linear_extensio 6. A previously constructed poset (the poset itself is returned). - - ``element_labels`` -- (default: ``None``); an optional list or + - ``element_labels`` -- (default: ``None``) an optional list or dictionary of objects that label the poset elements - ``cover_relations`` -- boolean (default: ``False``); whether the @@ -4366,7 +4366,7 @@ def coxeter_smith_form(self, algorithm='singular'): INPUT: - - ``algorithm`` -- (default: ``'singular'``); possible + - ``algorithm`` -- (default: ``'singular'``) possible values are ``'singular'``, ``'sage'``, ``'gap'``, ``'pari'``, ``'maple'``, ``'magma'``, ``'fricas'`` diff --git a/src/sage/combinat/root_system/reflection_group_element.pyx b/src/sage/combinat/root_system/reflection_group_element.pyx index 65d6c7a943e..ca72f87d740 100644 --- a/src/sage/combinat/root_system/reflection_group_element.pyx +++ b/src/sage/combinat/root_system/reflection_group_element.pyx @@ -186,7 +186,7 @@ cdef class ComplexReflectionGroupElement(PermutationGroupElement): Return ``self`` as a matrix acting on the underlying vector space. - - ``on_space`` -- (default: ``'primal'``); whether + - ``on_space`` -- (default: ``'primal'``) whether to act as the reflection representation on the given basis, or to act on the dual reflection representation on the dual basis @@ -356,7 +356,7 @@ cdef class ComplexReflectionGroupElement(PermutationGroupElement): - ``vec`` -- vector in the basis given by the simple root - - ``on_space`` -- (default: ``'primal'``); whether + - ``on_space`` -- (default: ``'primal'``) whether to act as the reflection representation on the given basis, or to act on the dual reflection representation on the dual basis @@ -875,10 +875,10 @@ cdef class RealReflectionGroupElement(ComplexReflectionGroupElement): Return ``self`` as a matrix acting on the underlying vector space. - - ``side`` -- (default: ``'right'``); whether the + - ``side`` -- (default: ``'right'``) whether the action of ``self`` is on the ``'left'`` or on the ``'right'`` - - ``on_space`` -- (default: ``'primal'``); whether + - ``on_space`` -- (default: ``'primal'``) whether to act as the reflection representation on the given basis, or to act on the dual reflection representation on the dual basis @@ -967,10 +967,10 @@ cdef class RealReflectionGroupElement(ComplexReflectionGroupElement): - ``vec`` -- vector in the basis given by the simple root - - ``side`` -- (default: ``'right'``); whether the + - ``side`` -- (default: ``'right'``) whether the action of ``self`` is on the ``'left'`` or on the ``'right'`` - - ``on_space`` -- (default: ``'primal'``); whether + - ``on_space`` -- (default: ``'primal'``) whether to act as the reflection representation on the given basis, or to act on the dual reflection representation on the dual basis @@ -1062,7 +1062,7 @@ cdef class RealReflectionGroupElement(ComplexReflectionGroupElement): - ``i`` -- index of the root to act on - - ``side`` -- (default: ``'right'``); whether the + - ``side`` -- (default: ``'right'``) whether the action is on the left or on the right EXAMPLES:: @@ -1098,7 +1098,7 @@ cdef class RealReflectionGroupElement(ComplexReflectionGroupElement): - ``root`` -- the root to act on - - ``side`` -- (default: ``'right'``); whether the + - ``side`` -- (default: ``'right'``) whether the action is on the left or on the right EXAMPLES:: diff --git a/src/sage/combinat/root_system/reflection_group_real.py b/src/sage/combinat/root_system/reflection_group_real.py index 59c10ec2e80..99e52d5e7e1 100644 --- a/src/sage/combinat/root_system/reflection_group_real.py +++ b/src/sage/combinat/root_system/reflection_group_real.py @@ -301,7 +301,7 @@ def iteration(self, algorithm='breadth', tracking_words=True): INPUT: - - ``algorithm`` -- (default: ``'breadth'``); must be one of + - ``algorithm`` -- (default: ``'breadth'``) must be one of the following: * ``'breadth'`` -- iterate over in a linear extension of the diff --git a/src/sage/combinat/sf/elementary.py b/src/sage/combinat/sf/elementary.py index de88550517a..f2905d818bd 100644 --- a/src/sage/combinat/sf/elementary.py +++ b/src/sage/combinat/sf/elementary.py @@ -452,7 +452,7 @@ def exponential_specialization(self, t=None, q=1): INPUT: - - ``t`` -- (default: ``None``); the value to use for `t`. + - ``t`` -- (default: ``None``) the value to use for `t`. The default is to create a ring of polynomials in `t`. - ``q`` -- (default: `1`) the value to use for `q`. If diff --git a/src/sage/combinat/sf/schur.py b/src/sage/combinat/sf/schur.py index 412d5877cc3..7d992b9facc 100644 --- a/src/sage/combinat/sf/schur.py +++ b/src/sage/combinat/sf/schur.py @@ -620,7 +620,7 @@ def principal_specialization(self, n=infinity, q=None): specialization of order ``n`` or the stable principal specialization. - - ``q`` -- (default: ``None``); the value to use for `q`; the + - ``q`` -- (default: ``None``) the value to use for `q`; the default is to create a ring of polynomials in ``q`` (or a field of rational functions in ``q``) over the given coefficient ring. diff --git a/src/sage/combinat/sf/sfa.py b/src/sage/combinat/sf/sfa.py index 8a45de40068..0995d272d7a 100644 --- a/src/sage/combinat/sf/sfa.py +++ b/src/sage/combinat/sf/sfa.py @@ -6047,7 +6047,7 @@ def principal_specialization(self, n=infinity, q=None): specialization of order ``n`` or the stable principal specialization. - - ``q`` -- (default: ``None``); the value to use for `q`; the + - ``q`` -- (default: ``None``) the value to use for `q`; the default is to create a ring of polynomials in ``q`` (or a field of rational functions in ``q``) over the given coefficient ring. @@ -6295,7 +6295,7 @@ def exponential_specialization(self, t=None, q=1): INPUT: - - ``t`` -- (default: ``None``); the value to use for `t`; + - ``t`` -- (default: ``None``) the value to use for `t`; the default is to create a ring of polynomials in ``t`` - ``q`` -- (default: `1`) the value to use for `q`. If diff --git a/src/sage/crypto/block_cipher/des.py b/src/sage/crypto/block_cipher/des.py index 500d14d0985..182de4a14b3 100644 --- a/src/sage/crypto/block_cipher/des.py +++ b/src/sage/crypto/block_cipher/des.py @@ -349,11 +349,11 @@ def __init__(self, rounds=None, keySchedule='DES_KS', keySize=64, doFinalRound=T - ``rounds`` -- integer (default: ``None``); the number of rounds. If ``None`` the number of rounds of the key schedule is used. - - ``keySchedule`` -- (default: ``'DES_KS'``); the key schedule that + - ``keySchedule`` -- (default: ``'DES_KS'``) the key schedule that will be used for encryption and decryption. If ``'DES_KS'`` the default DES key schedule is used. - - ``keySize`` -- (default: ``64``); the key length in bits. Must be + - ``keySize`` -- (default: ``64``) the key length in bits. Must be ``56`` of ``64``. In the latter case the key contains 8 parity bits. - ``doFinalRound`` -- boolean (default: ``True``); if ``False`` a swap diff --git a/src/sage/crypto/block_cipher/present.py b/src/sage/crypto/block_cipher/present.py index 518ee9d25ba..7b1a4a8a3d5 100644 --- a/src/sage/crypto/block_cipher/present.py +++ b/src/sage/crypto/block_cipher/present.py @@ -179,7 +179,7 @@ def __init__(self, keySchedule=80, rounds=None, doFinalRound=False): INPUT: - - ``keySchedule`` -- (default: ``80``); the key schedule that will be + - ``keySchedule`` -- (default: ``80``) the key schedule that will be used for encryption and decryption. Use ``80`` or ``128`` as a shortcut for the original key schedules from [BKLPPRSV2007]_. diff --git a/src/sage/geometry/hyperplane_arrangement/ordered_arrangement.py b/src/sage/geometry/hyperplane_arrangement/ordered_arrangement.py index f7ad4ee6531..c0024f4c982 100644 --- a/src/sage/geometry/hyperplane_arrangement/ordered_arrangement.py +++ b/src/sage/geometry/hyperplane_arrangement/ordered_arrangement.py @@ -142,7 +142,7 @@ def hyperplane_section(self, proj=True): INPUT: - - ``proj`` -- (default: ``True``); if the + - ``proj`` -- (default: ``True``) if the ambient space is affine or projective OUTPUT: diff --git a/src/sage/geometry/polyhedron/combinatorial_polyhedron/conversions.pyx b/src/sage/geometry/polyhedron/combinatorial_polyhedron/conversions.pyx index 95c1d842c7d..a1ce8b14cb1 100644 --- a/src/sage/geometry/polyhedron/combinatorial_polyhedron/conversions.pyx +++ b/src/sage/geometry/polyhedron/combinatorial_polyhedron/conversions.pyx @@ -410,7 +410,7 @@ def _bit_rep_to_Vrep_list_wrapper(ListOfFaces faces, index=0): INPUT: - ``faces`` -- a :class:`~sage.geometry.polyhedron.combinatorial_polyhedron.list_of_faces.ListOfFaces` - - ``index`` -- (default: ``0``); the face to obtain + - ``index`` -- (default: ``0``) the face to obtain OUTPUT: the face as tuple of integers diff --git a/src/sage/geometry/toric_lattice.py b/src/sage/geometry/toric_lattice.py index 24380902d4f..91c03784794 100644 --- a/src/sage/geometry/toric_lattice.py +++ b/src/sage/geometry/toric_lattice.py @@ -1730,7 +1730,7 @@ def coordinate_vector(self, x, reduce=False): - ``x`` -- element of ``self`` or convertible to ``self`` - - ``reduce`` -- (default: ``False``); if ``True``, reduce coefficients + - ``reduce`` -- (default: ``False``) if ``True``, reduce coefficients modulo invariants OUTPUT: the coordinates as a vector diff --git a/src/sage/graphs/base/static_dense_graph.pyx b/src/sage/graphs/base/static_dense_graph.pyx index 949b8406eae..1809e08905b 100644 --- a/src/sage/graphs/base/static_dense_graph.pyx +++ b/src/sage/graphs/base/static_dense_graph.pyx @@ -64,7 +64,7 @@ cdef dict dense_graph_init(binary_matrix_t m, g, translation=None, force_undirec - ``g`` -- a graph or digraph - - ``translation`` -- (default: `None``); several options for this parameter + - ``translation`` -- (default: `None``) several options for this parameter used to specify the mapping from vertices to integers: - ``True``, ``False``, ``None`` -- the `i`-th vertex in the binary matrix diff --git a/src/sage/graphs/bipartite_graph.py b/src/sage/graphs/bipartite_graph.py index 680c24bc0e3..234de73676f 100644 --- a/src/sage/graphs/bipartite_graph.py +++ b/src/sage/graphs/bipartite_graph.py @@ -81,7 +81,7 @@ class BipartiteGraph(Graph): #. From a NetworkX bipartite graph. - - ``partition`` -- (default: ``None``); a tuple defining vertices of the left + - ``partition`` -- (default: ``None``) a tuple defining vertices of the left and right partition of the graph. Partitions will be determined automatically if ``partition`` is ``None``. @@ -658,7 +658,7 @@ def add_vertex(self, name=None, left=False, right=False): INPUT: - - ``name`` -- (default: ``None``); name of the new vertex. If no name is + - ``name`` -- (default: ``None``) name of the new vertex. If no name is specified, then the vertex will be represented by the least nonnegative integer not already representing a vertex. Name must be an immutable object and cannot be ``None``. @@ -757,10 +757,10 @@ def add_vertices(self, vertices, left=False, right=False): - ``vertices`` -- sequence of vertices to add - - ``left`` -- (default: ``False``); either ``True`` or sequence of same + - ``left`` -- (default: ``False``) either ``True`` or sequence of same length as ``vertices`` with ``True``/``False`` elements - - ``right`` -- (default: ``False``); either ``True`` or sequence of the + - ``right`` -- (default: ``False``) either ``True`` or sequence of the same length as ``vertices`` with ``True``/``False`` elements Only one of ``left`` and ``right`` keywords should be provided. See @@ -988,10 +988,10 @@ def add_edge(self, u, v=None, label=None): - ``u`` -- the tail of an edge - - ``v`` -- (default: ``None``); the head of an edge. If ``v=None``, then + - ``v`` -- (default: ``None``) the head of an edge. If ``v=None``, then attempt to understand ``u`` as a edge tuple - - ``label`` -- (default: ``None``); the label of the edge ``(u, v)`` + - ``label`` -- (default: ``None``) the label of the edge ``(u, v)`` The following forms are all accepted: @@ -2268,7 +2268,7 @@ def vertex_cover(self, algorithm='Konig', value_only=False, only the size of a minimum vertex cover is returned. Otherwise, a minimum vertex cover is returned as a list of vertices. - - ``reduction_rules`` -- (default: ``True``); specify if the reductions + - ``reduction_rules`` -- (default: ``True``) specify if the reductions rules from kernelization must be applied as pre-processing or not. See [ACFLSS04]_ for more details. Note that depending on the instance, it might be faster to disable reduction rules. This parameter is @@ -2396,14 +2396,14 @@ def _subgraph_by_adding(self, vertices=None, edges=None, edge_property=None, imm - ``vertices`` -- list (default: ``None``); list of vertices - - ``edges`` -- (default: ``None``); either a single edge or an iterable + - ``edges`` -- (default: ``None``) either a single edge or an iterable container of edges (e.g., a list, set, file, numeric array, etc.). If no edges are specified, then all edges are assumed and the returned graph is an induced subgraph. In the case of multiple edges, specifying an edge as `(u, v)` means to keep all edges `(u, v)`, regardless of the label. - - ``edge_property`` -- (default: ``None``); if specified, this is + - ``edge_property`` -- (default: ``None``) if specified, this is expected to be a function on edges, which is intersected with the edges specified, if any are @@ -2477,7 +2477,7 @@ def _subgraph_by_deleting(self, vertices=None, edges=None, inplace=False, - ``vertices`` -- list (default: ``None``); list of vertices - - ``edges`` -- (default: ``None``); either a single edge or an iterable + - ``edges`` -- (default: ``None``) either a single edge or an iterable container of edges (e.g., a list, set, file, numeric array, etc.). If no edges are specified, then all edges are assumed and the returned graph is an induced subgraph. In the case of multiple edges, @@ -2488,7 +2488,7 @@ def _subgraph_by_deleting(self, vertices=None, edges=None, inplace=False, current graph is modified in place by deleting the extra vertices and edges. Otherwise a modified copy of the graph is returned - - ``edge_property`` -- (default: ``None``); if specified, this is + - ``edge_property`` -- (default: ``None``) if specified, this is expected to be a function on edges, which is intersected with the edges specified, if any are diff --git a/src/sage/graphs/comparability.pyx b/src/sage/graphs/comparability.pyx index fa053e1129d..c28636f27bc 100644 --- a/src/sage/graphs/comparability.pyx +++ b/src/sage/graphs/comparability.pyx @@ -400,7 +400,7 @@ def is_comparability_MILP(g, certificate=False, solver=None, verbose=0): - ``certificate`` -- boolean; whether to return a certificate for yes instances. This method cannot return negative certificates. - - ``solver`` -- (default: ``None``); specify a Linear Program (LP) solver to + - ``solver`` -- (default: ``None``) specify a Linear Program (LP) solver to be used. If set to ``None``, the default one is used. For more information on LP solvers and which default solver is used, see the method :meth:`~sage.numerical.mip.MixedIntegerLinearProgram.solve` of the class @@ -517,7 +517,7 @@ def is_comparability(g, algorithm='greedy', certificate=False, check=True, yes-certificates are indeed transitive. As it is very quick compared to the rest of the operation, it is enabled by default. - - ``solver`` -- (default: ``None``); specify a Linear Program (LP) solver to + - ``solver`` -- (default: ``None``) specify a Linear Program (LP) solver to be used. If set to ``None``, the default one is used. For more information on LP solvers and which default solver is used, see the method :meth:`~sage.numerical.mip.MixedIntegerLinearProgram.solve` of the class @@ -605,7 +605,7 @@ def is_permutation(g, algorithm='greedy', certificate=False, check=True, indeed create the expected Permutation graph. Pretty cheap compared to the rest, hence a good investment. It is enabled by default. - - ``solver`` -- (default: ``None``); specify a Linear Program (LP) solver to + - ``solver`` -- (default: ``None``) specify a Linear Program (LP) solver to be used. If set to ``None``, the default one is used. For more information on LP solvers and which default solver is used, see the method :meth:`~sage.numerical.mip.MixedIntegerLinearProgram.solve` of the class diff --git a/src/sage/graphs/digraph_generators.py b/src/sage/graphs/digraph_generators.py index 16d18b8e58a..02590ac8f7c 100644 --- a/src/sage/graphs/digraph_generators.py +++ b/src/sage/graphs/digraph_generators.py @@ -1276,7 +1276,7 @@ def RandomDirectedAcyclicGraph(self, n, p, weight_max=None): - ``p`` -- probability of an edge - - ``weight_max`` -- (default: ``None``); by default, the returned DAG is + - ``weight_max`` -- (default: ``None``) by default, the returned DAG is unweighted. When ``weight_max`` is set to a positive integer, edges are assigned a random integer weight between ``1`` and ``weight_max``. diff --git a/src/sage/graphs/generators/classical_geometries.py b/src/sage/graphs/generators/classical_geometries.py index 2c751b3fc78..057d3131385 100644 --- a/src/sage/graphs/generators/classical_geometries.py +++ b/src/sage/graphs/generators/classical_geometries.py @@ -569,7 +569,7 @@ def _polar_graph(m, q, g, intersection_size=None): - ``g`` -- the group acting - - ``intersection_size`` -- (default: ``None``); if ``None``, build the graph + - ``intersection_size`` -- (default: ``None``) if ``None``, build the graph on the isotropic points, with adjacency being orthogonality w.r.t. `F`. Otherwise, build the graph on the maximal totally isotropic subspaces, with adjacency specified by ``intersection_size`` being as given. diff --git a/src/sage/graphs/generators/families.py b/src/sage/graphs/generators/families.py index 013487e5291..6e9e7e5f96d 100644 --- a/src/sage/graphs/generators/families.py +++ b/src/sage/graphs/generators/families.py @@ -2728,10 +2728,10 @@ def HanoiTowerGraph(pegs, disks, labels=True, positions=True): - ``pegs`` -- the number of pegs in the puzzle, 2 or greater - ``disks`` -- the number of disks in the puzzle, 1 or greater - - ``labels`` -- default: ``True``, if ``True`` the graph contains + - ``labels`` -- (default: ``True``,) if ``True`` the graph contains more meaningful labels, see explanation below. For large instances, turn off labels for much faster creation of the graph. - - ``positions`` -- default: ``True``, if ``True`` the graph contains + - ``positions`` -- (default: ``True``,) if ``True`` the graph contains layout information. This creates a planar layout for the case of three pegs. For large instances, turn off layout information for much faster creation of the graph. diff --git a/src/sage/graphs/generic_graph.py b/src/sage/graphs/generic_graph.py index 3b5f1640625..0e673698400 100644 --- a/src/sage/graphs/generic_graph.py +++ b/src/sage/graphs/generic_graph.py @@ -2606,7 +2606,7 @@ def weighted_adjacency_matrix(self, sparse=True, vertices=None, used to specify an ordering, or a :class:`TypeError` exception will be raised. - - ``default_weight`` -- (default: ``None``); specifies the weight to + - ``default_weight`` -- (default: ``None``) specifies the weight to replace any ``None`` edge label. When not specified an error is raised if the label of an edge is ``None``. @@ -14059,7 +14059,7 @@ def _subgraph_by_adding(self, vertices=None, edges=None, edge_property=None, imm INPUT: - - ``vertices`` -- (default: ``None``); an iterable container of + - ``vertices`` -- (default: ``None``) an iterable container of vertices, e.g. a list, set, graph, file or numeric array. If not passed (i.e., ``None``), defaults to the entire graph. @@ -14225,7 +14225,7 @@ def _subgraph_by_deleting(self, vertices=None, edges=None, inplace=False, INPUT: - - ``vertices`` -- (default: ``None``); an iterable container of + - ``vertices`` -- (default: ``None``) an iterable container of vertices, e.g. a list, set, graph, file or numeric array. If not passed (i.e., ``None``), defaults to the entire graph. @@ -20598,16 +20598,16 @@ def layout_circular(self, dim=2, center=(0, 0), radius=1, shift=0, angle=0, **op - ``center`` -- tuple (default: ``(0, 0)``); position of the center of the circle - - ``radius`` -- (default: 1); the radius of the circle + - ``radius`` -- (default: 1) the radius of the circle - - ``shift`` -- (default: 0); rotation of the circle. A value of + - ``shift`` -- (default: 0) rotation of the circle. A value of ``shift=1`` will replace in the drawing the `i`-th element of the list by the `(i-1)`-th. Non-integer values are admissible, and a value of `\alpha` corresponds to a rotation of the circle by an angle of `\alpha 2\pi/n` (where `n` is the number of vertices set on the circle). - - ``angle`` -- (default: 0); rotate the embedding of all vertices. For + - ``angle`` -- (default: 0) rotate the embedding of all vertices. For instance, when ``angle == 0``, the first vertex get position ``(center[0] + radius, center[1])``. With a value of `\pi/2`, the first vertex get position ``(center[0], center[1] + radius)``. @@ -21065,16 +21065,16 @@ def _circle_embedding(self, vertices, center=(0, 0), radius=1, shift=0, angle=0, - ``center`` -- tuple (default: `(0, 0)`); position of the center of the circle - - ``radius`` -- (default: 1); the radius of the circle + - ``radius`` -- (default: 1) the radius of the circle - - ``shift`` -- (default: 0); rotation of the circle. A value of + - ``shift`` -- (default: 0) rotation of the circle. A value of ``shift=1`` will replace in the drawing the `i`-th element of the list by the `(i-1)`-th. Non-integer values are admissible, and a value of `\alpha` corresponds to a rotation of the circle by an angle of `\alpha 2\pi/n` (where `n` is the number of vertices set on the circle). - - ``angle`` -- (default: 0); rotate the embedding of all vertices. For + - ``angle`` -- (default: 0) rotate the embedding of all vertices. For instance, when ``angle == 0``, the first vertex get position ``(center[0] + radius, center[1])``. With a value of `\pi/2`, the first vertex get position ``(center[0], center[1] + radius)``. @@ -22090,7 +22090,7 @@ def graphviz_string(self, **options): - ``edge_labels`` -- boolean (default: ``False``); whether to add the labels on edges - - ``edge_color`` -- (default: ``None``); specify a default color for the + - ``edge_color`` -- (default: ``None``) specify a default color for the edges. The color could be one of - a name given as a string such as ``'blue'`` or ``'orchid'`` @@ -22849,7 +22849,7 @@ def characteristic_polynomial(self, var='x', laplacian=False): INPUT: - - ``x`` -- (default: ``'x'``); the variable of the characteristic + - ``x`` -- (default: ``'x'``) the variable of the characteristic polynomial - ``laplacian`` -- boolean (default: ``False``); if ``True``, use the @@ -25573,7 +25573,7 @@ def graph_isom_equivalent_non_edge_labeled_graph(g, partition=None, standard_lab vertices as a list of lists of vertices. If given, the partition of the vertices is as well relabeled - - ``standard_label`` -- (default: ``None``); edges in ``g`` with + - ``standard_label`` -- (default: ``None``) edges in ``g`` with this label are preserved in the new graph - ``return_relabeling`` -- boolean (default: ``False``); whether diff --git a/src/sage/graphs/graph.py b/src/sage/graphs/graph.py index 0e099301e86..0e4a3598bc5 100644 --- a/src/sage/graphs/graph.py +++ b/src/sage/graphs/graph.py @@ -4341,7 +4341,7 @@ def is_factor_critical(self, matching=None, algorithm='Edmonds', solver=None, ve INPUT: - - ``matching`` -- (default: ``None``); a near perfect matching of the + - ``matching`` -- (default: ``None``) a near perfect matching of the graph, that is a matching such that all vertices of the graph but one are incident to an edge of the matching. It can be given using any valid input format of :class:`~sage.graphs.graph.Graph`. @@ -4657,7 +4657,7 @@ def fractional_clique_number(self, solver='PPL', verbose=0, INPUT: - - ``solver`` -- (default: ``'PPL'``); specify a Linear Program (LP) + - ``solver`` -- (default: ``'PPL'``) specify a Linear Program (LP) solver to be used. If set to ``None``, the default one is used. For more information on LP solvers and which default solver is used, see the method :meth:`solve @@ -4714,7 +4714,7 @@ def maximum_average_degree(self, value_only=True, solver=None, verbose=0): - Else, the subgraph of `G` realizing the `MAD` is returned. - - ``solver`` -- (default: ``None``); specify a Linear Program (LP) + - ``solver`` -- (default: ``None``) specify a Linear Program (LP) solver to be used. If set to ``None``, the default one is used. For more information on LP solvers and which default solver is used, see the method @@ -7088,7 +7088,7 @@ def independent_set(self, algorithm='Cliquer', value_only=False, reduction_rules only the size of a maximum independent set is returned. Otherwise, a maximum independent set is returned as a list of vertices. - - ``reduction_rules`` -- (default: ``True``); specify if the reductions + - ``reduction_rules`` -- (default: ``True``) specify if the reductions rules from kernelization must be applied as pre-processing or not. See [ACFLSS04]_ for more details. Note that depending on the instance, it might be faster to disable reduction rules. @@ -7184,7 +7184,7 @@ def vertex_cover(self, algorithm='Cliquer', value_only=False, only the size of a minimum vertex cover is returned. Otherwise, a minimum vertex cover is returned as a list of vertices. - - ``reduction_rules`` -- (default: ``True``); specify if the reductions + - ``reduction_rules`` -- (default: ``True``) specify if the reductions rules from kernelization must be applied as pre-processing or not. See [ACFLSS04]_ for more details. Note that depending on the instance, it might be faster to disable reduction rules. diff --git a/src/sage/graphs/graph_coloring.pyx b/src/sage/graphs/graph_coloring.pyx index 673e38daca0..c5432cdceed 100644 --- a/src/sage/graphs/graph_coloring.pyx +++ b/src/sage/graphs/graph_coloring.pyx @@ -750,7 +750,7 @@ def fractional_chromatic_number(G, solver='PPL', verbose=0, - ``G`` -- a graph - - ``solver`` -- (default: ``'PPL'``); specify a Linear Program (LP) solver + - ``solver`` -- (default: ``'PPL'``) specify a Linear Program (LP) solver to be used. If set to ``None``, the default one is used. For more information on LP solvers and which default solver is used, see the method :meth:`solve ` of the @@ -861,7 +861,7 @@ def fractional_chromatic_index(G, solver='PPL', verbose_constraints=False, verbo - ``G`` -- a graph - - ``solver`` -- (default: ``'PPL'``); specify a Linear Program (LP) solver + - ``solver`` -- (default: ``'PPL'``) specify a Linear Program (LP) solver to be used. If set to ``None``, the default one is used. For more information on LP solvers and which default solver is used, see the method :meth:`solve ` of the diff --git a/src/sage/graphs/graph_database.py b/src/sage/graphs/graph_database.py index 6dec05bc129..ba737855c7e 100644 --- a/src/sage/graphs/graph_database.py +++ b/src/sage/graphs/graph_database.py @@ -268,7 +268,7 @@ def __init__(self, query_string, database=None, param_tuple=None): - ``query_string`` -- string representing the SQL query - - ``database`` -- (default: ``None``); the :class:`~GraphDatabase` + - ``database`` -- (default: ``None``) the :class:`~GraphDatabase` instance to query (if ``None`` then a new instance is created) - ``param_tuple`` -- tuple of strings (default: ``None``); what to diff --git a/src/sage/graphs/graph_generators.py b/src/sage/graphs/graph_generators.py index dae69bd69bb..aeb9c477e97 100644 --- a/src/sage/graphs/graph_generators.py +++ b/src/sage/graphs/graph_generators.py @@ -1550,7 +1550,7 @@ def fullerenes(self, order, ipr=False): - ``order`` -- a positive even integer smaller than or equal to 254 This specifies the number of vertices in the generated fullerenes - - ``ipr`` -- (default: ``False``); if ``True`` only fullerenes that + - ``ipr`` -- (default: ``False``) if ``True`` only fullerenes that satisfy the Isolated Pentagon Rule are generated. This means that no pentagonal faces share an edge. @@ -1659,7 +1659,7 @@ def fusenes(self, hexagon_count, benzenoids=False): - ``hexagon_count`` -- positive integer smaller than or equal to 30; this specifies the number of hexagons in the generated benzenoids - - ``benzenoids`` -- (default: ``False``); if ``True`` only benzenoids are + - ``benzenoids`` -- (default: ``False``) if ``True`` only benzenoids are generated OUTPUT: @@ -1948,21 +1948,21 @@ def planar_graphs(self, order, minimum_degree=None, - ``order`` -- positive integer smaller than or equal to 64; this specifies the number of vertices in the generated graphs - - ``minimum_degree`` -- (default: ``None``); a value `\geq 1` and `\leq + - ``minimum_degree`` -- (default: ``None``) a value `\geq 1` and `\leq 5`, or ``None``. This specifies the minimum degree of the generated graphs. If this is ``None`` and the order is 1, then this is set to 0. If this is ``None`` and the minimum connectivity is specified, then this is set to the same value as the minimum connectivity. If the minimum connectivity is also equal to ``None``, then this is set to 1. - - ``minimum_connectivity`` -- (default: ``None``); a value `\geq 1` + - ``minimum_connectivity`` -- (default: ``None``) a value `\geq 1` and `\leq 3`, or ``None``. This specifies the minimum connectivity of the generated graphs. If this is ``None`` and the minimum degree is specified, then this is set to the minimum of the minimum degree and 3. If the minimum degree is also equal to ``None``, then this is set to 1. - - ``exact_connectivity`` -- (default: ``False``); if ``True`` only + - ``exact_connectivity`` -- (default: ``False``) if ``True`` only graphs with exactly the specified connectivity will be generated. This option cannot be used with ``minimum_connectivity=3``, or if the minimum connectivity is not explicitly set. @@ -1976,11 +1976,11 @@ def planar_graphs(self, order, minimum_degree=None, - ``maximum_face_size`` -- integer (default: ``None``); upper bound on the size of a face and so on the maximum degree of the dual graph - - ``only_bipartite`` -- (default: ``False``); if ``True`` only bipartite + - ``only_bipartite`` -- (default: ``False``) if ``True`` only bipartite graphs will be generated. This option cannot be used for graphs with a minimum degree larger than 3. - - ``dual`` -- (default: ``False``); if ``True`` return instead the + - ``dual`` -- (default: ``False``) if ``True`` return instead the planar duals of the generated graphs OUTPUT: @@ -2177,30 +2177,30 @@ def triangulations(self, order, minimum_degree=None, minimum_connectivity=None, - ``order`` -- positive integer smaller than or equal to 64; this specifies the number of vertices in the generated triangulations - - ``minimum_degree`` -- (default: ``None``); a value `\geq 3` and `\leq 5`, + - ``minimum_degree`` -- (default: ``None``) a value `\geq 3` and `\leq 5`, or ``None``. This specifies the minimum degree of the generated triangulations. If this is ``None`` and the minimum connectivity is specified, then this is set to the same value as the minimum connectivity. If the minimum connectivity is also equal to ``None``, then this is set to 3. - - ``minimum_connectivity`` -- (default: ``None``); a value `\geq 3` and + - ``minimum_connectivity`` -- (default: ``None``) a value `\geq 3` and `\leq 5`, or ``None``. This specifies the minimum connectivity of the generated triangulations. If this is ``None`` and the minimum degree is specified, then this is set to the minimum of the minimum degree and 3. If the minimum degree is also equal to ``None``, then this is set to 3. - - ``exact_connectivity`` -- (default: ``False``); if ``True`` only + - ``exact_connectivity`` -- (default: ``False``) if ``True`` only triangulations with exactly the specified connectivity will be generated. This option cannot be used with ``minimum_connectivity=3``, or if the minimum connectivity is not explicitly set. - - ``only_eulerian`` -- (default: ``False``); if ``True`` only Eulerian + - ``only_eulerian`` -- (default: ``False``) if ``True`` only Eulerian triangulations will be generated. This option cannot be used if the minimum degree is explicitly set to anything else than 4. - - ``dual`` -- (default: ``False``); if ``True`` return instead the + - ``dual`` -- (default: ``False``) if ``True`` return instead the planar duals of the generated graphs OUTPUT: @@ -2363,14 +2363,14 @@ def quadrangulations(self, order, minimum_degree=None, minimum_connectivity=None - ``order`` -- positive integer smaller than or equal to 64; this specifies the number of vertices in the generated quadrangulations - - ``minimum_degree`` -- default: ``None``; a value `\geq 2` and `\leq + - ``minimum_degree`` -- (default: ``None``) a value `\geq 2` and `\leq 3`, or ``None``. This specifies the minimum degree of the generated quadrangulations. If this is ``None`` and the minimum connectivity is specified, then this is set to the same value as the minimum connectivity. If the minimum connectivity is also equal to ``None``, then this is set to 2. - - ``minimum_connectivity`` -- default: ``None``; a value `\geq 2` and + - ``minimum_connectivity`` -- (default: ``None``) a value `\geq 2` and `\leq 3`, or ``None``. This specifies the minimum connectivity of the generated quadrangulations. If this is ``None`` and the option ``no_nonfacial_quadrangles`` is set to ``True``, then this is set to @@ -2378,11 +2378,11 @@ def quadrangulations(self, order, minimum_degree=None, minimum_connectivity=None then this is set to the minimum degree. If the minimum degree is also equal to ``None``, then this is set to 3. - - ``no_nonfacial_quadrangles`` -- default: ``False``; if ``True`` only + - ``no_nonfacial_quadrangles`` -- (default: ``False``) if ``True`` only quadrangulations with no non-facial quadrangles are generated. This option cannot be used if ``minimum_connectivity`` is set to 2. - - ``dual`` -- default: ``False``; if ``True`` return instead the + - ``dual`` -- (default: ``False``) if ``True`` return instead the planar duals of the generated graphs OUTPUT: diff --git a/src/sage/graphs/graph_latex.py b/src/sage/graphs/graph_latex.py index ee423411cc1..341107add2c 100644 --- a/src/sage/graphs/graph_latex.py +++ b/src/sage/graphs/graph_latex.py @@ -677,7 +677,7 @@ def set_option(self, option_name, option_value=None): pre-built style and modify it (other than editing the latex string by hand after the fact). - - ``vertex_color`` -- (default: ``'black'``); a single color to use as + - ``vertex_color`` -- (default: ``'black'``) a single color to use as the default for outline of vertices. For the ``sphere`` shape this color is used for the entire vertex, which is drawn with a 3D shading. Colors must be specified as a string recognized by the matplotlib @@ -694,7 +694,7 @@ def set_option(self, option_name, option_value=None): proper subset of the vertices. Specified values will supersede a default value. - - ``vertex_fill_color`` -- (default: ``'white'``); a single color to use + - ``vertex_fill_color`` -- (default: ``'white'``) a single color to use as the default for the fill color of vertices. See the explanation above for the ``vertex_color`` option to see possible values. This color is ignored for the ``sphere`` vertex shape. @@ -738,7 +738,7 @@ def set_option(self, option_name, option_value=None): representation according to the ``_repr`` method. Support for arbitrarily-complicated mathematics is not especially robust. - - ``vertex_label_color`` -- (default: ``'black'``); a single color to + - ``vertex_label_color`` -- (default: ``'black'``) a single color to use as the default for labels of vertices. See the explanation above for the ``vertex_color`` option to see possible values. @@ -749,7 +749,7 @@ def set_option(self, option_name, option_value=None): be specified for a proper subset of the vertices. Specified values will supersede a default value. - - ``vertex_label_placement`` -- (default: ``'center'``); if ``'center'`` + - ``vertex_label_placement`` -- (default: ``'center'``) if ``'center'`` the label is centered in the interior of the vertex and the vertex will expand to contain the label. Giving instead a pair of numbers will place the label exterior to the vertex at a certain distance from @@ -760,7 +760,7 @@ def set_option(self, option_name, option_value=None): the vertices. See the explanation for ``vertex_label_placement`` for the possible values. - - ``edge_color`` -- (default: ``'black'``); a single color to use as the + - ``edge_color`` -- (default: ``'black'``) a single color to use as the default for an edge. See the explanation above for the ``vertex_color`` option to see possible values. @@ -774,7 +774,7 @@ def set_option(self, option_name, option_value=None): second color running down the middle. This can be a useful effect for highlighting edge crossings. - - ``edge_fill_color`` -- (default: ``'black'``); a single color to use + - ``edge_fill_color`` -- (default: ``'black'``) a single color to use as the default for the fill color of an edge. The boolean switch ``edge_fills`` must be set to ``True`` for this to have an effect. See the explanation above for the ``vertex_color`` option to see possible @@ -804,7 +804,7 @@ def set_option(self, option_name, option_value=None): ``vertex_labels_math`` option, which behaves identically. Support for arbitrarily-complicated mathematics is not especially robust. - - ``edge_label_color`` -- (default: ``'black'``); a single color to use + - ``edge_label_color`` -- (default: ``'black'``) a single color to use as the default for labels of edges. See the explanation above for the ``vertex_color`` option to see possible values. @@ -826,7 +826,7 @@ def set_option(self, option_name, option_value=None): subset of the edges. See the ``edge_label_sloped`` option for a description of sloped edge labels. - - ``edge_label_placement`` -- (default: 0.50); either a number between + - ``edge_label_placement`` -- (default: 0.50) either a number between 0.0 and 1.0, or one of: ``'above'``, ``'below'``, ``'left'``, ``'right'``. These adjust the location of an edge label along an edge. A number specifies how far along the edge the label is located. diff --git a/src/sage/graphs/hyperbolicity.pyx b/src/sage/graphs/hyperbolicity.pyx index 11794e9839b..c24c8d3334f 100644 --- a/src/sage/graphs/hyperbolicity.pyx +++ b/src/sage/graphs/hyperbolicity.pyx @@ -1071,7 +1071,7 @@ def hyperbolicity(G, - ``G`` -- a connected Graph - - ``algorithm`` -- (default: ``'BCCM'``); specifies the algorithm to use + - ``algorithm`` -- (default: ``'BCCM'``) specifies the algorithm to use among: - ``'basic'`` is an exhaustive algorithm considering all possible diff --git a/src/sage/graphs/traversals.pyx b/src/sage/graphs/traversals.pyx index c9aabb41ae1..879e550dfc2 100644 --- a/src/sage/graphs/traversals.pyx +++ b/src/sage/graphs/traversals.pyx @@ -240,7 +240,7 @@ def lex_BFS(G, reverse=False, tree=False, initial_vertex=None, algorithm='fast') discovery directed tree (each vertex being linked to the one that saw it for the first time) - - ``initial_vertex`` -- (default: ``None``); the first vertex to + - ``initial_vertex`` -- (default: ``None``) the first vertex to consider - ``algorithm`` -- string (default: ``'fast'``); algorithm to use among: @@ -493,7 +493,7 @@ def lex_UP(G, reverse=False, tree=False, initial_vertex=None): discovery directed tree (each vertex being linked to the one that saw it for the first time) - - ``initial_vertex`` -- (default: ``None``); the first vertex to + - ``initial_vertex`` -- (default: ``None``) the first vertex to consider ALGORITHM: @@ -666,7 +666,7 @@ def lex_DFS(G, reverse=False, tree=False, initial_vertex=None): discovery directed tree (each vertex being linked to the one that saw it for the first time) - - ``initial_vertex`` -- (default: ``None``); the first vertex to + - ``initial_vertex`` -- (default: ``None``) the first vertex to consider ALGORITHM: @@ -839,7 +839,7 @@ def lex_DOWN(G, reverse=False, tree=False, initial_vertex=None): discovery directed tree (each vertex being linked to the one that saw it for the first time) - - ``initial_vertex`` -- (default: ``None``); the first vertex to + - ``initial_vertex`` -- (default: ``None``) the first vertex to consider ALGORITHM: @@ -1020,7 +1020,7 @@ def lex_M(self, triangulation=False, labels=False, initial_vertex=None, algorith - ``labels`` -- boolean (default: ``False``); whether to return the labels assigned to each vertex - - ``initial_vertex`` -- (default: ``None``); the first vertex to + - ``initial_vertex`` -- (default: ``None``) the first vertex to consider - ``algorithm`` -- string (default: ``None``); one of the following @@ -1180,7 +1180,7 @@ def lex_M_slow(G, triangulation=False, labels=False, initial_vertex=None): - ``labels`` -- boolean (default: ``False``); whether to return the labels assigned to each vertex - - ``initial_vertex`` -- (default: ``None``); the first vertex to + - ``initial_vertex`` -- (default: ``None``) the first vertex to consider. If not specified, an arbitrary vertex is chosen. OUTPUT: @@ -1333,7 +1333,7 @@ def lex_M_fast(G, triangulation=False, initial_vertex=None): - ``triangulation`` -- boolean (default: ``False``); whether to return the triangulation of given graph produced by the method - - ``initial_vertex`` -- (default: ``None``); the first vertex to consider + - ``initial_vertex`` -- (default: ``None``) the first vertex to consider OUTPUT: @@ -1603,7 +1603,7 @@ def maximum_cardinality_search(G, reverse=False, tree=False, initial_vertex=None discovery directed tree (each vertex being linked to the one that saw it for the first time) - - ``initial_vertex`` -- (default: ``None``); the first vertex to consider + - ``initial_vertex`` -- (default: ``None``) the first vertex to consider OUTPUT: @@ -1931,7 +1931,7 @@ def maximum_cardinality_search_M(G, initial_vertex=None): - ``G`` -- a Sage graph - - ``initial_vertex`` -- (default: ``None``); the first vertex to consider + - ``initial_vertex`` -- (default: ``None``) the first vertex to consider OUTPUT: a tuple `(\alpha, F, X)`, where diff --git a/src/sage/groups/finitely_presented.py b/src/sage/groups/finitely_presented.py index 376d0c96199..909d10b987b 100644 --- a/src/sage/groups/finitely_presented.py +++ b/src/sage/groups/finitely_presented.py @@ -1375,7 +1375,7 @@ def abelianization_to_algebra(self, ring=QQ): INPUT: - - ``ring`` -- (default: ``QQ``); the base ring for + - ``ring`` -- (default: ``QQ``) the base ring for the group algebra of ``self`` OUTPUT: diff --git a/src/sage/groups/perm_gps/permgroup.py b/src/sage/groups/perm_gps/permgroup.py index ac6c52760fa..cd25598ef48 100644 --- a/src/sage/groups/perm_gps/permgroup.py +++ b/src/sage/groups/perm_gps/permgroup.py @@ -3018,7 +3018,7 @@ def as_finitely_presented_group(self, reduced=False): INPUT: - - ``reduced`` -- (default: ``False``); if ``True``, + - ``reduced`` -- (default: ``False``) if ``True``, :meth:`FinitelyPresentedGroup.simplified ` is called, attempting to simplify the presentation of the finitely presented group to be returned diff --git a/src/sage/interfaces/giac.py b/src/sage/interfaces/giac.py index dcf375c0467..49df44c1c45 100644 --- a/src/sage/interfaces/giac.py +++ b/src/sage/interfaces/giac.py @@ -1146,9 +1146,9 @@ def integral(self, var='x', min=None, max=None): - ``var`` -- variable - - ``min`` -- default: ``None`` + - ``min`` -- (default: ``None``) - - ``max`` -- default: ``None`` + - ``max`` -- (default: ``None``) This returns the definite integral if xmin is not ``None``, otherwise an indefinite integral. @@ -1184,9 +1184,9 @@ def sum(self, var, min=None, max=None): - ``var`` -- variable - - ``min`` -- default: ``None`` + - ``min`` -- (default: ``None``) - - ``max`` -- default: ``None`` + - ``max`` -- (default: ``None``) This returns the definite integral if xmin is not ``None``, otherwise an indefinite integral. diff --git a/src/sage/interfaces/gp.py b/src/sage/interfaces/gp.py index 99dfd60b4a3..b98c050d889 100644 --- a/src/sage/interfaces/gp.py +++ b/src/sage/interfaces/gp.py @@ -474,7 +474,7 @@ def cputime(self, t=None): INPUT: - - ``t`` -- (default: ``None``); if not None, then returns + - ``t`` -- (default: ``None``) if not None, then returns time since t diff --git a/src/sage/interfaces/maxima_abstract.py b/src/sage/interfaces/maxima_abstract.py index a560f2e8297..70ea4195d69 100644 --- a/src/sage/interfaces/maxima_abstract.py +++ b/src/sage/interfaces/maxima_abstract.py @@ -1546,9 +1546,9 @@ def integral(self, var='x', min=None, max=None): - ``var`` -- variable - - ``min`` -- default: ``None`` + - ``min`` -- (default: ``None``) - - ``max`` -- default: ``None`` + - ``max`` -- (default: ``None``) OUTPUT: the definite integral if xmin is not ``None`` diff --git a/src/sage/interfaces/singular.py b/src/sage/interfaces/singular.py index b905235c880..9717cf46b19 100644 --- a/src/sage/interfaces/singular.py +++ b/src/sage/interfaces/singular.py @@ -581,7 +581,7 @@ def eval(self, x, allow_semicolon=True, strip=True, **kwds): - ``x`` -- string (of code) - - ``allow_semicolon`` -- default: ``False``; if False then + - ``allow_semicolon`` -- (default: ``False``) if ``False`` then raise a :class:`TypeError` if the input line contains a semicolon - ``strip`` -- ignored @@ -1700,13 +1700,13 @@ def sage_poly(self, R=None, kcache=None): INPUT: - - ``R`` -- (default: ``None``); an optional polynomial ring. + - ``R`` -- (default: ``None``) an optional polynomial ring. If it is provided, then you have to make sure that it matches the current singular ring as, e.g., returned by - singular.current_ring(). By default, the output of + ``singular.current_ring()``. By default, the output of :meth:`sage_global_ring` is used. - - ``kcache`` -- (default: ``None``); an optional dictionary + - ``kcache`` -- (default: ``None``) an optional dictionary for faster finite field lookups, this is mainly useful for finite extension fields @@ -1909,7 +1909,7 @@ def sage_matrix(self, R, sparse=True): INPUT: - - ``R`` -- (default: ``None``); an optional ring, over which + - ``R`` -- (default: ``None``) an optional ring, over which the resulting matrix is going to be defined. By default, the output of :meth:`sage_global_ring` is used. diff --git a/src/sage/knots/knotinfo.py b/src/sage/knots/knotinfo.py index 386e795782e..57b5e2fc8d8 100644 --- a/src/sage/knots/knotinfo.py +++ b/src/sage/knots/knotinfo.py @@ -2399,15 +2399,15 @@ def list(self, oriented=False, comp=None, det=None, homfly=None): unoriented name. To obtain the list of the individual links this keyword has to be set to ``True``. - - ``comp`` -- (default: ``None``); if given an integer for this + - ``comp`` -- (default: ``None``) if given an integer for this keyword the list is restriced to links having the according number of components. This keyword implies ``oriented=True``. - - ``det`` -- (default: ``None``); if given an integer for this + - ``det`` -- (default: ``None``) if given an integer for this keyword the list is restriced to links having the according value for its determinant. This keyword implies ``oriented=True``. - - ``homfly`` -- (default: ``None``); if given a HOMFLY-PT polynomial + - ``homfly`` -- (default: ``None``) if given a HOMFLY-PT polynomial having ``normalization='vz'`` for this keyword the list is restriced to links having the according value for its HOMFLY-PT polynomial. This keyword implies ``oriented=True``. diff --git a/src/sage/manifolds/differentiable/manifold.py b/src/sage/manifolds/differentiable/manifold.py index bc896cc2e32..d4bc1399286 100644 --- a/src/sage/manifolds/differentiable/manifold.py +++ b/src/sage/manifolds/differentiable/manifold.py @@ -744,7 +744,7 @@ def open_subset(self, name, latex_name=None, coord_def={}, supersets=None): INPUT: - ``name`` -- name given to the open subset - - ``latex_name`` -- (default: ``None``); LaTeX symbol to denote the + - ``latex_name`` -- (default: ``None``) LaTeX symbol to denote the subset; if none is provided, it is set to ``name`` - ``coord_def`` -- (default: {}) definition of the subset in terms of coordinates; ``coord_def`` must a be dictionary with keys diff --git a/src/sage/manifolds/differentiable/pseudo_riemannian_submanifold.py b/src/sage/manifolds/differentiable/pseudo_riemannian_submanifold.py index 99dff4bd760..4972d05b9da 100644 --- a/src/sage/manifolds/differentiable/pseudo_riemannian_submanifold.py +++ b/src/sage/manifolds/differentiable/pseudo_riemannian_submanifold.py @@ -419,7 +419,7 @@ def open_subset(self, name, latex_name=None, coord_def={}, supersets=None): INPUT: - ``name`` -- name given to the open subset - - ``latex_name`` -- (default: ``None``); LaTeX symbol to denote the + - ``latex_name`` -- (default: ``None``) LaTeX symbol to denote the subset; if none is provided, it is set to ``name`` - ``coord_def`` -- (default: {}) definition of the subset in terms of coordinates; ``coord_def`` must a be dictionary with keys diff --git a/src/sage/matrix/matrix1.pyx b/src/sage/matrix/matrix1.pyx index e652db911b1..88aaace2af2 100644 --- a/src/sage/matrix/matrix1.pyx +++ b/src/sage/matrix/matrix1.pyx @@ -1487,7 +1487,7 @@ cdef class Matrix(Matrix0): - ``bottom`` -- a matrix, vector or free module element, whose dimensions are compatible with ``self`` - - ``subdivide`` -- (default: ``False``); request the resulting + - ``subdivide`` -- (default: ``False``) request the resulting matrix to have a new subdivision, separating ``self`` from ``bottom`` OUTPUT: @@ -1777,7 +1777,7 @@ cdef class Matrix(Matrix0): - ``right`` -- a matrix, vector or free module element, whose dimensions are compatible with ``self`` - - ``subdivide`` -- (default: ``False``); request the resulting + - ``subdivide`` -- (default: ``False``) request the resulting matrix to have a new subdivision, separating ``self`` from ``right``. diff --git a/src/sage/matrix/matrix2.pyx b/src/sage/matrix/matrix2.pyx index 619742c0c73..545882512b3 100644 --- a/src/sage/matrix/matrix2.pyx +++ b/src/sage/matrix/matrix2.pyx @@ -2780,9 +2780,8 @@ cdef class Matrix(Matrix1): INPUT: - - ``phi`` -- a morphism, so phi is callable and - phi.domain() and phi.codomain() are defined. The codomain must be a - ring. + - ``phi`` -- a morphism, so ``phi`` is callable and ``phi.domain()`` + and ``phi.codomain()`` are defined. The codomain must be a ring OUTPUT: a matrix over the codomain of phi @@ -4108,7 +4107,7 @@ cdef class Matrix(Matrix1): INPUT: - - ``algorithm`` -- (default: ``'default'``); a keyword that selects the + - ``algorithm`` -- (default: ``'default'``) a keyword that selects the algorithm employed. Allowable values are: - ``'default'`` -- allows the algorithm to be chosen automatically @@ -4121,7 +4120,7 @@ cdef class Matrix(Matrix1): over the rationals and integers - ``'pluq'`` -- PLUQ matrix factorization for matrices mod 2 - - ``basis`` -- (default: ``'default'``); a keyword that describes + - ``basis`` -- (default: ``'default'``) a keyword that describes the format of the basis returned. Allowable values are: - 'default': uses 'echelon' over fields; 'computed' otherwise. @@ -4806,7 +4805,7 @@ cdef class Matrix(Matrix1): INPUT: - - ``algorithm`` -- (default: ``'default'``); a keyword that selects the + - ``algorithm`` -- (default: ``'default'``) a keyword that selects the algorithm employed. Allowable values are: - ``'default'`` -- allows the algorithm to be chosen automatically @@ -4819,7 +4818,7 @@ cdef class Matrix(Matrix1): over the rationals and integers - ``'pluq'`` -- PLUQ matrix factorization for matrices mod 2 - - ``basis`` -- (default: ``'echelon'``); a keyword that describes the + - ``basis`` -- (default: ``'echelon'``) a keyword that describes the format of the basis used to construct the right kernel. Allowable values are: @@ -5174,7 +5173,7 @@ cdef class Matrix(Matrix1): INPUT: - - ``algorithm`` -- (default: ``'default'``); a keyword that selects the + - ``algorithm`` -- (default: ``'default'``) a keyword that selects the algorithm employed. Allowable values are: - ``'default'`` -- allows the algorithm to be chosen automatically @@ -5187,7 +5186,7 @@ cdef class Matrix(Matrix1): over the rationals and integers - ``'pluq'`` -- PLUQ matrix factorization for matrices mod 2 - - ``basis`` -- (default: ``'echelon'``); a keyword that describes + - ``basis`` -- (default: ``'echelon'``) a keyword that describes the format of the basis used to construct the left kernel. Allowable values are: @@ -6633,7 +6632,7 @@ cdef class Matrix(Matrix1): - ``self`` -- a square matrix over an exact field. For inexact matrices consult the numerical or symbolic matrix classes - - ``format`` -- default: ``None`` + - ``format`` -- (default: ``None``) - ``'all'`` -- attempts to create every eigenspace. This will always be possible for matrices with rational entries @@ -6644,7 +6643,7 @@ cdef class Matrix(Matrix1): in an algebraically closed field which is implemented. Otherwise, uses the 'galois' format. - - ``var`` -- (default: ``'a'``); variable name used to + - ``var`` -- (default: ``'a'``) variable name used to represent elements of the root field of each irreducible factor of the characteristic polynomial. If var='a', then the root fields will be in terms of @@ -6652,7 +6651,7 @@ cdef class Matrix(Matrix1): the irreducible factors of the characteristic polynomial, even for linear factors. - - ``algebraic_multiplicity`` -- (default: ``False``); whether or + - ``algebraic_multiplicity`` -- (default: ``False``) whether or not to include the algebraic multiplicity of each eigenvalue in the output. See the discussion below. @@ -9433,7 +9432,7 @@ cdef class Matrix(Matrix1): INPUT: - ``A`` -- a matrix - - ``subdivide`` -- (default: ``True``); whether or not to return + - ``subdivide`` -- (default: ``True``) whether or not to return natural subdivisions with the matrix OUTPUT: @@ -10486,7 +10485,7 @@ cdef class Matrix(Matrix1): INPUT: - - ``full`` -- (default: ``True``); if ``True`` then the + - ``full`` -- (default: ``True``) if ``True`` then the returned matrices have dimensions as described below. If ``False`` the ``R`` matrix has no zero rows and the columns of ``Q`` are a basis for the column space of @@ -10928,7 +10927,7 @@ cdef class Matrix(Matrix1): INPUT: - ``self`` -- a matrix whose rows are to be orthogonalized - - ``orthonormal`` -- (default: ``False``); if ``True`` the + - ``orthonormal`` -- (default: ``False``) if ``True`` the returned orthogonal vectors are unit vectors. This keyword is ignored if the matrix is over ``RDF`` or ``CDF`` and the results are always orthonormal. @@ -12185,7 +12184,7 @@ cdef class Matrix(Matrix1): - ``other`` -- a matrix, which should be square, and of the same size as ``self`` - - ``transformation`` -- (default: ``False``); if ``True``, the output + - ``transformation`` -- (default: ``False``) if ``True``, the output may include the change-of-basis matrix (also known as the similarity transformation). See below for an exact description. @@ -12737,7 +12736,7 @@ cdef class Matrix(Matrix1): - ``v`` -- a vector with a degree equal to the size of the matrix and entries compatible with the entries of the matrix - - ``var`` -- (default: ``None``); if specified as a string or + - ``var`` -- (default: ``None``) if specified as a string or a generator of a polynomial ring, then this will be used to construct a polynomial reflecting a relation of linear dependence on the powers `A^iv` *and* this will cause @@ -12745,7 +12744,7 @@ cdef class Matrix(Matrix1): A generator must create polynomials with coefficients from the same field as the matrix entries. - - ``basis`` -- (default: ``echelon``); the basis for the + - ``basis`` -- (default: ``echelon``) the basis for the subspace is "echelonized" by default, but the keyword 'iterates' will return a subspace with a user basis equal to the largest linearly independent @@ -13922,7 +13921,7 @@ cdef class Matrix(Matrix1): - ``algorithm`` -- ``'symmetric'`` or ``'hermitian'``, according to the corresponding property of the matrix - - ``check`` -- (default: ``True``); if ``True`` then + - ``check`` -- (default: ``True``) if ``True`` then performs the check that the matrix is consistent with the ``algorithm`` keyword @@ -14184,7 +14183,7 @@ cdef class Matrix(Matrix1): ``'symmetric'`` or ``'hermitian'``, according to whether the input matrix is symmetric or hermitian - - ``check`` -- (default: ``True``); if ``True`` then + - ``check`` -- (default: ``True``) if ``True`` then performs the check that the matrix is consistent with the ``algorithm`` keyword @@ -16907,10 +16906,10 @@ cdef class Matrix(Matrix1): - ``self`` -- a square matrix with entries from an exact field - - ``transformation`` -- (default: ``False``); if ``True`` return a + - ``transformation`` -- (default: ``False``) if ``True`` return a change-of-basis matrix relating the matrix and its ZigZag form - - ``subdivide`` -- (default: ``True``); if ``True`` the ZigZag + - ``subdivide`` -- (default: ``True``) if ``True`` the ZigZag form matrix is subdivided according to the companion matrices described in the output section below. @@ -17182,14 +17181,14 @@ cdef class Matrix(Matrix1): - ``self`` -- a square matrix with entries from an exact field - - ``format`` -- (default: ``'right'``); one of ``'right'``, ``'bottom'``, + - ``format`` -- (default: ``'right'``) one of ``'right'``, ``'bottom'``, ``'left'``, ``'top'`` or ``'invariants'``. The first four will cause a matrix to be returned with companion matrices dictated by the keyword. The value 'invariants' will cause a list of lists to be returned, where each list contains coefficients of a polynomial associated with a companion matrix. - - ``subdivide`` -- (default: ``'True'``); if 'True' and a matrix is + - ``subdivide`` -- (default: ``'True'``) if 'True' and a matrix is returned, then it contains subdivisions delineating the companion matrices along the diagonal diff --git a/src/sage/matrix/matrix_double_dense.pyx b/src/sage/matrix/matrix_double_dense.pyx index 5a59b095309..dcbeb6906c5 100644 --- a/src/sage/matrix/matrix_double_dense.pyx +++ b/src/sage/matrix/matrix_double_dense.pyx @@ -372,7 +372,7 @@ cdef class Matrix_double_dense(Matrix_numpy_dense): INPUT: - - ``p`` -- (default: ``'frob'``); controls which norm is used + - ``p`` -- (default: ``'frob'``) controls which norm is used to compute the condition number, allowable values are 'frob' (for the Frobenius norm), integers -2, -1, 1, 2, positive and negative infinity. See output discussion @@ -559,7 +559,7 @@ cdef class Matrix_double_dense(Matrix_numpy_dense): INPUT: - - ``p`` -- (default: 2); controls which norm is computed, + - ``p`` -- (default: 2) controls which norm is computed, allowable values are 'frob' (for the Frobenius norm), integers -2, -1, 1, 2, positive and negative infinity. See output discussion for specifics. @@ -696,7 +696,7 @@ cdef class Matrix_double_dense(Matrix_numpy_dense): INPUT: - - ``eps`` -- (default: ``None``); the largest number which + - ``eps`` -- (default: ``None``) the largest number which will be considered to be zero. May also be set to the string 'auto'. See the discussion below. @@ -1064,7 +1064,7 @@ cdef class Matrix_double_dense(Matrix_numpy_dense): solved; if ``algorithm`` is ``'symmetric'`` or ``'hermitian'``, `B` must be real symmetric or hermitian positive definite, respectively - - ``algorithm`` -- default: ``'default'`` + - ``algorithm`` -- (default: ``'default'``) - ``'default'`` -- applicable to any matrix with double-precision floating point entries. @@ -1084,7 +1084,7 @@ cdef class Matrix_double_dense(Matrix_numpy_dense): This algorithm can be significantly faster than the ``'default'`` algorithm. - - ``'tol'`` -- (default: ``None``); if set to a value other than + - ``'tol'`` -- (default: ``None``) if set to a value other than ``None``, this is interpreted as a small real number used to aid in grouping eigenvalues that are numerically similar, but is ignored when ``homogeneous`` is set. See the output description for more @@ -2213,11 +2213,11 @@ cdef class Matrix_double_dense(Matrix_numpy_dense): INPUT: - - ``tol`` -- (default: ``1e-12``); the largest value of the + - ``tol`` -- (default: ``1e-12``) the largest value of the absolute value of the difference between two matrix entries for which they will still be considered equal - - ``algorithm`` -- (default: ``'orthonormal'``); set to + - ``algorithm`` -- (default: ``'orthonormal'``) set to ``'orthonormal'`` for a stable procedure and set to 'naive' for a fast procedure @@ -2403,11 +2403,11 @@ cdef class Matrix_double_dense(Matrix_numpy_dense): INPUT: - - ``tol`` -- (default: ``1e-12``); the largest value of the + - ``tol`` -- (default: ``1e-12``) the largest value of the absolute value of the difference between two matrix entries for which they will still be considered equal - - ``skew`` -- (default: ``False``); specifies the type of the + - ``skew`` -- (default: ``False``) specifies the type of the test. Set to ``True`` to check whether the matrix is skew-Hermitian. @@ -2521,7 +2521,7 @@ cdef class Matrix_double_dense(Matrix_numpy_dense): INPUT: - - ``tol`` -- (default: ``1e-12``); the largest value of the + - ``tol`` -- (default: ``1e-12``) the largest value of the absolute value of the difference between two matrix entries for which they will still be considered equal. @@ -2649,11 +2649,11 @@ cdef class Matrix_double_dense(Matrix_numpy_dense): INPUT: - - ``tol`` -- (default: ``1e-12``); the largest value of the + - ``tol`` -- (default: ``1e-12``) the largest value of the absolute value of the difference between two matrix entries for which they will still be considered equal. - - ``algorithm`` -- (default: ``'orthonormal'``); set to + - ``algorithm`` -- (default: ``'orthonormal'``) set to ``'orthonormal'`` for a stable procedure and set to ``'naive'`` for a fast procedure @@ -2770,11 +2770,11 @@ cdef class Matrix_double_dense(Matrix_numpy_dense): INPUT: - - ``tol`` -- (default: ``1e-12``); the largest value of the + - ``tol`` -- (default: ``1e-12``) the largest value of the absolute value of the difference between two matrix entries for which they will still be considered equal. - - ``algorithm`` -- (default: ``'orthonormal'``); set to + - ``algorithm`` -- (default: ``'orthonormal'``) set to ``'orthonormal'`` for a stable procedure and set to ``'naive'`` for a fast procedure diff --git a/src/sage/matrix/matrix_gfpn_dense.pyx b/src/sage/matrix/matrix_gfpn_dense.pyx index efb3b2cfe38..29c86aa5695 100644 --- a/src/sage/matrix/matrix_gfpn_dense.pyx +++ b/src/sage/matrix/matrix_gfpn_dense.pyx @@ -867,7 +867,7 @@ cdef class Matrix_gfpn_dense(Matrix_dense): INPUT: - ``i`` -- index of the first row to be extracted - - ``j`` -- (default: -1); -1, or index of the last + - ``j`` -- (default: -1) -1, or index of the last row to be extracted OUTPUT: diff --git a/src/sage/matrix/matrix_integer_dense.pyx b/src/sage/matrix/matrix_integer_dense.pyx index 35bbfcc5012..00ca42ea292 100644 --- a/src/sage/matrix/matrix_integer_dense.pyx +++ b/src/sage/matrix/matrix_integer_dense.pyx @@ -1793,7 +1793,7 @@ cdef class Matrix_integer_dense(Matrix_dense): - ``'pari4'`` -- use PARI with flag 4 (use heuristic LLL) - - ``proof`` -- (default: ``True``); if proof=False certain + - ``proof`` -- (default: ``True``) if proof=False certain determinants are computed using a randomized hybrid p-adic multimodular strategy until it stabilizes twice (instead of up to the Hadamard bound). It is *incredibly* unlikely that one would @@ -2124,7 +2124,7 @@ cdef class Matrix_integer_dense(Matrix_dense): INPUT: - - ``p`` -- (default: 0); if nonzero given, saturate + - ``p`` -- (default: 0) if nonzero given, saturate only at the prime `p`, i.e., return a matrix whose row span is a `\ZZ`-module `S` that contains ``self`` and such that the index of `S` in its saturation is coprime to @@ -2134,7 +2134,7 @@ cdef class Matrix_integer_dense(Matrix_dense): if ``False``, the determinant calculations are done with ``proof=False`` - - ``max_dets`` -- (default: 5); technical parameter - + - ``max_dets`` -- (default: 5) technical parameter - max number of determinant to compute when bounding prime divisor of ``self`` in its saturation. @@ -5312,7 +5312,7 @@ cdef class Matrix_integer_dense(Matrix_dense): - ``right`` -- a matrix, vector or free module element, whose dimensions are compatible with ``self`` - - ``subdivide`` -- default: ``False`` -- request the resulting + - ``subdivide`` -- (default: ``False``) -- request the resulting matrix to have a new subdivision, separating ``self`` from ``right`` OUTPUT: diff --git a/src/sage/matrix/matrix_modn_dense_template.pxi b/src/sage/matrix/matrix_modn_dense_template.pxi index a2793b1bba6..d532020de8f 100644 --- a/src/sage/matrix/matrix_modn_dense_template.pxi +++ b/src/sage/matrix/matrix_modn_dense_template.pxi @@ -1416,7 +1416,7 @@ cdef class Matrix_modn_dense_template(Matrix_dense): - ``algorithm`` -- ``generic`` or ``linbox`` (default: ``linbox``) - - ``proof`` -- (default: ``True``); whether to provably return + - ``proof`` -- (default: ``True``) whether to provably return the true minimal polynomial; if ``False``, we only guarantee to return a divisor of the minimal polynomial. There are also certainly cases where the computed results is diff --git a/src/sage/matrix/special.py b/src/sage/matrix/special.py index 46849354389..1065f8556fd 100644 --- a/src/sage/matrix/special.py +++ b/src/sage/matrix/special.py @@ -221,10 +221,10 @@ def random_matrix(ring, nrows, ncols=None, algorithm='randomize', implementation - ``nrows`` -- integer; number of rows - - ``ncols`` -- (default: ``None``); number of columns. If ``None`` + - ``ncols`` -- (default: ``None``) number of columns. If ``None`` defaults to ``nrows``. - - ``algorithm`` -- (default: ``'randomize'``); determines what properties + - ``algorithm`` -- (default: ``'randomize'``) determines what properties the matrix will have. See examples below for possible additional arguments. @@ -1021,11 +1021,11 @@ def ones_matrix(ring, nrows=None, ncols=None, sparse=False): INPUT: - - ``ring`` -- (default: ``ZZ``); base ring for the matrix + - ``ring`` -- (default: ``ZZ``) base ring for the matrix - ``nrows`` -- number of rows in the matrix - ``ncols`` -- number of columns in the matrix; if omitted, defaults to the number of rows, producing a square matrix - - ``sparse`` -- (default: ``False``); if ``True`` creates a sparse representation + - ``sparse`` -- (default: ``False``) if ``True`` creates a sparse representation OUTPUT: @@ -2164,7 +2164,7 @@ def jordan_block(eigenvalue, size, sparse=False): - ``eigenvalue`` -- eigenvalue for the diagonal entries of the block - ``size`` -- size of the square matrix - - ``sparse`` -- (default: ``False``); if ``True``, return a sparse matrix + - ``sparse`` -- (default: ``False``) if ``True``, return a sparse matrix EXAMPLES:: @@ -2212,7 +2212,7 @@ def companion_matrix(poly, format='right'): A symbolic expression that might also be a polynomial is not proper input, see examples below. - - ``format`` -- (default: ``'right'``); specifies one of four + - ``format`` -- (default: ``'right'``) specifies one of four variations of a companion matrix. Allowable values are ``'right'``, ``'left'``, ``'top'`` and ``'bottom'``, which indicates which border of the matrix contains the negatives of the coefficients. diff --git a/src/sage/misc/sagedoc.py b/src/sage/misc/sagedoc.py index d44e856f5b9..5243bcc00d8 100644 --- a/src/sage/misc/sagedoc.py +++ b/src/sage/misc/sagedoc.py @@ -1056,7 +1056,7 @@ def search_src(string, extra1='', extra2='', extra3='', extra4='', - ``extra1``, ..., ``extra5`` -- additional strings to require when searching. Lines must match all of these, as well as ``string`` - - ``whole_word`` -- (default: ``False``); if ``True``, search for + - ``whole_word`` -- (default: ``False``) if ``True``, search for ``string`` and ``extra1`` (etc.) as whole words only. This assumes that each of these arguments is a single word, not a regular expression, and it might have unexpected results if used @@ -1065,7 +1065,7 @@ def search_src(string, extra1='', extra2='', extra3='', extra4='', - ``ignore_case`` -- boolean (default: ``True``); if ``False``, perform a case-sensitive search - - ``multiline`` -- (default: ``False``); if ``True``, search more + - ``multiline`` -- (default: ``False``) if ``True``, search more than one line at a time. In this case, print any matching file names, but don't print line numbers. diff --git a/src/sage/misc/verbose.py b/src/sage/misc/verbose.py index 3fba6a9f5fc..e3d2c706fd3 100644 --- a/src/sage/misc/verbose.py +++ b/src/sage/misc/verbose.py @@ -190,7 +190,7 @@ def set_verbose(level, files='all'): - ``level`` -- integer between 0 and 2, inclusive - - ``files`` -- (default: ``'all'``); list of files to make verbose, or + - ``files`` -- (default: ``'all'``) list of files to make verbose, or 'all' to make ALL files verbose (the default) OUTPUT: changes the state of the verbosity flag and possibly diff --git a/src/sage/modular/abvar/abvar.py b/src/sage/modular/abvar/abvar.py index 0639c13ddd8..47c2a0c0a7f 100644 --- a/src/sage/modular/abvar/abvar.py +++ b/src/sage/modular/abvar/abvar.py @@ -3161,7 +3161,7 @@ def degen_t(self, none_if_not_known=False): INPUT: - - ``none_if_not_known`` -- (default: ``False``); if ``True``, return + - ``none_if_not_known`` -- (default: ``False``) if ``True``, return ``None`` instead of attempting to compute the degen map's `t`, if it isn't known. This ``None`` result is not cached. @@ -3648,9 +3648,9 @@ def complement(self, A=None): INPUT: - - ``A`` -- (default: ``None``); if given, A must be an - abelian variety that contains self, in which case the complement of - ``self`` is taken inside A. Otherwise the complement is taken in the + - ``A`` -- (default: ``None``) if given, ``A`` must be an + abelian variety that contains ``self``, in which case the complement of + ``self`` is taken inside ``A``. Otherwise the complement is taken in the ambient product Jacobian. OUTPUT: abelian variety diff --git a/src/sage/modular/arithgroup/congroup_gammaH.py b/src/sage/modular/arithgroup/congroup_gammaH.py index 130dbbb8bea..44f9b380376 100644 --- a/src/sage/modular/arithgroup/congroup_gammaH.py +++ b/src/sage/modular/arithgroup/congroup_gammaH.py @@ -1342,10 +1342,10 @@ def characters_mod_H(self, sign=None, galois_orbits=False): INPUT: - - ``sign`` -- (default: ``None``); if not ``None``, return only + - ``sign`` -- (default: ``None``) if not ``None``, return only characters of the given sign - - ``galois_orbits`` -- (default: ``False``); if ``True``, return only + - ``galois_orbits`` -- (default: ``False``) if ``True``, return only one character from each Galois orbit EXAMPLES:: diff --git a/src/sage/modular/btquotients/btquotient.py b/src/sage/modular/btquotients/btquotient.py index a8edae3234a..c91dac52b27 100644 --- a/src/sage/modular/btquotients/btquotient.py +++ b/src/sage/modular/btquotients/btquotient.py @@ -3731,10 +3731,10 @@ def padic_automorphic_forms(self, U, prec=None, t=None, R=None, overconvergent=F - ``prec`` -- a precision (default: ``None``). if not ``None`` should be a positive integer - - ``t`` -- (default: ``None``); the number of additional moments to store. If ``None``, determine + - ``t`` -- (default: ``None``) the number of additional moments to store. If ``None``, determine it automatically from ``prec``, ``U`` and the ``overconvergent`` flag - - ``R`` -- (default: ``None``); if specified, coefficient field of the automorphic forms. + - ``R`` -- (default: ``None``) if specified, coefficient field of the automorphic forms. If not specified it defaults to the base ring of the distributions ``U``, or to `\QQ_p` with the working precision ``prec``. diff --git a/src/sage/modular/btquotients/pautomorphicform.py b/src/sage/modular/btquotients/pautomorphicform.py index 4ff32274adf..4fe64dcf355 100644 --- a/src/sage/modular/btquotients/pautomorphicform.py +++ b/src/sage/modular/btquotients/pautomorphicform.py @@ -1876,7 +1876,7 @@ def modular_form(self, z=None, level=0, method='moments'): INPUT: - - ``z`` -- (default: ``None``); if specified, returns the value of + - ``z`` -- (default: ``None``) if specified, returns the value of the form at the point ``z`` in the `p`-adic upper half plane @@ -1935,7 +1935,7 @@ def derivative(self, z=None, level=0, method='moments', order=1): INPUT: - - ``z`` -- (default: ``None``); if specified, evaluates the derivative + - ``z`` -- (default: ``None``) if specified, evaluates the derivative at the point ``z`` in the `p`-adic upper half plane - ``level`` -- integer (default: 0); if ``method`` is @@ -2032,7 +2032,7 @@ def coleman(self, t1, t2, E=None, method='moments', mult=False): - ``t1``, ``t2`` -- elements of `P^1(\QQ_p)` (the endpoints of integration) - - ``E`` -- (default: ``None``); if specified, will not compute the + - ``E`` -- (default: ``None``) if specified, will not compute the covering adapted to ``t1`` and ``t2`` and instead use the given one. In that case, ``E`` should be a list of matrices corresponding to edges describing the open balls to be @@ -2145,11 +2145,11 @@ def __classcall__(cls, domain, U, prec=None, t=None, R=None, - ``prec`` -- a precision (default: ``None``); if not ``None`` should be a positive integer - - ``t`` -- (default: ``None``); the number of additional moments to + - ``t`` -- (default: ``None``) the number of additional moments to store. If ``None``, determine it automatically from ``prec``, ``U`` and the ``overconvergent`` flag. - - ``R`` -- (default: ``None``); if specified, coefficient field of the automorphic forms. + - ``R`` -- (default: ``None``) if specified, coefficient field of the automorphic forms. If not specified it defaults to the base ring of the distributions ``U``, or to `Q_p` with the working precision ``prec``. diff --git a/src/sage/modular/cusps_nf.py b/src/sage/modular/cusps_nf.py index d698ebda640..4d120c075da 100644 --- a/src/sage/modular/cusps_nf.py +++ b/src/sage/modular/cusps_nf.py @@ -1157,7 +1157,7 @@ def NFCusps_ideal_reps_for_levelN(N, nlists=1): - ``N`` -- number field ideal - - ``nlists`` -- (default: 1); the number of lists of prime ideals + - ``nlists`` -- (default: 1) the number of lists of prime ideals we want OUTPUT: diff --git a/src/sage/modular/hecke/ambient_module.py b/src/sage/modular/hecke/ambient_module.py index 87668b38565..f5fdbe512bf 100644 --- a/src/sage/modular/hecke/ambient_module.py +++ b/src/sage/modular/hecke/ambient_module.py @@ -724,7 +724,7 @@ def new_submodule(self, p=None): INPUT: - - ``p`` -- (default: ``None``); if not ``None``, return only + - ``p`` -- (default: ``None``) if not ``None``, return only the `p`-new submodule OUTPUT: the new or `p`-new submodule of ``self``, i.e. the intersection of @@ -828,7 +828,7 @@ def old_submodule(self, p=None): INPUT: - - ``p`` -- (default: ``None``); if not ``None``, return only the `p`-old + - ``p`` -- (default: ``None``) if not ``None``, return only the `p`-old submodule OUTPUT: the old or `p`-old submodule of ``self`` diff --git a/src/sage/modular/modform/ring.py b/src/sage/modular/modform/ring.py index e16cb093f82..35c33608ccf 100644 --- a/src/sage/modular/modform/ring.py +++ b/src/sage/modular/modform/ring.py @@ -339,7 +339,7 @@ def polynomial_ring(self, names, gens=None): - ``names`` -- list or tuple of names (strings), or a comma separated string - - ``gens`` -- (default: ``None``); (list) a list of generator of + - ``gens`` -- (default: ``None``) list of generator of ``self``. If ``gens`` is ``None`` then the generators returned by :meth:`~sage.modular.modform.find_generator.ModularFormsRing.gen_forms` is used instead diff --git a/src/sage/modular/modsym/ambient.py b/src/sage/modular/modsym/ambient.py index 6854a4ffdda..8bb7faa1966 100644 --- a/src/sage/modular/modsym/ambient.py +++ b/src/sage/modular/modsym/ambient.py @@ -200,7 +200,7 @@ def new_submodule(self, p=None): INPUT: - - ``p`` -- (default: ``None``); if not ``None``, return only + - ``p`` -- (default: ``None``) if not ``None``, return only the `p`-new submodule OUTPUT: the new or `p`-new submodule of this modular symbols ambient space @@ -448,7 +448,7 @@ def _element_constructor_(self, x, computed_with_hecke=False): elif isinstance(x, modular_symbols.ModularSymbol): return self(x.manin_symbol_rep()) - elif isinstance(x, (integer; Integer)) and x == 0: + elif isinstance(x, (int, Integer)) and x == 0: return self.element_class(self, self.free_module()(0)) elif isinstance(x, tuple): diff --git a/src/sage/modular/modsym/space.py b/src/sage/modular/modsym/space.py index 684c5908fd1..71c2a8659c5 100644 --- a/src/sage/modular/modsym/space.py +++ b/src/sage/modular/modsym/space.py @@ -197,7 +197,7 @@ def compact_system_of_eigenvalues(self, v, names='alpha', nz=None): INPUT: - ``v`` -- list of positive integers - - ``nz`` -- (default: ``None``); if given specifies a column index + - ``nz`` -- (default: ``None``) if given specifies a column index such that the dual module has that column nonzero OUTPUT: diff --git a/src/sage/modular/pollack_stevens/space.py b/src/sage/modular/pollack_stevens/space.py index 8c8168b19a3..97b77000be9 100644 --- a/src/sage/modular/pollack_stevens/space.py +++ b/src/sage/modular/pollack_stevens/space.py @@ -205,7 +205,7 @@ class PollackStevensModularSymbolspace(Module): - ``coefficients`` -- a coefficient module - - ``sign`` -- (default: 0); 0, -1, or 1 + - ``sign`` -- (default: 0) 0, -1, or 1 EXAMPLES:: diff --git a/src/sage/modules/diamond_cutting.py b/src/sage/modules/diamond_cutting.py index 235f238dd21..f470c7f72eb 100644 --- a/src/sage/modules/diamond_cutting.py +++ b/src/sage/modules/diamond_cutting.py @@ -137,7 +137,7 @@ def diamond_cut(V, GM, C, verbose=False): - ``C`` -- radius to use in cutting algorithm - - ``verbose`` -- (default: ``False``) whether to print debug information + - ``verbose`` -- boolean (default: ``False``); whether to print debug information OUTPUT: a :class:`Polyhedron` instance @@ -232,7 +232,7 @@ def diamond_cut(V, GM, C, verbose=False): def calculate_voronoi_cell(basis, radius=None, verbose=False): """ - Calculate the Voronoi cell of the lattice defined by basis + Calculate the Voronoi cell of the lattice defined by basis. INPUT: diff --git a/src/sage/modules/fg_pid/fgp_element.py b/src/sage/modules/fg_pid/fgp_element.py index 2bcb5799404..ed63c1d2053 100644 --- a/src/sage/modules/fg_pid/fgp_element.py +++ b/src/sage/modules/fg_pid/fgp_element.py @@ -59,11 +59,12 @@ def __init__(self, parent, x, check=DEBUG): """ INPUT: - - ``parent`` -- parent module M + - ``parent`` -- parent module ``M`` - - ``x`` -- element of M.V() + - ``x`` -- element of ``M.V()`` - - ``check`` -- (default: ``True``) if True, verify that x in M.V() + - ``check`` -- boolean (default: ``True``); if ``True``, verify that x + in ``M.V()`` EXAMPLES:: @@ -83,7 +84,8 @@ def __init__(self, parent, x, check=DEBUG): def lift(self): """ - Lift self to an element of V, where the parent of self is the quotient module V/W. + Lift ``self`` to an element of V, where the parent of ``self`` is the + quotient module V/W. EXAMPLES:: @@ -193,7 +195,7 @@ def _rmul_(self, c): INPUT: - - ``c`` -- an element of ``self.parent().base_ring()``. + - ``c`` -- an element of ``self.parent().base_ring()`` OUTPUT: @@ -238,7 +240,7 @@ def _lmul_(self, s): INPUT: - - ``c`` -- an element of ``self.parent().base_ring()``. + - ``c`` -- an element of ``self.parent().base_ring()`` OUTPUT: @@ -355,7 +357,7 @@ def _vector_(self, base_ring=None): INPUT: - - ``base_ring`` -- the desired base ring of the vector. + - ``base_ring`` -- the desired base ring of the vector OUTPUT: a vector over the base ring @@ -389,7 +391,7 @@ def _vector_(self, base_ring=None): def _richcmp_(self, right, op): """ - Compare self and right. + Compare ``self`` and ``right``. EXAMPLES:: diff --git a/src/sage/modules/fg_pid/fgp_module.py b/src/sage/modules/fg_pid/fgp_module.py index 46c5301dc06..5b044ee44a9 100644 --- a/src/sage/modules/fg_pid/fgp_module.py +++ b/src/sage/modules/fg_pid/fgp_module.py @@ -238,14 +238,12 @@ def FGP_Module(V, W, check=True): - ``W`` -- a free `R`-submodule of `V` - - ``check`` -- bool (default: ``True``); if ``True``, more checks - on correctness are performed; in particular, we check the data + - ``check`` -- boolean (default: ``True``); if ``True``, more checks + on correctness are performed. In particular, we check the data types of ``V`` and ``W``, and that `W` is a submodule of `V` with the same base ring. - OUTPUT: - - - the quotient `V/W` as a finitely generated `R`-module + OUTPUT: the quotient `V/W` as a finitely generated `R`-module EXAMPLES:: @@ -302,7 +300,7 @@ class FGP_Module_class(Module): - ``W`` -- an `R`-submodule of `V` - - ``check`` -- bool (default: ``True``) + - ``check`` -- boolean (default: ``True``) EXAMPLES:: @@ -346,8 +344,8 @@ def __init__(self, V, W, check=True): - ``W`` -- an `R`-submodule of `V` - - ``check`` -- bool (default: ``True``); if ``True``, more checks on - correctness are performed; in particular, we check the data types of + - ``check`` -- boolean (default: ``True``); if ``True``, more checks on + correctness are performed. In particular, we check the data types of ``V`` and ``W``, and that `W` is a submodule of `V` with the same base ring `R`. @@ -391,7 +389,7 @@ def _module_constructor(self, V, W, check=True): - ``W`` -- an `R`-submodule of `V` - - ``check`` -- bool (default: ``True``) + - ``check`` -- boolean (default: ``True``) OUTPUT: the quotient `V/W` @@ -453,7 +451,8 @@ def _mul_(self, other, switch_sides=False): INPUT: - ``other`` -- an element of the base ring - - ``switch_sides`` -- (default: ``False``) left or right multiplication + - ``switch_sides`` -- boolean (default: ``False``); left or right + multiplication EXAMPLES:: @@ -532,7 +531,7 @@ def __eq__(self, other): def __ne__(self, other): """ - True iff ``self`` is not equal to ``other``. + Return ``True`` iff ``self`` is not equal to ``other``. This may not be needed for modules created using the function :func:`FGP_Module`, since those have uniqueness built into @@ -572,7 +571,7 @@ def __ne__(self, other): def __lt__(self, other): """ - True iff ``self`` is a proper submodule of ``other``. + Return ``True`` iff ``self`` is a proper submodule of ``other``. EXAMPLES:: @@ -590,7 +589,7 @@ def __lt__(self, other): def __gt__(self, other): """ - True iff ``other`` is a proper submodule of ``self``. + Return ``True`` iff ``other`` is a proper submodule of ``self``. EXAMPLES:: @@ -608,7 +607,7 @@ def __gt__(self, other): def __ge__(self, other): """ - True iff ``other`` is a submodule of ``self``. + Return ``True`` iff ``other`` is a submodule of ``self``. EXAMPLES:: @@ -637,7 +636,7 @@ def _element_constructor_(self, x, check=True): space and try to put into `V`. If ``x`` is in ``self`` already, just return ``x``. - - `check` -- bool (default: ``True``) + - ``check`` -- boolean (default: ``True``) .. SEEALSO:: :meth:`linear_combination_of_smith_form_gens` @@ -669,7 +668,6 @@ def linear_combination_of_smith_form_gens(self, x): sage: X = ZZ**2 / span([[3,0], [0,2]], ZZ) sage: X.linear_combination_of_smith_form_gens([1]) (1) - """ try: x = self.optimized()[0].V().linear_combination_of_basis(x) @@ -790,7 +788,6 @@ def has_canonical_map_to(self, A): True sage: Q.has_canonical_map_to(A) False - """ if not isinstance(A, FGP_Module_class): return False @@ -852,7 +849,6 @@ def V(self): [1/2 0 0] [ 0 1 0] [ 0 0 1] - """ return self._V @@ -945,7 +941,7 @@ def _smith_form(self): """ Return matrices `S`, `U`, and `V` such that `S = U*R*V`, and `S` is in Smith normal form, and `R` is the relative matrix that defines - self. + ``self``. See :meth:`_relative_matrix`. @@ -983,13 +979,13 @@ def invariants(self, include_ones=False): Return the diagonal entries of the Smith form of the relative matrix that defines ``self`` (see :meth:`._relative_matrix`) padded with zeros, excluding 1's by default. Thus if ``v`` is the - list of integers returned, then self is abstractly isomorphic to + list of integers returned, then ``self`` is abstractly isomorphic to the product of cyclic groups `\ZZ/n\ZZ` where `n` is in ``v``. INPUT: - - ``include_ones`` -- bool (default: ``False``); if ``True``, also - include 1's in the output list. + - ``include_ones`` -- boolean (default: ``False``); if ``True``, also + include 1s in the output list EXAMPLES:: @@ -1007,7 +1003,6 @@ def invariants(self, include_ones=False): (0,) sage: Q.invariants(include_ones=True) (1, 1, 0) - """ D, _, _ = self._smith_form() @@ -1079,9 +1074,7 @@ def gens_to_smith(self): To go in the other direction, use :meth:`smith_to_gens`. - OUTPUT: - - - a matrix over the base ring + OUTPUT: a matrix over the base ring EXAMPLES:: @@ -1130,9 +1123,7 @@ def smith_to_gens(self): To go in the other direction, use :meth:`gens_to_smith`. - OUTPUT: - - - a matrix over the base ring + OUTPUT: a matrix over the base ring EXAMPLES:: @@ -1199,7 +1190,7 @@ def gens_vector(self, x, reduce=False): - ``x`` -- element of ``self`` - - ``reduce`` -- (default: ``False``); if ``True``, + - ``reduce`` -- (default: ``False``) if ``True``, reduce coefficients modulo invariants; this is ignored if the base ring is not `\ZZ` @@ -1262,9 +1253,9 @@ def coordinate_vector(self, x, reduce=False): - ``x`` -- element of ``self`` - - ``reduce`` -- (default: ``False``); if ``True``, reduce + - ``reduce`` -- (default: ``False``) if ``True``, reduce coefficients modulo invariants; this is - ignored if the base ring is not ``ZZ``. + ignored if the base ring is not ``ZZ`` OUTPUT: @@ -1499,10 +1490,9 @@ def hom(self, im_gens, codomain=None, check=True): INPUT: - - ``im_gens`` -- a list of the images of ``self.gens()`` in some + - ``im_gens`` -- list of the images of ``self.gens()`` in some `R`-module - EXAMPLES:: sage: V = span([[1/2,1,1], [3/2,2,1], [0,0,1]], ZZ) @@ -1646,7 +1636,6 @@ def _hom_general(self, im_gens, check=True): Morphism from module over Integer Ring with invariants (3,) to module with invariants (3,) that sends the generators to [(1), (1)] - """ m = self.ngens() A = ZZ**m @@ -1736,7 +1725,6 @@ def _Hom_(self, N, category=None): in Category of commutative additive groups sage: type(H) - """ if isinstance(N, FGP_Module_class): return FGP_Homset(self, N) @@ -1996,7 +1984,8 @@ def random_fgp_module(n, R=ZZ, finite=False): - ``R`` -- base ring (default: ``ZZ``) - - ``finite`` -- bool (default: ``True``); if True, make the random module finite + - ``finite`` -- boolean (default: ``True``); if ``True``, make the random + module finite EXAMPLES:: diff --git a/src/sage/modules/fg_pid/fgp_morphism.py b/src/sage/modules/fg_pid/fgp_morphism.py index 4be28f43be1..df08f7ceb0f 100644 --- a/src/sage/modules/fg_pid/fgp_morphism.py +++ b/src/sage/modules/fg_pid/fgp_morphism.py @@ -391,7 +391,7 @@ def lift(self, x): INPUT: - - ``x`` -- element of the codomain of self. + - ``x`` -- element of the codomain of self EXAMPLES:: @@ -410,7 +410,6 @@ def lift(self, x): sage: V = span([[5, -1/2]],ZZ); W = span([[20,-2]],ZZ); Q = V/W; phi=Q.hom([2*Q.0]) sage: x = phi.image().0; phi(phi.lift(x)) == x True - """ x = self.codomain()(x) @@ -485,7 +484,7 @@ def FGP_Homset(X, Y): class FGP_Homset_class(Homset): """ - Homsets of :class:`~sage.modules.fg_pid.fgp_module.FGP_Module` + Homsets of :class:`~sage.modules.fg_pid.fgp_module.FGP_Module`. TESTS:: diff --git a/src/sage/modules/filtered_vector_space.py b/src/sage/modules/filtered_vector_space.py index b43838290dd..b97a15b4935 100644 --- a/src/sage/modules/filtered_vector_space.py +++ b/src/sage/modules/filtered_vector_space.py @@ -133,7 +133,7 @@ def is_FilteredVectorSpace(X): INPUT: - - ``X`` -- anything. + - ``X`` -- anything OUTPUT: boolean @@ -218,10 +218,9 @@ def FilteredVectorSpace(arg1, arg2=None, base_ring=QQ, check=True): def normalize_degree(deg): """ - Normalized the degree + Normalize the degree. - - ``deg`` -- something that defines the degree (either integer or - infinity). + - ``deg`` -- something that defines the degree (either integer or infinity) OUTPUT: plus/minus infinity or a Sage integer @@ -251,10 +250,10 @@ def construct_from_dim_degree(dim, max_degree, base_ring, check): INPUT: - - ``dim`` -- integer. The dimension. + - ``dim`` -- integer; the dimension - - ``max_degree`` -- integer or infinity. The maximal degree where - the vector subspace of the filtration is still the entire space. + - ``max_degree`` -- integer or infinity; the maximal degree where + the vector subspace of the filtration is still the entire space EXAMPLES:: @@ -299,7 +298,7 @@ def construct_from_generators(filtration, base_ring, check): INPUT: - - ``filtration`` -- a dictionary of filtration steps. Each + - ``filtration`` -- dictionary of filtration steps. Each filtration step is a pair consisting of an integer degree and a list/tuple/iterable of vector space generators. The integer ``degree`` stipulates that all filtration steps of degree higher @@ -338,11 +337,11 @@ def construct_from_generators_indices(generators, filtration, base_ring, check): INPUT: - - ``generators`` -- a list/tuple/iterable of vectors, or something + - ``generators`` -- list/tuple/iterable of vectors, or something convertible to them. The generators spanning various subspaces. - - ``filtration`` -- a list or iterable of filtration steps. Each + - ``filtration`` -- list or iterable of filtration steps. Each filtration step is a pair ``(degree, ray_indices)``. The ``ray_indices`` are a list or iterable of ray indices, which span a subspace of the vector space. The integer ``degree`` @@ -404,24 +403,24 @@ class FilteredVectorSpace_class(FreeModule_ambient_field): def __init__(self, base_ring, dim, generators, filtration, check=True): r""" - A descending filtration of a vector space + A descending filtration of a vector space. INPUT: - - ``base_ring`` -- a field. The base field of the ambient vector space. + - ``base_ring`` -- a field; the base field of the ambient vector space - - ``dim`` -- integer. The dimension of the ambient vector space. + - ``dim`` -- integer; the dimension of the ambient vector space - ``generators`` -- tuple of generators for the ambient vector space. These will be used to span the subspaces of the filtration. - - ``filtration`` -- a dictionary of filtration steps in ray + - ``filtration`` -- dictionary of filtration steps in ray index notation. See :func:`construct_from_generators_indices` for details. - - ``check`` -- boolean (optional; default: ``True``). Whether - to perform consistency checks. + - ``check`` -- boolean (default: ``True``); whether + to perform consistency checks TESTS:: @@ -485,7 +484,7 @@ def change_ring(self, base_ring): INPUT: - - ``base_ring`` -- a ring. The new base ring. + - ``base_ring`` -- the new base ring OUTPUT: @@ -680,7 +679,7 @@ def get_degree(self, d): INPUT: - - ``d`` -- Integer. The desired degree of the filtration. + - ``d`` -- integer; the desired degree of the filtration OUTPUT: @@ -717,7 +716,7 @@ def graded(self, d): INPUT: - - ``d`` -- integer. The degree. + - ``d`` -- integer; the degree OUTPUT: the quotient `G_d = F_d / F_{d+1}` @@ -806,11 +805,11 @@ def _repr_field_name(self): def _repr_vector_space(self, dim): """ - Return a string representation of the vector space of given dimension + Return a string representation of the vector space of given dimension. INPUT: - - ``dim`` -- integer. + - ``dim`` -- integer OUTPUT: string representation of the vector space of dimension ``dim`` @@ -835,14 +834,14 @@ def _repr_vector_space(self, dim): def _repr_degrees(self, min_deg, max_deg): """ - Return a string representation + Return a string representation. This method is like :meth:`_repr_` except that the user can select the range of degrees to be shown in the output. INPUT: - - ``min_deg``, ``max_deg`` -- two integers. + - ``min_deg``, ``max_deg`` -- two integers EXAMPLES:: @@ -966,7 +965,7 @@ def direct_sum(self, other): INPUT: - - ``other`` -- a filtered vector space. + - ``other`` -- a filtered vector space OUTPUT: the direct sum as a filtered vector space @@ -1026,7 +1025,7 @@ def tensor_product(self, other): INPUT: - - ``other`` -- a filtered vector space. + - ``other`` -- a filtered vector space OUTPUT: @@ -1089,7 +1088,7 @@ def _power_operation(self, n, operation): INPUT: - - ``n`` -- integer. the number of factors of ``self``. + - ``n`` -- integer; the number of factors of ``self`` - ``operation`` -- string. See :class:`~sage.modules.tensor_operations.TensorOperation` for @@ -1127,8 +1126,8 @@ def exterior_power(self, n): INPUT: - - ``n`` -- integer. Exterior product of how many copies of - ``self``. + - ``n`` -- integer; Exterior product of how many copies of + ``self`` OUTPUT: @@ -1160,8 +1159,8 @@ def symmetric_power(self, n): INPUT: - - ``n`` -- integer. Symmetric product of how many copies of - ``self``. + - ``n`` -- integer; symmetric product of how many copies of + ``self`` OUTPUT: @@ -1230,11 +1229,11 @@ def shift(self, deg): def random_deformation(self, epsilon=None): """ - Return a random deformation + Return a random deformation. INPUT: - - ``epsilon`` -- a number in the base ring. + - ``epsilon`` -- a number in the base ring OUTPUT: diff --git a/src/sage/modules/finite_submodule_iter.pyx b/src/sage/modules/finite_submodule_iter.pyx index 188ff9d879a..2b0ce189347 100644 --- a/src/sage/modules/finite_submodule_iter.pyx +++ b/src/sage/modules/finite_submodule_iter.pyx @@ -83,11 +83,11 @@ cdef class FiniteZZsubmodule_iterator: INPUT: - - ``basis`` -- the elements `(g_0, \ldots, g_n)` - - ``order`` (optional) -- the additive_orders `m_i` of `g_i`. - - ``coset_rep`` (optional) -- an element of g, - if one aims to compute a coset of the `\ZZ`-submodule `M`. - - ``immutable`` (optional; default: ``False``) -- set it to + - ``basis`` -- the elements `(g_0, \ldots, g_n)` + - ``order`` -- optional; the additive_orders `m_i` of `g_i` + - ``coset_rep`` -- optional; an element of g, + if one aims to compute a coset of the `\ZZ`-submodule `M` + - ``immutable`` -- boolean (default: ``False``); set it to ``True`` to return immutable elements. Setting this to ``True`` makes sense if the elements are vectors. See :class:`FiniteFieldsubspace_iterator` for examples. @@ -106,7 +106,7 @@ cdef class FiniteZZsubmodule_iterator: def __init__(self, basis, order=None, coset_rep=None, immutable=False): """ - see :class:`FiniteZZsubmodule_iterator` + See :class:`FiniteZZsubmodule_iterator`. EXAMPLES:: @@ -227,17 +227,17 @@ cdef class FiniteFieldsubspace_iterator(FiniteZZsubmodule_iterator): INPUT: - - ``basis`` -- a list of vectors or a matrix with elements over + - ``basis`` -- list of vectors or a matrix with elements over a finite field. If a matrix is provided then it is not checked whether the matrix is full ranked. Similarly, if a list of vectors is provided, then the linear independence of the vectors is not checked. - - ``coset_rep`` (optional) -- a vector in the same ambient space, - if one aims to compute a coset of the vector space given by ``basis``. + - ``coset_rep`` -- optional; a vector in the same ambient space, + if one aims to compute a coset of the vector space given by ``basis`` - - ``immutable`` (optional; default: ``False``) -- set it to - ``True`` to return immutable vectors. + - ``immutable`` -- boolean (default: ``False``); set it to + ``True`` to return immutable vectors EXAMPLES:: @@ -260,12 +260,11 @@ cdef class FiniteFieldsubspace_iterator(FiniteZZsubmodule_iterator): sage: c = next(iter) sage: c.is_immutable() True - """ def __init__(self, basis, coset_rep=None, immutable=False): """ - see :class:`FiniteFieldsubspace_iterator` + See :class:`FiniteFieldsubspace_iterator`. EXAMPLES:: @@ -311,18 +310,18 @@ cdef class FiniteFieldsubspace_projPoint_iterator: INPUT: - - ``basis`` -- a list of vectors or a matrix with elements over + - ``basis`` -- list of vectors or a matrix with elements over a finite field. If a matrix is provided then it is not checked whether the matrix is full ranked. Similarly, if a list of vectors is provided, then the linear independence of the vectors is not checked. - - ``normalize`` (optional; default: ``False``) -- boolean which - indicates if the returned vectors should be normalized, i.e. the - first nonzero coordinate is equal to 1. + - ``normalize`` -- boolean (default: ``False``); whether the returned + vectors should be normalized, i.e. the first nonzero coordinate is + equal to 1 - - ``immutable`` (optional; default: ``False``) -- set it to - ``True`` to return immutable vectors. + - ``immutable`` -- boolean (default: ``False``); set it to + ``True`` to return immutable vectors EXAMPLES:: @@ -355,7 +354,7 @@ cdef class FiniteFieldsubspace_projPoint_iterator: def __init__(self, basis, normalize=False, immutable=False): """ - see :class:`FiniteFieldsubspace_projPoint_iterator` + See :class:`FiniteFieldsubspace_projPoint_iterator`. EXAMPLES:: diff --git a/src/sage/modules/fp_graded/element.py b/src/sage/modules/fp_graded/element.py index 2b9e1ee452d..273dea1f60b 100755 --- a/src/sage/modules/fp_graded/element.py +++ b/src/sage/modules/fp_graded/element.py @@ -176,7 +176,7 @@ def _lmul_(self, a): def vector_presentation(self): r""" - A coordinate vector representing ``self`` when it is non-zero. + A coordinate vector representing ``self`` when it is nonzero. These are coordinates with respect to the basis chosen by :meth:`~sage.modules.fp_graded.module.FPModule.basis_elements`. @@ -186,7 +186,7 @@ def vector_presentation(self): OUTPUT: A vector of elements in the ground ring of the algebra for - this module when this element is non-zero. Otherwise, the + this module when this element is nonzero. Otherwise, the value ``None``. .. SEEALSO:: @@ -246,11 +246,11 @@ def vector_presentation(self): def __bool__(self): r""" - Determine if this element is non-zero. + Determine if this element is nonzero. OUTPUT: - The boolean value ``True`` if this element is non-zero + The boolean value ``True`` if this element is nonzero and ``False`` otherwise. EXAMPLES:: @@ -277,7 +277,7 @@ def __bool__(self): def __eq__(self, other): r""" - True iff ``self`` and ``other`` are equal. + ``True`` iff ``self`` and ``other`` are equal. EXAMPLES:: diff --git a/src/sage/modules/fp_graded/free_element.py b/src/sage/modules/fp_graded/free_element.py index 700a0952817..c37eed11566 100755 --- a/src/sage/modules/fp_graded/free_element.py +++ b/src/sage/modules/fp_graded/free_element.py @@ -196,7 +196,7 @@ def _lmul_(self, a): @cached_method def vector_presentation(self): r""" - A coordinate vector representing ``self`` when it is a non-zero + A coordinate vector representing ``self`` when it is a nonzero homogeneous element. These are coordinates with respect to the basis chosen by @@ -207,7 +207,7 @@ def vector_presentation(self): OUTPUT: A vector of elements in the ground ring of the algebra for - this module when this element is non-zero. Otherwise, the value + this module when this element is nonzero. Otherwise, the value ``None``. .. SEEALSO:: diff --git a/src/sage/modules/fp_graded/free_module.py b/src/sage/modules/fp_graded/free_module.py index 647fbe04701..513fd2dc066 100755 --- a/src/sage/modules/fp_graded/free_module.py +++ b/src/sage/modules/fp_graded/free_module.py @@ -79,7 +79,7 @@ sage: Sq(2) * x (Sq(4,1)+Sq(7))*g[0] + Sq(3,1)*g[1] -Each non-zero element has a well-defined degree:: +Each nonzero element has a well-defined degree:: sage: x.degree() 5 @@ -549,7 +549,7 @@ def _element_constructor_(self, coefficients): INPUT: - - ``coefficients`` -- a tuple of coefficient (i.e. elements of the + - ``coefficients`` -- tuple of coefficient (i.e. elements of the algebra for this module), an element of FreeGradedModule, or the zero integer constant @@ -646,7 +646,7 @@ def basis_elements(self, n): INPUT: - - ``n`` -- an integer + - ``n`` -- integer OUTPUT: @@ -733,7 +733,7 @@ def element_from_coordinates(self, coordinates, n): INPUT: - ``coordinates`` -- a sequence of elements of the ground ring - - ``n`` -- an integer + - ``n`` -- integer OUTPUT: a module element of degree ``n`` @@ -809,7 +809,7 @@ def vector_presentation(self, n): INPUT: - - ``n`` -- an integer degree + - ``n`` -- integer degree OUTPUT: @@ -919,7 +919,7 @@ def suspension(self, t): INPUT: - - ``t`` -- an integer + - ``t`` -- integer OUTPUT: @@ -983,11 +983,11 @@ def resolution(self, k, top_dim=None, verbose=False): INPUT: - - ``k`` -- a non-negative integer + - ``k`` -- nonnegative integer - ``top_dim`` -- stop the computation at this degree. Ignored, for compatibility with :meth:`sage.modules.fp_graded.module.FPModule.resolution`. - - ``verbose`` -- (default: ``False``) a boolean to control if + - ``verbose`` -- boolean (default: ``False``); a boolean to control if log messages should be emitted OUTPUT: @@ -1024,7 +1024,7 @@ def resolution(self, k, top_dim=None, verbose=False): Module endomorphism of Free graded left module on 0 generators over The exterior algebra of rank 3 over Rational Field] """ if k < 0: - raise ValueError('the length of the resolution must be non-negative') + raise ValueError('the length of the resolution must be nonnegative') # The first map \epsilon is the identity map ret_complex = [Hom(self, self).identity()] diff --git a/src/sage/modules/fp_graded/free_morphism.py b/src/sage/modules/fp_graded/free_morphism.py index 81ba95832b6..68560eaf9e3 100755 --- a/src/sage/modules/fp_graded/free_morphism.py +++ b/src/sage/modules/fp_graded/free_morphism.py @@ -34,7 +34,7 @@ class FreeGradedModuleMorphism(FPModuleMorphism): - ``parent`` -- a homspace in the category of finitely generated free modules - - ``values`` -- a list of elements in the codomain; each element + - ``values`` -- list of elements in the codomain; each element corresponds (by their ordering) to a module generator in the domain EXAMPLES:: diff --git a/src/sage/modules/fp_graded/homspace.py b/src/sage/modules/fp_graded/homspace.py index 94b1f0bba89..0e3fe9be73e 100755 --- a/src/sage/modules/fp_graded/homspace.py +++ b/src/sage/modules/fp_graded/homspace.py @@ -190,7 +190,7 @@ def basis_elements(self, n): INPUT: - - ``n`` -- an integer degree + - ``n`` -- integer degree OUTPUT: a basis for the set of all module homomorphisms of degree ``n`` @@ -237,7 +237,6 @@ def zero(self): To: Free graded left module on 2 generators over sub-Hopf algebra of mod 2 Steenrod algebra, milnor basis, profile function [3, 2, 1] Defn: g[1] |--> 0 g[3] |--> 0 - """ ngens = len(self.domain().generator_degrees()) return self.element_class(self, [self.codomain().zero()] * ngens) @@ -306,7 +305,7 @@ def _basis_elements(self, n, basis): INPUT: - - ``n`` -- an integer degree + - ``n`` -- integer degree - ``basis`` -- boolean; decide if a basis should be returned or just a single homomorphism diff --git a/src/sage/modules/fp_graded/module.py b/src/sage/modules/fp_graded/module.py index dadf4f125e9..f522fbf1076 100755 --- a/src/sage/modules/fp_graded/module.py +++ b/src/sage/modules/fp_graded/module.py @@ -319,7 +319,7 @@ def _from_dict(self, d, coerce=False, remove_zeros=True): INPUT: - - ``d`` -- a dictionary + - ``d`` -- dictionary This code is taken from the method of the same name for ``sage.combinat.free_module.FreeModule``. @@ -402,7 +402,7 @@ def _element_constructor_(self, x): INPUT: - - ``x`` -- a tuple of coefficients, an element of FPModule, or the + - ``x`` -- tuple of coefficients, an element of FPModule, or the zero integer constant OUTPUT: @@ -644,7 +644,7 @@ def an_element(self, n=None): INPUT: - - ``n`` -- (optional) the degree of the element to construct + - ``n`` -- (optional) the degree of the element to construct OUTPUT: a module element of the given degree @@ -681,8 +681,8 @@ def basis_elements(self, n, verbose=False): INPUT: - - ``n`` -- an integer - - ``verbose`` -- (default: ``False``) a boolean to control if log + - ``n`` -- integer + - ``verbose`` -- boolean (default: ``False``); a boolean to control if log messages should be emitted OUTPUT: @@ -1064,7 +1064,7 @@ def suspension(self, t): INPUT: - - ``t`` -- an integer degree by which the module is suspended + - ``t`` -- integer degree by which the module is suspended OUTPUT: @@ -1109,7 +1109,7 @@ def submodule_inclusion(self, spanning_elements): INPUT: - - ``spanning_elements`` -- an iterable of elements + - ``spanning_elements`` -- an iterable of elements OUTPUT: the inclusion of the submodule into this module @@ -1149,14 +1149,14 @@ def resolution(self, k, top_dim=None, verbose=False): INPUT: - - ``k`` -- a non-negative integer + - ``k`` -- nonnegative integer - ``top_dim`` -- stop the computation at this degree (default: ``None``, but required if the algebra is not finite-dimensional) - - ``verbose`` -- (default: ``False``) a boolean to control if + - ``verbose`` -- boolean (default: ``False``); control if log messages should be emitted - OUTPUT: a list of homomorphisms `[\epsilon, f_1, \ldots, f_k]` such that + OUTPUT: list of homomorphisms `[\epsilon, f_1, \ldots, f_k]` such that .. MATH:: @@ -1307,7 +1307,7 @@ def _print_progress(i, k): print('Computing f_%d (%d/%d)' % (i, i, k)) if k < 0: - raise ValueError('the length of the resolution must be non-negative') + raise ValueError('the length of the resolution must be nonnegative') ret_complex = [] diff --git a/src/sage/modules/fp_graded/morphism.py b/src/sage/modules/fp_graded/morphism.py index 04d917b1116..890178110a6 100755 --- a/src/sage/modules/fp_graded/morphism.py +++ b/src/sage/modules/fp_graded/morphism.py @@ -45,11 +45,11 @@ def _create_relations_matrix(module, relations, source_degs, target_degs): INPUT: - ``module`` -- the module where the relations acts - - ``relations`` -- a list of lists of algebra coefficients defining the + - ``relations`` -- list of lists of algebra coefficients defining the matrix `R` - - ``source_degs`` -- a list of integer degrees; its length should be + - ``source_degs`` -- list of integer degrees; its length should be equal to the number of columns of `R` - - ``target_degs`` -- a list of integer degrees; its length should be + - ``target_degs`` -- list of integer degrees; its length should be equal to the number of rows of `R` Furthermore must the degrees given by the input satisfy the following:: @@ -60,12 +60,12 @@ def _create_relations_matrix(module, relations, source_degs, target_degs): OUTPUT: - - ``block_matrix`` -- A list of lists representing a matrix of linear + - ``block_matrix`` -- list of lists representing a matrix of linear transformations `(T_{ij})`. Each transformtion `T_{ij}` is the linear map representing multiplication by the coefficient `r_{ij}` restricted to the module elements of degree ``source_degs[j]``. - - ``R`` -- A matrix representing ``block_matrix`` as a single linear - transformation. + - ``R`` -- a matrix representing ``block_matrix`` as a single linear + transformation TESTS:: @@ -151,7 +151,7 @@ class FPModuleMorphism(Morphism): INPUT: - ``parent`` -- a homspace of finitely presented graded modules - - ``values`` -- a list of elements in the codomain; each element + - ``values`` -- list of elements in the codomain; each element corresponds to a module generator in the domain - ``check`` -- boolean (default: ``True``); if ``True``, check that the morphism is well-defined @@ -694,7 +694,7 @@ def __call__(self, x): INPUT: - - ``x`` -- an element of the domain of the homomorphism + - ``x`` -- an element of the domain of the homomorphism OUTPUT: @@ -769,7 +769,7 @@ def vector_presentation(self, n): Return the restriction of ``self`` to the domain module elements of degree ``n``. - The restriction of a non-zero module homomorphism to the free module + The restriction of a nonzero module homomorphism to the free module of module elements of degree `n` is a linear function into the free module of elements of degree `n+d` belonging to the codomain. Here `d` is the degree of this homomorphism. @@ -780,7 +780,7 @@ def vector_presentation(self, n): INPUT: - - ``n`` -- an integer degree + - ``n`` -- integer degree OUTPUT: @@ -1244,7 +1244,7 @@ def split(self, verbose=False): INPUT: - - ``verbose`` -- boolean (default: ``False``); enable progress messages + - ``verbose`` -- boolean (default: ``False``); enable progress messages OUTPUT: @@ -1344,7 +1344,7 @@ def suspension(self, t): INPUT: - - ``t`` -- an integer by which the morphism is suspended + - ``t`` -- integer by which the morphism is suspended OUTPUT: the morphism which is the suspension of ``self`` by the degree ``t`` @@ -1959,7 +1959,7 @@ def fp_module(self): @cached_function def _top_dim(algebra): r""" - The top dimension of ``algebra`` + The top dimension of ``algebra``. This returns infinity if the algebra is infinite-dimensional. If the algebra has a ``top_class`` method, then it is used in the diff --git a/src/sage/modules/fp_graded/steenrod/module.py b/src/sage/modules/fp_graded/steenrod/module.py index 180222857e1..e799fadf389 100755 --- a/src/sage/modules/fp_graded/steenrod/module.py +++ b/src/sage/modules/fp_graded/steenrod/module.py @@ -249,7 +249,7 @@ def export_module_definition(self, powers_of_two_only=True): # A private function which transforms a vector in a given dimension # to a vector of global indices for the basis elements corresponding - # to the non-zero entries in the vector. E.g. + # to the nonzero entries in the vector. E.g. # _GetIndices(dim=2, vec=(1,0,1)) will return a vector of length two, # (a, b), where a is the index of the first vector in the basis for # the 2-dimensional part of the module, and b is the index of the @@ -357,11 +357,12 @@ def resolution(self, k, top_dim=None, verbose=False): INPUT: - - ``k`` -- non-negative integer + - ``k`` -- nonnegative integer - ``top_dim`` -- (optional) stop the computation at this degree - - ``verbose`` -- (default: ``False``) whether log messages are printed + - ``verbose`` -- boolean (default: ``False``); whether log messages are + printed - OUTPUT: a list of homomorphisms `[\epsilon, f_1, \ldots, f_k]` such that + OUTPUT: list of homomorphisms `[\epsilon, f_1, \ldots, f_k]` such that .. MATH:: diff --git a/src/sage/modules/fp_graded/steenrod/morphism.py b/src/sage/modules/fp_graded/steenrod/morphism.py index e2949ef6387..2a57af86866 100755 --- a/src/sage/modules/fp_graded/steenrod/morphism.py +++ b/src/sage/modules/fp_graded/steenrod/morphism.py @@ -98,7 +98,8 @@ def is_injective(self, top_dim=None, verbose=False): - ``top_dim`` -- (optional) stop the computation at this degree; if not specified, this is determined using :meth:`profile` - - ``verbose`` -- (default: ``False``) whether log messages are printed + - ``verbose`` -- boolean (default: ``False``); whether log messages are + printed EXAMPLES:: @@ -131,7 +132,8 @@ def kernel_inclusion(self, top_dim=None, verbose=False): - ``top_dim`` -- (optional) stop the computation at this degree; if not specified, this is determined using :meth:`profile` - - ``verbose`` -- (default: ``False``) whether log messages are printed + - ``verbose`` -- boolean (default: ``False``); whether log messages are + printed OUTPUT: an injective homomorphism into the domain ``self`` which is onto the kernel of this homomorphism. @@ -176,7 +178,8 @@ def cokernel_projection(self, verbose=False): INPUT: - - ``verbose`` -- (default: ``False``) whether log messages are printed + - ``verbose`` -- boolean (default: ``False``); whether log messages are + printed OUTPUT: @@ -221,7 +224,8 @@ def image(self, top_dim=None, verbose=False): - ``top_dim`` -- integer (optional); used by this function to stop the computation at the given degree - - ``verbose`` -- (default: ``False``) whether log messages are printed + - ``verbose`` -- boolean (default: ``False``); whether log messages are + printed OUTPUT: @@ -263,7 +267,6 @@ def image(self, top_dim=None, verbose=False): sage: g.is_zero() True - """ return self._action(FPModuleMorphism.image, top_dim=top_dim, verbose=verbose) @@ -275,7 +278,8 @@ def _resolve_kernel(self, top_dim=None, verbose=False): - ``top_dim`` -- (optional) stop the computation at this degree; if not specified, this is determined using :meth:`profile` - - ``verbose`` -- (default: ``False``) whether log messages are printed + - ``verbose`` -- boolean (default: ``False``); whether log messages are + printed OUTPUT: a homomorphism `j: F \rightarrow D` where `D` is the domain of this homomorphism, `F` is free and such that `\ker(self) = \operatorname{im}(j)`. @@ -322,7 +326,8 @@ def _resolve_image(self, top_dim=None, verbose=False): - ``top_dim`` -- (optional) stop the computation at this degree; if not specified, this is determined using :meth:`profile` - - ``verbose`` -- (default: ``False``) whether log messages are printed + - ``verbose`` -- boolean (default: ``False``); whether log messages are + printed OUTPUT: a homomorphism `j: F \rightarrow C` where `C` is the codomain of this homomorphism, `F` is free, and diff --git a/src/sage/modules/fp_graded/steenrod/profile.py b/src/sage/modules/fp_graded/steenrod/profile.py index 49bcc6b8149..7326eb37eaf 100755 --- a/src/sage/modules/fp_graded/steenrod/profile.py +++ b/src/sage/modules/fp_graded/steenrod/profile.py @@ -41,7 +41,7 @@ def profile_elt(elt, char=2): - ``elt`` -- element of the Steenrod algebra (or a sub-Hopf algebra of it) or list(s) representing it - - ``char`` (default: 2) -- the characteristic + - ``char`` -- (default: 2) the characteristic ``elt`` could also be a list (when ``char=2``) or a pair of lists (otherwise), in which case it is treated as corresponding to an @@ -102,7 +102,7 @@ def enveloping_profile_elements(alist, char=2): INPUT: - ``alist`` -- list of Steenrod algebra elements - - ``char`` (default: 2) -- the characteristic + - ``char`` -- (default: 2) the characteristic As with :func:`profile_elt`, the entries of ``alist`` could also be iterables or pairs of iterables. @@ -155,16 +155,14 @@ def enveloping_profile_elements(alist, char=2): def find_min_profile(prof, char=2): r""" Return the smallest valid profile function containing a tuple of - non-negative integers, + nonnegative integers. INPUT: - - ``prof`` -- a list or tuple of nonnegative integers - - ``char`` (default: 2) -- the characteristic + - ``prof`` -- list or tuple of nonnegative integers + - ``char`` -- (default: 2) the characteristic - OUTPUT: - - - a valid profile containing ``prof`` + OUTPUT: a valid profile containing ``prof`` A profile function `e` must satisfy `e(r) \geq \min( e(r-i) - i, e(i))` for all `0 < i < r`, and at odd primes, if `k(i+j) = 1`, diff --git a/src/sage/modules/free_module.py b/src/sage/modules/free_module.py index 0441bcb84f8..c7395d0a704 100644 --- a/src/sage/modules/free_module.py +++ b/src/sage/modules/free_module.py @@ -308,7 +308,7 @@ def create_object(self, version, key): def FreeModule(base_ring, rank_or_basis_keys=None, sparse=False, inner_product_matrix=None, *, with_basis='standard', rank=None, basis_keys=None, **args): r""" - Create a free module over the given commutative ``base_ring`` + Create a free module over the given commutative ``base_ring``. ``FreeModule`` can be called with the following positional arguments: @@ -318,22 +318,22 @@ def FreeModule(base_ring, rank_or_basis_keys=None, sparse=False, inner_product_m INPUT: - - ``base_ring`` -- a commutative ring + - ``base_ring`` -- a commutative ring - - ``rank`` -- a nonnegative integer + - ``rank`` -- nonnegative integer - - ``basis_keys`` -- a finite or enumerated family of arbitrary objects + - ``basis_keys`` -- a finite or enumerated family of arbitrary objects - - ``sparse`` -- boolean (default ``False``) + - ``sparse`` -- boolean (default: ``False``) - - ``inner_product_matrix`` -- the inner product matrix (default ``None``) + - ``inner_product_matrix`` -- the inner product matrix (default: ``None``) - - ``with_basis`` -- either ``"standard"`` (the default), in which case - a free module with the standard basis as the distinguished basis is created; - or ``None``, in which case a free module without distinguished basis is - created. + - ``with_basis`` -- either ``'standard'`` (the default), in which case + a free module with the standard basis as the distinguished basis is created; + or ``None``, in which case a free module without distinguished basis is + created. - - further options may be accepted by various implementation classes + - further options may be accepted by various implementation classes OUTPUT: a free module @@ -341,9 +341,9 @@ def FreeModule(base_ring, rank_or_basis_keys=None, sparse=False, inner_product_m depending on the input. Not all combinations of options are implemented. - - If the parameter ``basis_keys`` is provided, it must be a finite - or enumerated family of objects, and an instance of - :class:`CombinatorialFreeModule` is created. + - If the parameter ``basis_keys`` is provided, it must be a finite + or enumerated family of objects, and an instance of + :class:`CombinatorialFreeModule` is created. EXAMPLES:: @@ -355,9 +355,9 @@ def FreeModule(base_ring, rank_or_basis_keys=None, sparse=False, inner_product_m for more examples and details, including its :class:`UniqueRepresentation` semantics. - - If the parameter ``with_basis`` is set to ``None``, then a free module - of the given ``rank`` without distinguished basis is created. It is - represented by an instance of :class:`FiniteRankFreeModule`. + - If the parameter ``with_basis`` is set to ``None``, then a free module + of the given ``rank`` without distinguished basis is created. It is + represented by an instance of :class:`FiniteRankFreeModule`. EXAMPLES:: @@ -367,20 +367,19 @@ def FreeModule(base_ring, rank_or_basis_keys=None, sparse=False, inner_product_m See the documentation of :class:`FiniteRankFreeModule` for more options, examples, and details. - - If ``rank`` is provided and the option ``with_basis`` is left at its - default value, ``"standard"``, then a free ambient module with - distinguished standard basis indexed by ``range(rank)`` is created. - There is only one dense and one sparse free ambient module of - given ``rank`` over ``base_ring``. - - EXAMPLES:: + - If ``rank`` is provided and the option ``with_basis`` is left at its + default value, ``'standard'``, then a free ambient module with + distinguished standard basis indexed by ``range(rank)`` is created. + There is only one dense and one sparse free ambient module of + given ``rank`` over ``base_ring``. - sage: FreeModule(Integers(8), 10) - Ambient free module of rank 10 over Ring of integers modulo 8 + EXAMPLES:: - The remainder of this documentation discusses this case of - free ambient modules. + sage: FreeModule(Integers(8), 10) + Ambient free module of rank 10 over Ring of integers modulo 8 + The remainder of this documentation discusses this case of + free ambient modules. EXAMPLES: @@ -485,7 +484,6 @@ def FreeModule(base_ring, rank_or_basis_keys=None, sparse=False, inner_product_m Refactor modules such that it only counts what category the base ring belongs to, but not what is its Python class. - EXAMPLES:: sage: FreeModule(QQ, ['a', 'b', 'c']) @@ -622,16 +620,16 @@ def span(gens, base_ring=None, check=True, already_echelonized=False): INPUT: - - ``gens`` -- a list of either vectors or lists of ring elements + - ``gens`` -- list of either vectors or lists of ring elements used to generate the span - - ``base_ring`` -- (default: ``None``); a principal ideal domain + - ``base_ring`` -- (default: ``None``) a principal ideal domain for the ring of scalars - - ``check`` -- (default: ``True``); passed to the ``span()`` method + - ``check`` -- (default: ``True``) passed to the ``span()`` method of the ambient module - - ``already_echelonized`` -- (default: ``False``); set to ``True`` + - ``already_echelonized`` -- (default: ``False``) set to ``True`` if the vectors form the rows of a matrix in echelon form, in order to skip the computation of an echelonized basis for the span. @@ -845,7 +843,7 @@ def basis_seq(V, vecs): def is_FreeModule(M): """ - Return True if M inherits from FreeModule_generic. + Return ``True`` if M inherits from ``FreeModule_generic``. EXAMPLES:: @@ -882,7 +880,7 @@ class Module_free_ambient(Module): - ``base_ring`` -- a commutative ring - - ``degree`` -- a non-negative integer; degree of the ambient free module + - ``degree`` -- nonnegative integer; degree of the ambient free module - ``sparse`` -- boolean (default: ``False``) @@ -1608,11 +1606,11 @@ def span(self, gens, base_ring=None, check=True, already_echelonized=False): INPUT: - - ``gens`` -- a list of vectors + - ``gens`` -- list of vectors - ``base_ring`` -- (optional) a ring - - ``check`` -- boolean (default: ``True``): whether or not to + - ``check`` -- boolean (default: ``True``); whether or not to coerce entries of gens into base field - ``already_echelonized`` -- boolean (default: ``False``); @@ -1736,9 +1734,9 @@ def submodule(self, gens, check=True, already_echelonized=False): INPUT: - - ``gens`` -- a list of free module elements or a free module + - ``gens`` -- list of free module elements or a free module - - ``check`` -- (default: ``True``) whether or not to verify + - ``check`` -- boolean (default: ``True``); whether or not to verify that the gens are in ``self`` OUTPUT: @@ -1819,7 +1817,7 @@ def quotient_module(self, sub, check=True): - ``sub`` -- a submodule of ``self`` or something that can be turned into one via ``self.submodule(sub)`` - - ``check`` -- (default: ``True``) whether or not to check that + - ``check`` -- boolean (default: ``True``); whether or not to check that ``sub`` is a submodule EXAMPLES:: @@ -1940,9 +1938,9 @@ class FreeModule_generic(Module_free_ambient): - ``base_ring`` -- a commutative ring - - ``rank`` -- a non-negative integer + - ``rank`` -- nonnegative integer - - ``degree`` -- a non-negative integer + - ``degree`` -- nonnegative integer - ``sparse`` -- boolean (default: ``False``) @@ -2012,7 +2010,6 @@ def __init__(self, base_ring, rank, degree, sparse=False, sage: N.element_class - """ if base_ring not in CommutativeRings(): warn("You are constructing a free module\n" @@ -2039,7 +2036,7 @@ def __init__(self, base_ring, rank, degree, sparse=False, def construction(self): """ - The construction functor and base ring for self. + The construction functor and base ring for ``self``. EXAMPLES:: @@ -2102,9 +2099,9 @@ def dense_module(self): def _dense_module(self): """ - Creates a dense module with the same defining data as self. + Create a dense module with the same defining data as ``self``. - N.B. This function is for internal use only! See dense_module for + N.B. This function is for internal use only! See ``dense_module`` for use. EXAMPLES:: @@ -2159,9 +2156,9 @@ def sparse_module(self): def _sparse_module(self): """ - Creates a sparse module with the same defining data as self. + Create a sparse module with the same defining data as ``self``. - N.B. This function is for internal use only! See sparse_module for + N.B. This function is for internal use only! See ``sparse_module`` for use. EXAMPLES:: @@ -2181,7 +2178,7 @@ def _element_constructor_(self, x, coerce=True, copy=True, check=True): The ``coerce`` and ``copy`` arguments are passed on to the underlying element constructor. If ``check`` is ``True``, confirm that the - element specified by x does in fact lie in self. + element specified by x does in fact lie in ``self``. .. note:: @@ -2480,7 +2477,7 @@ def __iter__(self): if R in InfiniteEnumeratedSets(): # This makes iter(ZZ^n) produce vectors in a "natural" order, - # rather than only vectors with the first component non-zero. + # rather than only vectors with the first component nonzero. # Algorithm: Initial version which ordered by max-norm due to # Aleksei Udovenko, adapted by Lorenz Panny to order by 1-norm # primarily and by max-norm secondarily. @@ -2754,19 +2751,18 @@ def direct_sum(self, other): def coordinates(self, v, check=True): """ - Write `v` in terms of the basis for self. + Write `v` in terms of the basis for ``self``. INPUT: - ``v`` -- vector - - ``check`` -- boolean (default: ``True``); if ``True``, also verify that - `v` is really in ``self``. + - ``check`` -- boolean (default: ``True``); if ``True``, also verify + that `v` is really in ``self`` OUTPUT: list - Returns a list `c` such that if `B` is the basis - for self, then + Returns a list `c` such that if `B` is the basis for ``self``, then .. MATH:: @@ -2786,14 +2782,14 @@ def coordinates(self, v, check=True): def coordinate_vector(self, v, check=True): """ Return the vector whose coefficients give `v` as a linear - combination of the basis for self. + combination of the basis for ``self``. INPUT: - ``v`` -- vector - ``check`` -- boolean (default: ``True``); if ``True``, also verify that - `v` is really in ``self``. + `v` is really in ``self`` OUTPUT: list @@ -3008,9 +3004,9 @@ def gen(self, i=0): INPUT: - - `i` -- an integer (default 0) + - ``i`` -- integer (default: 0) - OUTPUT: `i`-th basis vector for ``self``. + OUTPUT: `i`-th basis vector for ``self`` EXAMPLES:: @@ -3093,12 +3089,12 @@ def hom(self, im_gens, codomain=None, **kwds): EXAMPLES:: - sage: W = ZZ^2; W.hom(matrix(1, [1, 2]), side="right") + sage: W = ZZ^2; W.hom(matrix(1, [1, 2]), side='right') Free module morphism defined as left-multiplication by the matrix [1 2] Domain: Ambient free module of rank 2 over the principal ideal domain Integer Ring Codomain: Ambient free module of rank 1 over the principal ideal domain Integer Ring - sage: V = QQ^2; V.hom(identity_matrix(2), side="right") + sage: V = QQ^2; V.hom(identity_matrix(2), side='right') Vector space morphism represented as left-multiplication by the matrix: [1 0] [0 1] @@ -3163,7 +3159,7 @@ def _inner_product_is_dot_product(self): def is_ambient(self): """ - Returns False since this is not an ambient free module. + Return ``False`` since this is not an ambient free module. EXAMPLES:: @@ -3189,7 +3185,7 @@ def is_ambient(self): def is_dense(self): """ Return ``True`` if the underlying representation of - this module uses dense vectors, and False otherwise. + this module uses dense vectors, and ``False`` otherwise. EXAMPLES:: @@ -3217,7 +3213,7 @@ def is_full(self): def is_finite(self): """ - Returns True if the underlying set of this free module is finite. + Return ``True`` if the underlying set of this free module is finite. EXAMPLES:: @@ -3232,7 +3228,7 @@ def is_finite(self): def ngens(self): """ - Returns the number of basis elements of this free module. + Return the number of basis elements of this free module. EXAMPLES:: @@ -3251,7 +3247,7 @@ def ngens(self): def nonembedded_free_module(self): """ - Returns an ambient free module that is isomorphic to this free + Return an ambient free module that is isomorphic to this free module. Thus if this free module is of rank `n` over a ring @@ -3267,16 +3263,16 @@ def nonembedded_free_module(self): def random_element(self, prob=1.0, *args, **kwds): """ - Returns a random element of self. + Return a random element of ``self``. INPUT: - ``prob`` -- float. Each coefficient will be set to zero with - probability `1-prob`. Otherwise coefficients will be chosen - randomly from base ring (and may be zero). + probability `1-prob`. Otherwise coefficients will be chosen + randomly from base ring (and may be zero). - ``*args``, ``**kwds`` -- passed on to the :func:`random_element` - function of the base ring. + function of the base ring EXAMPLES:: @@ -3325,7 +3321,7 @@ def rank(self): def __bool__(self): """ Return ``True`` if and only if the rank of this module is - non-zero. In other words, this returns ``False`` for the zero + nonzero. In other words, this returns ``False`` for the zero module and ``True`` otherwise (apart from the exceptional case where the base ring is the zero ring). @@ -3617,7 +3613,6 @@ def _mul_(self, other, switch_sides=False): over Finite Field of size 2 Basis matrix: [1 1] - """ B = self.basis_matrix() B = other * B if switch_sides else B * other @@ -3665,8 +3660,8 @@ def __init__(self, base_ring, rank, degree, sparse=False, coordinate_ring=None, def __add__(self, other): r""" - Return the sum of ``self`` and other, where both ``self`` and ``other`` must be - submodules of the ambient vector space. + Return the sum of ``self`` and ``other``, where both ``self`` and + ``other`` must be submodules of the ambient vector space. EXAMPLES: @@ -4034,7 +4029,7 @@ def index_in_saturation(self): def saturation(self): r""" Return the saturated submodule of `R^n` that spans the same - vector space as self. + vector space as ``self``. EXAMPLES: @@ -4177,19 +4172,17 @@ def span_of_basis(self, basis, base_ring=None, check=True, already_echelonized=F def submodule_with_basis(self, basis, check=True, already_echelonized=False): r""" - Create the R-submodule of the ambient vector space with given - basis, where R is the base ring of self. + Create the `R`-submodule of the ambient vector space with given + basis, where `R` is the base ring of ``self``. INPUT: - - ``basis`` -- a list of linearly independent vectors + - ``basis`` -- list of linearly independent vectors - ``check`` -- whether or not to verify that each gen is in - the ambient vector space - - OUTPUT: + the ambient vector space - - ``FreeModule`` -- the `R`-submodule with given basis + OUTPUT: ``FreeModule``; the `R`-submodule with given basis EXAMPLES: @@ -4256,12 +4249,10 @@ def vector_space_span(self, gens, check=True): INPUT: + - ``gens`` -- list of vector in ``self`` - - ``gens`` -- a list of vector in self - - - ``check`` -- whether or not to verify that each gen - is in the ambient vector space - + - ``check`` -- whether or not to verify that each gen + is in the ambient vector space OUTPUT: a vector subspace @@ -4318,10 +4309,10 @@ def vector_space_span_of_basis(self, basis, check=True): INPUT: - - ``basis`` -- a list of linearly independent vectors + - ``basis`` -- list of linearly independent vectors - ``check`` -- whether or not to verify that each gen is in - the ambient vector space + the ambient vector space OUTPUT: a vector subspace with user-specified basis @@ -4347,7 +4338,7 @@ def quotient_module(self, sub, check=True, **kwds): - ``sub`` -- a submodule of ``self``, or something that can be turned into one via ``self.submodule(sub)`` - - ``check`` -- (default: ``True``) whether or not to check + - ``check`` -- boolean (default: ``True``); whether or not to check that ``sub`` is a submodule - further named arguments, that are passed to the constructor @@ -4379,7 +4370,7 @@ class FreeModule_generic_field(FreeModule_generic_pid): """ def __init__(self, base_field, dimension, degree, sparse=False, category=None): """ - Creates a vector space over a field. + Create a vector space over a field. EXAMPLES:: @@ -4402,7 +4393,7 @@ def __init__(self, base_field, dimension, degree, sparse=False, category=None): def _Hom_(self, Y, category): r""" - Returns a homspace whose morphisms have this vector space as domain. + Return a homspace whose morphisms have this vector space as domain. This is called by the general methods such as :meth:`sage.structure.parent.Parent.Hom`. @@ -4497,7 +4488,7 @@ def scale(self, other): def __add__(self, other): """ - Return the sum of ``self`` and other. + Return the sum of ``self`` and ``other``. EXAMPLES:: @@ -4539,8 +4530,8 @@ def echelonized_basis_matrix(self): def intersection(self, other): """ - Return the intersection of ``self`` and other, which must be - R-submodules of a common ambient vector space. + Return the intersection of ``self`` and ``other``, which must be + `R`-submodules of a common ambient vector space. EXAMPLES:: @@ -4637,7 +4628,7 @@ def intersection(self, other): def is_subspace(self, other): """ - True if this vector space is a subspace of other. + ``True`` if this vector space is a subspace of ``other``. EXAMPLES:: @@ -4661,19 +4652,17 @@ def span_of_basis(self, basis, base_ring=None, check=True, already_echelonized=F field of ``self`` or user specified base_ring. Note that this span is a subspace of the ambient vector space, but - need not be a subspace of self. + need not be a subspace of ``self``. INPUT: + - ``basis`` -- list of vectors - - ``basis`` -- list of vectors - - - ``check`` -- boolean (default: ``True``): whether or not to - coerce entries of gens into base field - - - ``already_echelonized`` -- boolean (default: ``False``): - set this if you know the gens are already in echelon form + - ``check`` -- boolean (default: ``True``); whether or not to + coerce entries of gens into base field + - ``already_echelonized`` -- boolean (default: ``False``); + set this if you know the gens are already in echelon form EXAMPLES:: @@ -4718,13 +4707,13 @@ def subspace(self, gens, check=True, already_echelonized=False): INPUT: - - ``gens`` -- list of vectors + - ``gens`` -- list of vectors - - ``check`` -- boolean (default: ``True``) verify that gens - are all in ``self``. + - ``check`` -- boolean (default: ``True``); verify that gens + are all in ``self`` - - ``already_echelonized`` -- boolean (default: ``False``) set - to True if you know the gens are in Echelon form. + - ``already_echelonized`` -- boolean (default: ``False``); set + to ``True`` if you know the gens are in Echelon form EXAMPLES: @@ -4763,7 +4752,7 @@ def subspaces(self, dim): INPUT: - - ``dim`` -- int, dimension of subspaces to be generated + - ``dim`` -- integer; dimension of subspaces to be generated EXAMPLES:: @@ -4920,8 +4909,8 @@ def complement(self): def vector_space(self, base_field=None): """ - Return the vector space associated to self. Since ``self`` is a vector - space this function simply returns self, unless the base field is + Return the vector space associated to ``self``. Since ``self`` is a vector + space this function simply returns ``self``, unless the base field is different. EXAMPLES:: @@ -4941,7 +4930,7 @@ def vector_space(self, base_field=None): def zero_submodule(self): """ - Return the zero submodule of self. + Return the zero submodule of ``self``. EXAMPLES:: @@ -4954,7 +4943,7 @@ def zero_submodule(self): def zero_subspace(self): """ - Return the zero subspace of self. + Return the zero subspace of ``self``. EXAMPLES:: @@ -4967,19 +4956,21 @@ def zero_subspace(self): def linear_dependence(self, vectors, zeros='left', check=True): r""" - Returns a list of vectors giving relations of linear dependence for the input list of vectors. + Return a list of vectors giving relations of linear dependence for the + input list of vectors. + Can be used to check linear independence of a set of vectors. INPUT: - - ``vectors`` -- A list of vectors, all from the same vector - space. + - ``vectors`` -- list of vectors; all from the same vector + space - - ``zeros`` -- (default: ``'left'``); ``'left'`` or ``'right'`` + - ``zeros`` -- (default: ``'left'``) ``'left'`` or ``'right'`` as a general preference for where zeros are located in the returned coefficients - - ``check`` -- (default: ``True``); if ``True`` each item in + - ``check`` -- (default: ``True``) if ``True`` each item in the list ``vectors`` is checked for membership in ``self``. Set to ``False`` if you can be certain the vectors come from the vector space. @@ -4996,7 +4987,7 @@ def linear_dependence(self, vectors, zeros='left', check=True): list being empty, so this provides a test - see the examples below. The returned vectors are always independent, and with ``zeros`` set to - ``'left'`` they have 1's in their first non-zero entries and a qualitative + ``'left'`` they have 1's in their first nonzero entries and a qualitative disposition to having zeros in the low-index entries. With ``zeros`` set to ``'right'`` the situation is reversed with a qualitative disposition for zeros in the high-index entries. @@ -5163,7 +5154,7 @@ def quotient_module(self, sub, check=True): - ``sub`` -- a submodule of ``self``, or something that can be turned into one via ``self.submodule(sub)`` - - ``check`` -- (default: ``True``) whether or not to check + - ``check`` -- boolean (default: ``True``); whether or not to check that ``sub`` is a submodule EXAMPLES:: @@ -5301,22 +5292,21 @@ def quotient_abstract(self, sub, check=True, **kwds): INPUT: - - ``sub`` -- a submodule of ``self`` or something that can - be turned into one via ``self.submodule(sub)`` + - ``sub`` -- a submodule of ``self`` or something that can + be turned into one via ``self.submodule(sub)`` - - ``check`` -- (default: ``True``) whether or not to check - that sub is a submodule + - ``check`` -- boolean (default: ``True``); whether or not to check + that sub is a submodule - further named arguments, that are currently ignored. OUTPUT: - - ``U`` -- the quotient as an abstract *ambient* free module - - - ``pi`` -- projection map to the quotient + - ``U``; the quotient as an abstract *ambient* free module - - ``lift`` -- lifting map back from quotient + - ``pi``; projection map to the quotient + - ``lift``; lifting map back from quotient EXAMPLES:: @@ -5373,11 +5363,11 @@ def __init__(self, base_ring, rank, sparse=False, coordinate_ring=None, category INPUT: - - ``base_ring`` -- a commutative ring + - ``base_ring`` -- a commutative ring - - ``rank`` -- a non-negative integer + - ``rank`` -- nonnegative integer - - ``sparse`` -- boolean (default: ``False``) + - ``sparse`` -- boolean (default: ``False``) - ``coordinate_ring`` -- a ring containing ``base_ring`` (default: equal to ``base_ring``) @@ -5464,7 +5454,7 @@ def _coerce_map_from_(self, M): def _dense_module(self): """ - Creates a dense module with the same defining data as self. + Create a dense module with the same defining data as ``self``. N.B. This function is for internal use only! See dense_module for use. @@ -5480,7 +5470,7 @@ def _dense_module(self): def _sparse_module(self): """ - Creates a sparse module with the same defining data as self. + Create a sparse module with the same defining data as ``self``. N.B. This function is for internal use only! See sparse_module for use. @@ -5496,7 +5486,7 @@ def _sparse_module(self): def echelonized_basis_matrix(self): """ - The echelonized basis matrix of self. + The echelonized basis matrix of ``self``. EXAMPLES:: @@ -5631,7 +5621,7 @@ def _echelon_matrix_richcmp(self, other, op): def _repr_(self): """ - The printing representation of self. + The printing representation of ``self``. EXAMPLES:: @@ -5733,10 +5723,8 @@ def basis(self): OUTPUT: - - - ``Sequence`` -- an immutable sequence with universe - this ambient free module - + - ``Sequence`` -- an immutable sequence with universe + this ambient free module EXAMPLES:: @@ -5873,10 +5861,10 @@ def echelon_coordinate_vector(self, v, check=True): INPUT: - - ``v`` -- vector + - ``v`` -- vector - - ``check`` -- boolean (default: ``True``); if True, also - verify that `v` is really in ``self``. + - ``check`` -- boolean (default: ``True``); if ``True``, also + verify that `v` is really in ``self`` OUTPUT: list @@ -5900,8 +5888,8 @@ def echelon_coordinate_vector(self, v, check=True): def echelon_coordinates(self, v, check=True): """ - Returns the coordinate vector of v in terms of the echelon basis - for self. + Return the coordinate vector of v in terms of the echelon basis + for ``self``. EXAMPLES:: @@ -5935,18 +5923,16 @@ def echelon_coordinates(self, v, check=True): def random_element(self, prob=1.0, *args, **kwds): """ - Returns a random element of self. + Return a random element of ``self``. INPUT: - - ``prob`` -- float. Each coefficient will be set to zero with - probability `1-prob`. Otherwise coefficients will be chosen + probability `1-prob`. Otherwise coefficients will be chosen randomly from base ring (and may be zero). - ``*args``, ``**kwds`` -- passed on to random_element function of base - ring. - + ring EXAMPLES:: @@ -6009,9 +5995,9 @@ def gen(self, i=0): INPUT: - - `i` -- an integer (default 0) + - ``i`` -- integer (default: 0) - OUTPUT: `i`-th basis vector for ``self``. + OUTPUT: `i`-th basis vector for ``self`` EXAMPLES:: @@ -6193,8 +6179,8 @@ def coordinate_vector(self, v, check=True): - ``v`` -- vector - - ``check`` -- boolean (default: ``True``); if ``True``, also verify that - `v` is really in ``self``. + - ``check`` -- boolean (default: ``True``); if ``True``, also verify + that `v` is really in ``self`` OUTPUT: list @@ -6228,7 +6214,7 @@ def coordinate_vector(self, v, check=True): def vector_space(self, base_field=None): """ - Returns the vector space obtained from ``self`` by tensoring with the + Return the vector space obtained from ``self`` by tensoring with the fraction field of the base ring and extending to the field. EXAMPLES:: @@ -6262,7 +6248,7 @@ def __init__(self, base_ring, rank, sparse=False, coordinate_ring=None, category - ``base_ring`` -- a principal ideal domain - - ``rank`` -- a non-negative integer + - ``rank`` -- nonnegative integer - ``sparse`` -- boolean (default: ``False``) @@ -6292,7 +6278,7 @@ def __init__(self, base_ring, rank, sparse=False, coordinate_ring=None, category def _repr_(self) -> str: """ - The printing representation of self. + The printing representation of ``self``. EXAMPLES:: @@ -6344,9 +6330,6 @@ def _repr_(self) -> str: ############################################################################### class FreeModule_ambient_field(FreeModule_generic_field, FreeModule_ambient_pid): - """ - - """ def __init__(self, base_field, dimension, sparse=False, category=None): """ Create the ambient vector space of given dimension over the given @@ -6354,11 +6337,11 @@ def __init__(self, base_field, dimension, sparse=False, category=None): INPUT: - - ``base_field`` -- a field + - ``base_field`` -- a field - - ``dimension`` -- a non-negative integer + - ``dimension`` -- nonnegative integer - - ``sparse`` -- boolean (default: ``False``) + - ``sparse`` -- boolean (default: ``False``) EXAMPLES:: @@ -6369,7 +6352,7 @@ def __init__(self, base_field, dimension, sparse=False, category=None): def _repr_(self): """ - The printing representation of self. + The printing representation of ``self``. EXAMPLES:: @@ -6413,7 +6396,7 @@ def _repr_(self): def ambient_vector_space(self): """ - Returns ``self`` as the ambient vector space. + Return ``self`` as the ambient vector space. EXAMPLES:: @@ -6425,7 +6408,7 @@ def ambient_vector_space(self): def base_field(self): """ - Returns the base field of this vector space. + Return the base field of this vector space. EXAMPLES:: @@ -6484,28 +6467,27 @@ class FreeModule_submodule_with_basis_pid(FreeModule_generic_pid): INPUT: - ``ambient`` -- ambient free module over a principal ideal domain `R`, - i.e. `R^n`; + i.e. `R^n` - ``basis`` -- list of elements of `K^n`, where `K` is the fraction field - of `R`. These elements must be linearly independent and will be used as - the default basis of the constructed submodule; + of `R`; these elements must be linearly independent and will be used as + the default basis of the constructed submodule - - ``check`` -- (default: ``True``) if ``False``, correctness of the input - will not be checked and type conversion may be omitted, use with care; + - ``check`` -- boolean (default: ``True``); if ``False``, correctness of + the input will not be checked and type conversion may be omitted, use + with care - - ``echelonize`` -- (default:``False``) if ``True``, ``basis`` will be + - ``echelonize`` -- (default: ``False``) if ``True``, ``basis`` will be echelonized and the result will be used as the default basis of the constructed submodule; - `` echelonized_basis`` -- (default: ``None``) if not ``None``, must be - the echelonized basis spanning the same submodule as ``basis``; - - - ``already_echelonized`` -- (default: ``False``) if ``True``, ``basis`` - must be already given in the echelonized form. + the echelonized basis spanning the same submodule as ``basis`` - OUTPUT: + - ``already_echelonized`` -- boolean (default: ``False``); if ``True``, + ``basis`` must be already given in the echelonized form - - `R`-submodule of `K^n` with the user-specified ``basis``. + OUTPUT: `R`-submodule of `K^n` with the user-specified ``basis`` EXAMPLES:: @@ -6645,7 +6627,7 @@ def __hash__(self): def _echelon_matrix_richcmp(self, other, op): r""" - Compare the free module ``self`` with other. + Compare the free module ``self`` with ``other``. Modules are ordered by their ambient spaces, then by dimension, then in order by their echelon matrices. @@ -6720,7 +6702,7 @@ def _echelon_matrix_richcmp(self, other, op): def construction(self): """ - Returns the functorial construction of self, namely, the subspace + Return the functorial construction of ``self``, namely, the subspace of the ambient module spanned by the given basis. EXAMPLES:: @@ -6814,7 +6796,6 @@ def _denominator(self, B): [ 0 23/6 46/3] sage: L._denominator(L.echelonized_basis_matrix().list()) 30 - """ if not B: return 1 @@ -6826,7 +6807,7 @@ def _denominator(self, B): def _repr_(self): """ - The printing representation of self. + The printing representation of ``self``. EXAMPLES:: @@ -6945,7 +6926,6 @@ def ambient(self): [5 7 9] sage: U.ambient() Ambient free module of rank 3 over the principal ideal domain Integer Ring - """ if self.base_ring() == self.coordinate_ring(): return self.ambient_module() @@ -7045,10 +7025,10 @@ def echelon_coordinates(self, v, check=True): INPUT: - - ``v`` -- vector + - ``v`` -- vector - - ``check`` -- boolean (default: ``True``); if ``True``, also - verify that `v` is really in ``self``. + - ``check`` -- boolean (default: ``True``); if ``True``, also + verify that `v` is really in ``self`` OUTPUT: list @@ -7160,10 +7140,10 @@ def user_to_echelon_matrix(self): def echelon_to_user_matrix(self): """ Return matrix that transforms the echelon basis to the user basis - of self. This is a matrix `A` such that if `v` is a + of ``self``. This is a matrix `A` such that if `v` is a vector written with respect to the echelon basis for ``self`` then `vA` is that vector written with respect to the user basis - of self. + of ``self``. EXAMPLES:: @@ -7179,7 +7159,7 @@ def echelon_to_user_matrix(self): [ 4/3 -1/3] The vector `(1,1,1)` has coordinates `v=(1,1)` with - respect to the echelonized basis for self. Multiplying `vA` + respect to the echelonized basis for ``self``. Multiplying `vA` we find the coordinates of this vector with respect to the user basis. @@ -7201,10 +7181,10 @@ def echelon_to_user_matrix(self): def _user_to_rref_matrix(self): """ - Returns a transformation matrix from the user specified basis to row + Return a transformation matrix from the user specified basis to row reduced echelon form, for this module over a PID. - Note: For internal use only! See user_to_echelon_matrix. + Note: For internal use only! See ``user_to_echelon_matrix``. EXAMPLES:: @@ -7233,10 +7213,10 @@ def _user_to_rref_matrix(self): def _rref_to_user_matrix(self): """ - Returns a transformation matrix from row reduced echelon form to + Return a transformation matrix from row reduced echelon form to the user specified basis, for this module over a PID. - Note: For internal use only! See user_to_echelon_matrix. + Note: For internal use only! See ``user_to_echelon_matrix``. EXAMPLES:: @@ -7262,7 +7242,7 @@ def _rref_to_user_matrix(self): def _echelon_to_rref_matrix(self): """ - Returns a transformation matrix from the some matrix to the row + Return a transformation matrix from the some matrix to the row reduced echelon form for this module over a PID. Note: For internal use only! and not used! @@ -7297,7 +7277,7 @@ def _echelon_to_rref_matrix(self): def _rref_to_echelon_matrix(self): """ - Returns a transformation matrix from row reduced echelon form to + Return a transformation matrix from row reduced echelon form to some matrix for this module over a PID. Note: For internal use only! @@ -7430,7 +7410,7 @@ def change_ring(self, R): INPUT: - - ``R`` -- a principal ideal domain + - ``R`` -- a principal ideal domain EXAMPLES:: @@ -7491,7 +7471,7 @@ def coordinate_vector(self, v, check=True): - ``v`` -- vector - ``check`` -- boolean (default: ``True``); if ``True``, also verify that - `v` is really in ``self``. + `v` is really in ``self`` OUTPUT: list @@ -7547,13 +7527,13 @@ def echelon_coordinate_vector(self, v, check=True): INPUT: - - ``v`` -- vector + - ``v`` -- vector - - ``check`` -- boolean (default: ``True``); if ``True``, also - verify that `v` is really in ``self``. + - ``check`` -- boolean (default: ``True``); if ``True``, also + verify that `v` is really in ``self`` Returns a list `c` such that if `B` is the echelonized basis - for self, then + for ``self``, then .. MATH:: @@ -7667,7 +7647,7 @@ def __init__(self, ambient, gens, check=True, already_echelonized=False, def _repr_(self): """ - The printing representation of self. + The printing representation of ``self``. EXAMPLES:: @@ -7703,7 +7683,7 @@ def coordinate_vector(self, v, check=True): - ``v`` -- vector - ``check`` -- boolean (default: ``True``); if ``True``, also verify that - `v` is really in ``self``. + `v` is really in ``self`` OUTPUT: list @@ -7825,7 +7805,7 @@ def __init__(self, ambient, basis, check=True, def _repr_(self): """ - The printing representation of self. + The printing representation of ``self``. EXAMPLES:: @@ -8026,7 +8006,7 @@ def __init__(self, ambient, gens, check=True, already_echelonized=False, categor def _repr_(self) -> str: """ - The default printing representation of self. + The default printing representation of ``self``. EXAMPLES:: @@ -8105,10 +8085,10 @@ def echelon_coordinates(self, v, check=True): INPUT: - - ``v`` -- vector + - ``v`` -- vector - - ``check`` -- boolean (default: ``True``); if ``True``, also - verify that `v` is really in ``self`` + - ``check`` -- boolean (default: ``True``); if ``True``, also + verify that `v` is really in ``self`` OUTPUT: list diff --git a/src/sage/modules/free_module_element.pyx b/src/sage/modules/free_module_element.pyx index e1e166b694f..8805bd79b86 100644 --- a/src/sage/modules/free_module_element.pyx +++ b/src/sage/modules/free_module_element.pyx @@ -178,14 +178,14 @@ def vector(arg0, arg1=None, arg2=None, sparse=None, immutable=False): INPUT: - - ``object`` -- a list, dictionary, or other + - ``object`` -- list, dictionary, or other iterable containing the entries of the vector, including any object that is palatable to the ``Sequence`` constructor - ``ring`` -- a base ring (or field) for the vector space or free module, which contains all of the elements - - ``degree`` -- an integer specifying the number of + - ``degree`` -- integer specifying the number of entries in the vector or free module element - ``sparse`` -- boolean, whether the result should be a sparse vector @@ -606,15 +606,15 @@ free_module_element = vector def prepare(v, R, degree=None): r""" - Converts an object describing elements of a vector into a list of entries in a common ring. + Convert an object describing elements of a vector into a list of entries in a common ring. INPUT: - - ``v`` -- a dictionary with non-negative integers as keys, + - ``v`` -- dictionary with nonnegative integers as keys, or a list or other object that can be converted by the ``Sequence`` constructor - ``R`` -- a ring containing all the entries, possibly given as ``None`` - - ``degree`` -- a requested size for the list when the input is a dictionary, + - ``degree`` -- a requested size for the list when the input is a dictionary, otherwise ignored OUTPUT: a pair @@ -635,7 +635,6 @@ def prepare(v, R, degree=None): has no elements and ``R`` is ``None``, the ring returned is the integers. - EXAMPLES:: sage: from sage.modules.free_module_element import prepare @@ -700,7 +699,7 @@ def prepare(v, R, degree=None): def zero_vector(arg0, arg1=None): r""" - Returns a vector or free module element with a specified number of zeros. + Return a vector or free module element with a specified number of zeros. CALL FORMATS: @@ -713,7 +712,7 @@ def zero_vector(arg0, arg1=None): - ``degree`` -- the number of zero entries in the vector or free module element - - ``ring`` -- (default: ``ZZ``); the base ring of the vector + - ``ring`` -- (default: ``ZZ``) the base ring of the vector space or module containing the constructed zero vector OUTPUT: @@ -778,14 +777,14 @@ def zero_vector(arg0, arg1=None): def random_vector(ring, degree=None, *args, **kwds): r""" - Returns a vector (or module element) with random entries. + Return a vector (or module element) with random entries. INPUT: - - ring -- (default: ``ZZ``); the base ring for the entries - - degree -- a non-negative integer for the number of entries in the vector - - sparse -- (default: ``False``); whether to use a sparse implementation - - args, kwds -- additional arguments and keywords are passed + - ``ring`` -- (default: ``ZZ``) the base ring for the entries + - ``degree`` -- nonnegative integer for the number of entries in the vector + - ``sparse`` -- (default: ``False``) whether to use a sparse implementation + - ``*args``, ``**kwds`` -- additional arguments and keywords are passed to the ``random_element()`` method of the ring OUTPUT: @@ -884,13 +883,13 @@ def random_vector(ring, degree=None, *args, **kwds): sage: from sage.misc.randstate import current_randstate sage: seed = current_randstate().seed() sage: set_random_seed(seed) - sage: v1 = random_vector(ZZ, 20, distribution="1/n") + sage: v1 = random_vector(ZZ, 20, distribution='1/n') sage: v2 = random_vector(ZZ, 15, x=-1000, y=1000) sage: v3 = random_vector(QQ, 10) sage: v4 = random_vector(FiniteField(17), 10) sage: v5 = random_vector(RR, 10) sage: set_random_seed(seed) - sage: w1 = vector(ZZ.random_element(distribution="1/n") for _ in range(20)) + sage: w1 = vector(ZZ.random_element(distribution='1/n') for _ in range(20)) sage: w2 = vector(ZZ.random_element(x=-1000, y=1000) for _ in range(15)) sage: w3 = vector(QQ.random_element() for _ in range(10)) sage: [v1, v2, v3] == [w1, w2, w3] @@ -917,7 +916,7 @@ def random_vector(ring, degree=None, *args, **kwds): sage: random_vector(ZZ, -9) Traceback (most recent call last): ... - ValueError: degree of a random vector must be non-negative, not -9 + ValueError: degree of a random vector must be nonnegative, not -9 """ if isinstance(ring, (Integer, int)): if degree is not None: @@ -929,7 +928,7 @@ def random_vector(ring, degree=None, *args, **kwds): if not isinstance(degree, (Integer, int)): raise TypeError("degree of a random vector must be an integer, not %s" % degree) if degree < 0: - raise ValueError("degree of a random vector must be non-negative, not %s" % degree) + raise ValueError("degree of a random vector must be nonnegative, not %s" % degree) if ring not in Rings(): raise TypeError("elements of a vector, or module element, must come from a ring, not %s" % ring) if not hasattr(ring, "random_element"): @@ -964,10 +963,10 @@ cdef class FreeModuleElement(Vector): # abstract base class INPUT: - - ``copy`` -- (default: ``True``) if ``self`` is internally - represented by a dictionary ``d``, then make a copy of ``d``; - if ``False``, then this can cause undesired behavior by - mutating ``d`` + - ``copy`` -- boolean (default: ``True``); if ``self`` is internally + represented by a dictionary ``d``, then make a copy of ``d``. + If ``False``, then this can cause undesired behavior by + mutating ``d``. EXAMPLES:: @@ -1061,7 +1060,7 @@ cdef class FreeModuleElement(Vector): # abstract base class Create the multiplication table of `GF(4)` using GP:: sage: # needs sage.libs.pari - sage: k. = GF(4, impl="pari_ffelt") + sage: k. = GF(4, impl='pari_ffelt') sage: v = gp(vector(list(k))) sage: v [0, 1, a, a + 1] @@ -1075,7 +1074,7 @@ cdef class FreeModuleElement(Vector): # abstract base class def _magma_init_(self, magma): r""" - Convert self to Magma. + Convert ``self`` to Magma. EXAMPLES:: @@ -1121,7 +1120,7 @@ cdef class FreeModuleElement(Vector): # abstract base class def numpy(self, dtype=object): """ - Convert self to a numpy array. + Convert ``self`` to a numpy array. INPUT: @@ -1210,7 +1209,7 @@ cdef class FreeModuleElement(Vector): # abstract base class def _vector_(self, R=None): r""" - Return self as a vector. + Return ``self`` as a vector. EXAMPLES:: @@ -1641,7 +1640,7 @@ cdef class FreeModuleElement(Vector): # abstract base class def additive_order(self): """ - Return the additive order of self. + Return the additive order of ``self``. EXAMPLES:: @@ -1718,8 +1717,8 @@ cdef class FreeModuleElement(Vector): # abstract base class INPUT: - - ``p`` -- default: 2 -- ``p`` can be a real number greater than 1, - infinity (``oo`` or ``Infinity``), or a symbolic expression. + - ``p`` -- (default: 2) ``p`` can be a real number greater than 1, + infinity (``oo`` or ``Infinity``), or a symbolic expression: - `p=1`: the taxicab (Manhattan) norm - `p=2`: the usual Euclidean norm (the default) @@ -1860,7 +1859,7 @@ cdef class FreeModuleElement(Vector): # abstract base class def __getitem__(self, i): """ - Return `i`-th entry or slice of self. + Return `i`-th entry or slice of ``self``. EXAMPLES:: @@ -1912,7 +1911,7 @@ cdef class FreeModuleElement(Vector): # abstract base class def __setitem__(self, i, value): """ - Set the `i`-th entry or slice of self to ``value``. + Set the `i`-th entry or slice of ``self`` to ``value``. EXAMPLES:: @@ -2024,12 +2023,12 @@ cdef class FreeModuleElement(Vector): # abstract base class def list(self, copy=True): """ - Return list of elements of self. + Return list of elements of ``self``. INPUT: - - copy -- bool, whether returned list is a copy that is - safe to change, is ignored. + - ``copy`` -- boolean (default: ``True``); whether returned list is a + copy that is safe to change (ignored) EXAMPLES:: @@ -2059,8 +2058,7 @@ cdef class FreeModuleElement(Vector): # abstract base class INPUT: - - positions -- iterable of ints - + - ``positions`` -- iterable of integers EXAMPLES:: @@ -2077,7 +2075,7 @@ cdef class FreeModuleElement(Vector): # abstract base class OUTPUT: - Return a lift of self to the covering ring of the base ring `R`, + Return a lift of ``self`` to the covering ring of the base ring `R`, which is by definition the ring returned by calling :meth:`~sage.rings.quotient_ring.QuotientRing_nc.cover_ring` on `R`, or just `R` itself if the @@ -2137,7 +2135,7 @@ cdef class FreeModuleElement(Vector): # abstract base class def __pos__(self): """ - Always returns self, since +self == self. + Always returns ``self``, since ``+self == self``. EXAMPLES:: @@ -2244,7 +2242,7 @@ cdef class FreeModuleElement(Vector): # abstract base class def denominator(self): """ Return the least common multiple of the denominators of the - entries of self. + entries of ``self``. EXAMPLES:: @@ -2290,14 +2288,12 @@ cdef class FreeModuleElement(Vector): # abstract base class INPUT: - - ``copy`` -- (default: ``True``) if ``self`` is internally - represented by a dictionary ``d``, then make a copy of ``d``; - if ``False``, then this can cause undesired behavior by - mutating ``d`` - - OUTPUT: + - ``copy`` -- boolean (default: ``True``); if ``self`` is internally + represented by a dictionary ``d``, then make a copy of ``d``. + If ``False``, then this can cause undesired behavior by + mutating ``d``. - - Python dictionary + OUTPUT: Python dictionary EXAMPLES:: @@ -2347,7 +2343,7 @@ cdef class FreeModuleElement(Vector): # abstract base class more than 3 dimensions. - ``start`` -- (default: origin in correct dimension) may be a tuple, - list, or vector. + list, or vector EXAMPLES: @@ -2484,22 +2480,21 @@ cdef class FreeModuleElement(Vector): # abstract base class r""" INPUT: - - ``xmin`` -- (default: 0) start x position to start - plotting + - ``xmin`` -- (default: 0) start x position to start + plotting - - ``xmax`` -- (default: 1) stop x position to stop - plotting + - ``xmax`` -- (default: 1) stop x position to stop + plotting - - ``eps`` -- (default: determined by xmax) we view this - vector as defining a function at the points xmin, xmin + eps, xmin - + 2\*eps, ..., + - ``eps`` -- (default: determined by xmax) we view this + vector as defining a function at the points xmin, xmin + eps, xmin + + 2\*eps, ..., - - ``res`` -- (default: all points) total number of - points to include in the graph - - - ``connect`` -- (default: ``True``) if True draws a line; - otherwise draw a list of points. + - ``res`` -- (default: all points) total number of + points to include in the graph + - ``connect`` -- boolean (default: ``True``); if ``True`` draws a line, + otherwise draw a list of points EXAMPLES:: @@ -2688,13 +2683,13 @@ cdef class FreeModuleElement(Vector): # abstract base class def cross_product(self, right): """ - Return the cross product of self and right, which is only defined + Return the cross product of ``self`` and ``right``, which is only defined for vectors of length 3 or 7. INPUT: - - ``right`` -- A vector of the same size as ``self``, either - degree three or degree seven. + - ``right`` -- a vector of the same size as ``self``, either + degree three or degree seven OUTPUT: @@ -2881,16 +2876,14 @@ cdef class FreeModuleElement(Vector): # abstract base class def pairwise_product(self, right): """ - Return the pairwise product of self and right, which is a vector of + Return the pairwise product of ``self`` and ``right``, which is a vector of the products of the corresponding entries. INPUT: - - - ``right`` -- vector of the same degree as self. It - need not be in the same vector space as self, as long as the - coefficients can be multiplied. - + - ``right`` -- vector of the same degree as ``self``. It + need not be in the same vector space as ``self``, as long as the + coefficients can be multiplied. EXAMPLES:: @@ -3065,7 +3058,6 @@ cdef class FreeModuleElement(Vector): # abstract base class of vector fields on Euclidean spaces (and more generally pseudo-Riemannian manifolds), in particular for computing the divergence in curvilinear coordinates. - """ if variables is None: variables = self._variables() @@ -3119,7 +3111,6 @@ cdef class FreeModuleElement(Vector): # abstract base class of vector fields on Euclidean spaces (and more generally pseudo-Riemannian manifolds), in particular for computing the curl in curvilinear coordinates. - """ if len(self) == 3: if variables is None: @@ -3145,8 +3136,8 @@ cdef class FreeModuleElement(Vector): # abstract base class def element(self): """ - Simply returns self. This is useful, since for many objects, - self.element() returns a vector corresponding to self. + Simply returns ``self``. This is useful, since for many objects, + ``self.element()`` returns a vector corresponding to ``self``. EXAMPLES:: @@ -3205,7 +3196,7 @@ cdef class FreeModuleElement(Vector): # abstract base class def conjugate(self): r""" - Returns a vector where every entry has been replaced by its complex conjugate. + Return a vector where every entry has been replaced by its complex conjugate. OUTPUT: @@ -3294,7 +3285,7 @@ cdef class FreeModuleElement(Vector): # abstract base class def inner_product(self, right): r""" - Returns the inner product of ``self`` and ``right``, + Return the inner product of ``self`` and ``right``, possibly using an inner product matrix from the parent of ``self``. INPUT: @@ -3399,7 +3390,7 @@ cdef class FreeModuleElement(Vector): # abstract base class def outer_product(self, right): r""" - Returns a matrix, the outer product of two vectors ``self`` and ``right``. + Return a matrix, the outer product of two vectors ``self`` and ``right``. INPUT: @@ -3517,7 +3508,7 @@ cdef class FreeModuleElement(Vector): # abstract base class def hermitian_inner_product(self, right): r""" - Returns the dot product, but with the entries of the first vector + Return the dot product, but with the entries of the first vector conjugated beforehand. INPUT: @@ -3824,7 +3815,7 @@ cdef class FreeModuleElement(Vector): # abstract base class OUTPUT: - If self is the free module element (1,2,3,4), + If ``self`` is the free module element (1,2,3,4), then a string with the following latex is returned: "\left(1,\,2,\,3,\,4\right)" (without the quotes). The vector is enclosed in parentheses by default, @@ -3855,8 +3846,8 @@ cdef class FreeModuleElement(Vector): # abstract base class def dense_vector(self): """ - Return dense version of self. If self is dense, just return - self; otherwise, create and return correspond dense vector. + Return dense version of ``self``. If ``self`` is dense, just return + ``self``; otherwise, create and return correspond dense vector. EXAMPLES:: @@ -3874,7 +3865,7 @@ cdef class FreeModuleElement(Vector): # abstract base class def sparse_vector(self): """ - Return sparse version of self. If self is sparse, just return + Return sparse version of ``self``. If ``self`` is sparse, just return self; otherwise, create and return correspond sparse vector. EXAMPLES:: @@ -3898,16 +3889,13 @@ cdef class FreeModuleElement(Vector): # abstract base class automatically determine the base ring of the resulting element. INPUT: - sparse -- True or False will control whether the result - is sparse. By default, the result is sparse iff self - is sparse. - - - ``phi`` -- arbitrary Python function or callable - object + - ``sparse`` -- boolean; will control whether the result is sparse. + By default, the result is sparse iff self is sparse. - - ``R`` -- (optional) ring + - ``phi`` -- arbitrary Python function or callable object + - ``R`` -- (optional) ring OUTPUT: a free module element over R @@ -3937,7 +3925,7 @@ cdef class FreeModuleElement(Vector): # abstract base class sage: n.parent() # needs sage.rings.finite_rings Vector space of dimension 9 over Finite Field in a of size 3^2 - If your map sends 0 to a non-zero value, then your resulting + If your map sends 0 to a nonzero value, then your resulting vector is not mathematically sparse:: sage: v = vector([0] * 6 + [1], sparse=True); v @@ -4017,7 +4005,7 @@ cdef class FreeModuleElement(Vector): # abstract base class # OK, we have some zero entries. zero_res = phi(self.base_ring()(0)) if not zero_res.is_zero(): - # And phi maps 0 to a non-zero value. + # And phi maps 0 to a nonzero value. v = [zero_res] * self._degree for i,z in self.dict(copy=False).items(): v[i] = phi(z) @@ -4118,7 +4106,7 @@ cdef class FreeModuleElement(Vector): # abstract base class def integral(self, *args, **kwds): """ - Returns a symbolic integral of the vector, component-wise. + Return a symbolic integral of the vector, component-wise. :meth:`integrate` is an alias of the function. @@ -4133,7 +4121,6 @@ cdef class FreeModuleElement(Vector): # abstract base class (1/2*t^2, 1/3*t^3, -cos(t)) sage: r.integrate(t, 0, 1) (1/2, 1/3, -cos(1) + 1) - """ from sage.misc.functional import integral return self.apply_map(lambda x: integral(x,*args, **kwds)) @@ -4142,7 +4129,7 @@ cdef class FreeModuleElement(Vector): # abstract base class def nintegral(self, *args, **kwds): """ - Returns a numeric integral of the vector, component-wise, and + Return a numeric integral of the vector, component-wise, and the result of the nintegral command on each component of the input. @@ -4169,7 +4156,6 @@ cdef class FreeModuleElement(Vector): # abstract base class ((0.5, 0.0, 1.0), {0: (0.5, 5.55111512312578...e-15, 21, 0), 2: (1.0, 1.11022302462515...e-14, 21, 0)}) - """ # If Cython supported lambda functions, we would just do # return self.apply_map(lambda x: x.nintegral(*args, **kwds) for x in self) @@ -4357,8 +4343,7 @@ cdef class FreeModuleElement_generic_dense(FreeModuleElement): INPUT: - - ``v`` -- a list which is used as the new entries (without - copying) + - ``v`` -- list which is used as the new entries (without copying) """ cdef type t = type(self) cdef FreeModuleElement_generic_dense x = t.__new__(t) @@ -4643,11 +4628,11 @@ cdef class FreeModuleElement_generic_dense(FreeModuleElement): def list(self, copy=True): """ - Return list of elements of self. + Return list of elements of ``self``. INPUT: - - copy -- bool, return list of underlying entries + - ``copy`` -- boolean; return list of underlying entries EXAMPLES:: @@ -4808,7 +4793,7 @@ cdef class FreeModuleElement_generic_sparse(FreeModuleElement): INPUT: - - ``v`` -- a dict which is used as the new entries (without + - ``v`` -- dictionary which is used as the new entries (without copying) """ cdef type t = type(self) @@ -5293,7 +5278,7 @@ cdef class FreeModuleElement_generic_sparse(FreeModuleElement): def denominator(self): """ Return the least common multiple of the denominators of the - entries of self. + entries of ``self``. EXAMPLES:: @@ -5322,14 +5307,12 @@ cdef class FreeModuleElement_generic_sparse(FreeModuleElement): INPUT: - - ``copy`` -- (default: ``True``) if ``self`` is internally - represented by a dictionary ``d``, then make a copy of ``d``; - if ``False``, then this can cause undesired behavior by - mutating ``d`` - - OUTPUT: + - ``copy`` -- boolean (default: ``True``); if ``self`` is internally + represented by a dictionary ``d``, then make a copy of ``d``. + If ``False``, then this can cause undesired behavior by + mutating ``d``. - - Python dictionary + OUTPUT: Python dictionary EXAMPLES:: @@ -5375,7 +5358,7 @@ cdef class FreeModuleElement_generic_sparse(FreeModuleElement): def nonzero_positions(self): """ - Returns the list of numbers ``i`` such that ``self[i] != 0``. + Return the list of numbers ``i`` such that ``self[i] != 0``. EXAMPLES:: @@ -5390,7 +5373,7 @@ cdef class FreeModuleElement_generic_sparse(FreeModuleElement): cpdef int hamming_weight(self) noexcept: """ - Returns the number of positions ``i`` such that ``self[i] != 0``. + Return the number of positions ``i`` such that ``self[i] != 0``. EXAMPLES:: diff --git a/src/sage/modules/free_module_homspace.py b/src/sage/modules/free_module_homspace.py index 8fb97a48e5a..fc87d7f83f6 100644 --- a/src/sage/modules/free_module_homspace.py +++ b/src/sage/modules/free_module_homspace.py @@ -134,11 +134,11 @@ def __call__(self, A, **kwds): r""" INPUT: - - A -- either a matrix or a list/tuple of images of generators, - or a function returning elements of the codomain for elements of the domain. - - check -- bool (default: ``True``) - - the keyword ``side`` can be assigned the values ``"left"`` or - ``"right"``. It corresponds to the side of vectors relative to the matrix. + - ``A`` -- either a matrix or a list/tuple of images of generators, + or a function returning elements of the codomain for elements of the domain + - ``check`` -- boolean (default: ``True``) + - the keyword ``side`` can be assigned the values ``'left'`` or + ``'right'``. It corresponds to the side of vectors relative to the matrix. If A is a matrix, then it is the matrix of this linear transformation, with respect to the basis for the domain and @@ -227,11 +227,12 @@ def __call__(self, A, **kwds): return free_module_morphism.FreeModuleMorphism(self, A, side) @cached_method - def zero(self, side="left"): + def zero(self, side='left'): """ INPUT: - - side -- side of the vectors acted on by the matrix (default: ``left``) + - ``side`` -- side of the vectors acted on by the matrix + (default: ``'left'``) EXAMPLES:: @@ -272,18 +273,17 @@ def zero(self, side="left"): return self(lambda x: self.codomain().zero(), side=side) @cached_method - def _matrix_space(self, side="left"): + def _matrix_space(self, side='left'): """ INPUT: - - side -- side of the vectors acted on by the matrix (default: ``left``) + - ``side`` -- side of the vectors acted on by the matrix + (default: ``'left'``) Return underlying matrix space that contains the matrices that define the homomorphisms in this free module homspace. - OUTPUT: - - - matrix space + OUTPUT: matrix space EXAMPLES:: @@ -300,17 +300,16 @@ def _matrix_space(self, side="left"): return MatrixSpace(R, self.codomain().rank(), self.domain().rank()) @cached_method - def basis(self, side="left"): + def basis(self, side='left'): """ Return a basis for this space of free module homomorphisms. INPUT: - - side -- side of the vectors acted on by the matrix (default: ``left``) - - OUTPUT: + - ``side`` -- side of the vectors acted on by the matrix + (default: ``'left'``) - - tuple + OUTPUT: tuple EXAMPLES:: @@ -340,13 +339,14 @@ def basis(self, side="left"): B = M.basis() return tuple([self(x, side=side) for x in B]) - def identity(self, side="left"): + def identity(self, side='left'): r""" Return identity morphism in an endomorphism ring. INPUT: - - side -- side of the vectors acted on by the matrix (default: ``left``) + - ``side`` -- side of the vectors acted on by the matrix + (default: ``'left'``) EXAMPLES:: diff --git a/src/sage/modules/free_module_integer.py b/src/sage/modules/free_module_integer.py index 9a468cbd864..a751dca6a98 100644 --- a/src/sage/modules/free_module_integer.py +++ b/src/sage/modules/free_module_integer.py @@ -57,8 +57,8 @@ def IntegerLattice(basis, lll_reduce=True): - an element of an absolute order - - ``lll_reduce`` -- (default: ``True``) run LLL reduction on the basis - on construction. + - ``lll_reduce`` -- boolean (default: ``True``); run LLL reduction on the basis + on construction EXAMPLES: @@ -171,7 +171,6 @@ def IntegerLattice(basis, lll_reduce=True): [ 0 0 0 0 0 1048576 0 0] [ 0 0 0 0 0 0 1048576 0] [ 0 0 0 0 0 0 0 1048576] - """ if isinstance(basis, OrderElement_absolute): @@ -218,7 +217,6 @@ class FreeModule_submodule_with_basis_integer(FreeModule_submodule_with_basis_pi [ 2 -1 1 2 -3 2 2 1 0 1] sage: L.shortest_vector() (-1, 1, 2, -2, 0, 1, 0, -1, 2, 1) - """ def __init__(self, ambient, basis, check=True, echelonize=False, echelonized_basis=None, already_echelonized=False, @@ -233,21 +231,21 @@ def __init__(self, ambient, basis, check=True, echelonize=False, - ``basis`` -- either a list of vectors or a matrix over the integers - - ``check`` -- (default: ``True``) if ``False``, correctness of - the input will not be checked and type conversion may be omitted, + - ``check`` -- boolean (default: ``True``); if ``False``, correctness + of the input will not be checked and type conversion may be omitted, use with care - - ``echelonize`` -- (default:``False``) if ``True``, ``basis`` will be + - ``echelonize`` -- (default: ``False``) if ``True``, ``basis`` will be echelonized and the result will be used as the default basis of the constructed submodule - `` echelonized_basis`` -- (default: ``None``) if not ``None``, must be the echelonized basis spanning the same submodule as ``basis`` - - ``already_echelonized`` -- (default: ``False``) if ``True``, + - ``already_echelonized`` -- boolean (default: ``False``); if ``True``, ``basis`` must be already given in the echelonized form - - ``lll_reduce`` -- (default: ``True``) run LLL reduction on the basis + - ``lll_reduce`` -- boolean (default: ``True``); run LLL reduction on the basis on construction EXAMPLES:: @@ -281,7 +279,6 @@ def __init__(self, ambient, basis, check=True, echelonize=False, [ 0 -1 1 -4 1 -1 1 0] [ 2 0 -3 -1 0 -3 0 0] [-1 0 -1 0 -3 -3 0 0] - """ basis = matrix(ZZ, basis) self._basis_is_LLL_reduced = False @@ -357,9 +354,7 @@ def LLL(self, *args, **kwds): - ``**kwds`` -- passed through to :meth:`sage.matrix.matrix_integer_dense.Matrix_integer_dense.LLL` - OUTPUT: - - An integer matrix which is an LLL-reduced basis for this lattice. + OUTPUT: integer matrix which is an LLL-reduced basis for this lattice EXAMPLES:: @@ -400,9 +395,7 @@ def BKZ(self, *args, **kwds): - ``*kwds`` -- passed through to :meth:`sage.matrix.matrix_integer_dense.Matrix_integer_dense.BKZ` - OUTPUT: - - An integer matrix which is a BKZ-reduced basis for this lattice. + OUTPUT: integer matrix which is a BKZ-reduced basis for this lattice EXAMPLES:: @@ -463,9 +456,7 @@ def HKZ(self, *args, **kwds): - ``*kwds`` -- passed through to :meth:`BKZ` - OUTPUT: - - An integer matrix which is a HKZ-reduced basis for this lattice. + OUTPUT: integer matrix which is a HKZ-reduced basis for this lattice EXAMPLES:: @@ -532,25 +523,23 @@ def is_unimodular(self): return self.volume() == 1 @cached_method - def shortest_vector(self, update_reduced_basis=True, algorithm="fplll", *args, **kwds): + def shortest_vector(self, update_reduced_basis=True, algorithm='fplll', *args, **kwds): r""" Return a shortest vector. INPUT: - - ``update_reduced_basis`` -- (default: ``True``) set this flag if - the found vector should be used to improve the basis + - ``update_reduced_basis`` -- boolean (default: ``True``); set this + flag if the found vector should be used to improve the basis - - ``algorithm`` -- (default: ``"fplll"``) either ``"fplll"`` or - ``"pari"`` + - ``algorithm`` -- (default: ``'fplll'``) either ``'fplll'`` or + ``'pari'`` - ``*args`` -- passed through to underlying implementation - ``**kwds`` -- passed through to underlying implementation - OUTPUT: - - A shortest non-zero vector for this lattice. + OUTPUT: a shortest nonzero vector for this lattice EXAMPLES:: @@ -567,11 +556,11 @@ def shortest_vector(self, update_reduced_basis=True, algorithm="fplll", *args, * sage: min(v.norm().n() for v in L.reduced_basis) # needs sage.symbolic 6.03890756700000e10 - sage: L.shortest_vector(algorithm="pari").norm().n() # needs sage.symbolic + sage: L.shortest_vector(algorithm='pari').norm().n() # needs sage.symbolic 3.74165738677394 sage: L = IntegerLattice(A, lll_reduce=True) - sage: L.shortest_vector(algorithm="pari").norm().n() # needs sage.symbolic + sage: L.shortest_vector(algorithm='pari').norm().n() # needs sage.symbolic 3.74165738677394 """ if algorithm == "pari": diff --git a/src/sage/modules/free_module_morphism.py b/src/sage/modules/free_module_morphism.py index 7cbfe0f7281..efdbc607c09 100644 --- a/src/sage/modules/free_module_morphism.py +++ b/src/sage/modules/free_module_morphism.py @@ -73,15 +73,15 @@ def is_FreeModuleMorphism(x): class FreeModuleMorphism(matrix_morphism.MatrixMorphism): - def __init__(self, parent, A, side="left"): + def __init__(self, parent, A, side='left'): """ INPUT: - - ``parent`` -- a homspace in a (sub) category of free modules + - ``parent`` -- a homspace in a (sub) category of free modules - - ``A`` -- matrix + - ``A`` -- matrix - - side -- side of the vectors acted on by the matrix (default: ``"left"``) + - ``side`` -- side of the vectors acted on by the matrix (default: ``'left'``) EXAMPLES:: @@ -181,7 +181,7 @@ def _repr_(self): [1 0 0] Domain: Ambient free module of rank 3 over the principal ideal domain Integer Ring Codomain: Ambient free module of rank 3 over the principal ideal domain Integer Ring - sage: h2 = V.hom([V.1, V.2, V.0], side="right"); h2 + sage: h2 = V.hom([V.1, V.2, V.0], side='right'); h2 Free module morphism defined as left-multiplication by the matrix [0 0 1] [1 0 0] @@ -248,7 +248,7 @@ def inverse_image(self, V): """ Given a submodule V of the codomain of self, return the inverse image of V under self, i.e., the biggest submodule of - the domain of self that maps into V. + the domain of ``self`` that maps into V. EXAMPLES: @@ -320,7 +320,7 @@ def inverse_image(self, V): sage: V = ZZ^2 sage: m = matrix(2, [1, 1, 0, 1]) - sage: h = V.hom(m, side="right") + sage: h = V.hom(m, side='right') sage: h Free module morphism defined as left-multiplication by the matrix [1 1] @@ -453,7 +453,7 @@ def lift(self, x): :: sage: V = QQ^2; m = matrix(2, [1, 1, 0, 1]) - sage: V.hom(m, side="right").lift(V.0 + V.1) + sage: V.hom(m, side='right').lift(V.0 + V.1) (0, 1) sage: V.hom(m).lift(V.0 + V.1) (1, 0) @@ -488,12 +488,12 @@ def lift(self, x): def eigenvalues(self, extend=True): r""" - Returns a list with the eigenvalues of the endomorphism of vector spaces. + Return a list with the eigenvalues of the endomorphism of vector spaces. INPUT: - - ``extend`` -- boolean (default: ``True``) decides if base field - extensions should be considered or not. + - ``extend`` -- boolean (default: ``True``); decides if base field + extensions should be considered or not EXAMPLES: @@ -523,12 +523,12 @@ def eigenvalues(self, extend=True): def eigenvectors(self, extend=True): """ - Computes the subspace of eigenvectors of a given eigenvalue. + Compute the subspace of eigenvectors of a given eigenvalue. INPUT: - - ``extend`` -- boolean (default: ``True``) decides if base field - extensions should be considered or not. + - ``extend`` -- boolean (default: ``True``); decides if base field + extensions should be considered or not OUTPUT: @@ -559,7 +559,7 @@ def eigenvectors(self, extend=True): sage: V = QQ^2 sage: m = matrix(2, [1, 1, 0, 1]) - sage: V.hom(m, side="right").eigenvectors() # needs sage.rings.number_field + sage: V.hom(m, side='right').eigenvectors() # needs sage.rings.number_field [(1, [ (1, 0) ], 2)] sage: V.hom(m).eigenvectors() # needs sage.rings.number_field [(1, [ (0, 1) ], 2)] @@ -587,12 +587,10 @@ def eigenspaces(self, extend=True): INPUT: - - ``extend`` -- (default: ``True``) determines if field + - ``extend`` -- boolean (default: ``True``); determines if field extensions should be considered - OUTPUT: - - - a list of pairs ``(eigenvalue, eigenspace)`` + OUTPUT: a list of pairs ``(eigenvalue, eigenspace)`` EXAMPLES:: @@ -634,7 +632,7 @@ def eigenspaces(self, extend=True): :: sage: V = QQ^2; m = matrix(2, [1, 1, 0, 1]) - sage: V.hom(m, side="right").eigenspaces() # needs sage.rings.number_field + sage: V.hom(m, side='right').eigenspaces() # needs sage.rings.number_field [(1, Vector space of degree 2 and dimension 1 over Rational Field Basis matrix: [1 0])] @@ -712,12 +710,12 @@ def _richcmp_(self, other, op): class BaseIsomorphism1D_to_FM(BaseIsomorphism1D): """ - An isomorphism from a ring to its 1-dimensional free module + An isomorphism from a ring to its 1-dimensional free module. INPUT: - ``parent`` -- the homset - - ``basis`` -- (default 1) an invertible element of the ring + - ``basis`` -- (default: 1) an invertible element of the ring EXAMPLES:: @@ -769,12 +767,12 @@ def _call_(self, x): class BaseIsomorphism1D_from_FM(BaseIsomorphism1D): """ - An isomorphism to a ring from its 1-dimensional free module + An isomorphism to a ring from its 1-dimensional free module. INPUT: - ``parent`` -- the homset - - ``basis`` -- (default 1) an invertible element of the ring + - ``basis`` -- (default: 1) an invertible element of the ring EXAMPLES:: diff --git a/src/sage/modules/free_quadratic_module.py b/src/sage/modules/free_quadratic_module.py index da54426e9c9..6b9565218a0 100644 --- a/src/sage/modules/free_quadratic_module.py +++ b/src/sage/modules/free_quadratic_module.py @@ -91,13 +91,13 @@ def FreeQuadraticModule(base_ring, rank, inner_product_matrix, - ``base_ring`` -- a commutative ring - - ``rank`` -- a nonnegative integer + - ``rank`` -- nonnegative integer - ``inner_product_matrix`` -- the inner product matrix - - ``sparse`` -- bool; (default ``False``) + - ``sparse`` -- boolean (default: ``False``) - - ``inner_product_ring`` -- the inner product codomain ring; (default ``None``) + - ``inner_product_ring`` -- the inner product codomain ring (default: ``None``) OUTPUT: @@ -318,7 +318,7 @@ def __init__(self, base_ring, rank, degree, inner_product_matrix, sparse=False): - ``base_ring`` -- a commutative ring - - ``rank`` -- a non-negative integer + - ``rank`` -- nonnegative integer EXAMPLES:: @@ -739,10 +739,10 @@ def span(self, gens, check=True, already_echelonized=False): - ``gens`` -- list of vectors - - ``check`` -- bool (default: ``True``): whether or not to coerce + - ``check`` -- boolean (default: ``True``); whether or not to coerce entries of gens into base field - - ``already_echelonized`` -- bool (default: ``False``): set this if + - ``already_echelonized`` -- boolean (default: ``False``); set this if you know the gens are already in echelon form EXAMPLES:: @@ -779,10 +779,10 @@ def span_of_basis(self, basis, check=True, already_echelonized=False): - ``basis`` -- list of vectors - - ``check`` -- bool (default: ``True``): whether or not to coerce + - ``check`` -- boolean (default: ``True``); whether or not to coerce entries of gens into base field - - ``already_echelonized`` -- bool (default: ``False``): set this if + - ``already_echelonized`` -- boolean (default: ``False``); set this if you know the gens are already in echelon form EXAMPLES:: @@ -831,7 +831,7 @@ def __init__(self, base_ring, rank, inner_product_matrix, sparse=False): - ``base_ring`` -- a commutative ring - - ``rank`` -- a non-negative integer + - ``rank`` -- nonnegative integer EXAMPLES:: @@ -1047,11 +1047,11 @@ def __init__(self, base_ring, rank, inner_product_matrix, sparse=False): - ``base_ring`` -- a principal ideal domain - - ``rank`` -- a non-negative integer + - ``rank`` -- nonnegative integer - - ``sparse`` -- bool (default: ``False``) + - ``sparse`` -- boolean (default: ``False``) - - ``inner_product_matrix`` -- bool (default: ``None``) + - ``inner_product_matrix`` -- boolean (default: ``None``) EXAMPLES:: @@ -1131,9 +1131,9 @@ def __init__(self, base_field, dimension, inner_product_matrix, sparse=False): - ``base_field`` -- a field - - ``dimension`` -- a non-negative integer + - ``dimension`` -- nonnegative integer - - ``sparse`` -- bool (default: ``False``) + - ``sparse`` -- boolean (default: ``False``) EXAMPLES:: diff --git a/src/sage/modules/free_quadratic_module_integer_symmetric.py b/src/sage/modules/free_quadratic_module_integer_symmetric.py index f7343dfc484..16124c15266 100644 --- a/src/sage/modules/free_quadratic_module_integer_symmetric.py +++ b/src/sage/modules/free_quadratic_module_integer_symmetric.py @@ -88,7 +88,7 @@ def IntegralLattice(data, basis=None): :class:`CartanMatrix` (see also :mod:`Cartan types `) -- for a root lattice - * the string ``"U"`` or ``"H"`` -- for hyperbolic lattices + * the string ``'U'`` or ``'H'`` -- for hyperbolic lattices - ``basis`` -- (optional) a matrix whose rows form a basis of the lattice, or a list of module elements forming a basis @@ -140,16 +140,16 @@ def IntegralLattice(data, basis=None): [ 2 -1] [-1 2] - We use ``"U"`` or ``"H"`` for defining a hyperbolic lattice:: + We use ``'U'`` or ``'H'`` for defining a hyperbolic lattice:: - sage: L1 = IntegralLattice("U") + sage: L1 = IntegralLattice('U') sage: L1 Lattice of degree 2 and rank 2 over Integer Ring Standard basis Inner product matrix: [0 1] [1 0] - sage: L1 == IntegralLattice("H") + sage: L1 == IntegralLattice('H') True We can construct root lattices by specifying their type @@ -263,8 +263,8 @@ def IntegralLatticeDirectSum(Lattices, return_embeddings=False): INPUT: - - ``Lattices`` -- a list of lattices ``[L_1,...,L_n]`` - - ``return_embeddings`` -- (default: ``False``) a boolean + - ``Lattices`` -- list of lattices ``[L_1,...,L_n]`` + - ``return_embeddings`` -- boolean (default: ``False``) OUTPUT: @@ -373,12 +373,11 @@ def IntegralLatticeGluing(Lattices, glue, return_embeddings=False): INPUT: - - ``Lattices`` -- a list of lattices `[L_1,...,L_n]` - - ``glue`` -- a list where the elements are lists in the form `[g_1,...,g_n]`; + - ``Lattices`` -- list of lattices `[L_1,...,L_n]` + - ``glue`` -- list where the elements are lists in the form `[g_1,...,g_n]`; here `g_i` is an element of the discriminant group of `L_i`and the overlattice is spanned by the additional ``[sum(g) for g in glue]`` - - ``return_embeddings`` -- (default: ``False``) a boolean - + - ``return_embeddings`` -- boolean (default: ``False``) OUTPUT: @@ -629,7 +628,7 @@ class FreeQuadraticModule_integer_symmetric(FreeQuadraticModule_submodule_with_b INPUT: - ``ambient`` -- an ambient free quadratic module - - ``basis`` -- a list of elements of ambient or a matrix + - ``basis`` -- list of elements of ambient or a matrix - ``inner_product_matrix`` -- a symmetric matrix over the rationals EXAMPLES:: @@ -751,7 +750,7 @@ def is_even(self): @cached_method def dual_lattice(self): r""" - Return the dual lattice as a :class:`FreeQuadraticModule` + Return the dual lattice as a :class:`FreeQuadraticModule`. Let `L` be a lattice. Its dual lattice is @@ -781,7 +780,7 @@ def discriminant_group(self, s=0): INPUT: - - ``s`` -- an integer (default: 0) + - ``s`` -- integer (default: 0) OUTPUT: @@ -974,7 +973,7 @@ def sublattice(self, basis): INPUT: - - ``basis`` -- A list of elements of this lattice. + - ``basis`` -- list of elements of this lattice EXAMPLES:: @@ -1010,7 +1009,7 @@ def overlattice(self, gens): INPUT: - - ``gens`` -- a list of elements or a rational matrix + - ``gens`` -- list of elements or a rational matrix EXAMPLES:: @@ -1032,9 +1031,9 @@ def maximal_overlattice(self, p=None): INPUT: - - ``p`` -- (default:``None``) if given return an overlattice + - ``p`` -- (default: ``None``) if given return an overlattice `M` of this lattice `L` that is maximal at `p` and the - completions `M_q = L_q` are equal for all primes `q \neq p`. + completions `M_q = L_q` are equal for all primes `q \neq p` If `p` is `2` or ``None``, then the lattice must be even. @@ -1055,7 +1054,6 @@ def maximal_overlattice(self, p=None): sage: L = IntegralLattice(matrix.diagonal([2,4,4,8])) sage: L.maximal_overlattice().is_even() True - """ # this code is somewhat slow but it works # it might speed up things to use the algorithms given in @@ -1162,9 +1160,10 @@ def orthogonal_group(self, gens=None, is_finite=None): INPUT: - - ``gens`` -- a list of matrices (default:``None``) - - ``is_finite`` -- bool (default: ``None``) If set to ``True``, - then the group is placed in the category of finite groups. Sage does not check this. + - ``gens`` -- list of matrices (default: ``None``) + - ``is_finite`` -- boolean (default: ``None``); if set to ``True``, + then the group is placed in the category of finite groups. Sage does + not check this. OUTPUT: @@ -1335,8 +1334,8 @@ def tensor_product(self, other, discard_basis=False): INPUT: - ``other`` -- an integral lattice - - ``discard_basis`` -- a boolean (default: ``False``). If ``True``, then the lattice - returned is equipped with the standard basis. + - ``discard_basis`` -- boolean (default: ``False``); if ``True``, then + the lattice returned is equipped with the standard basis EXAMPLES:: @@ -1503,13 +1502,11 @@ def short_vectors(self, n, **kwargs): INPUT: - - ``n`` -- an integer + - ``n`` -- integer - further keyword arguments are passed on to - :meth:`sage.quadratic_forms.short_vector_list_up_to_length`. - - OUTPUT: + :meth:`sage.quadratic_forms.short_vector_list_up_to_length` - - a list `L` where ``L[k]`` is the list of vectors of lengths `k` + OUTPUT: list `L` where ``L[k]`` is the list of vectors of lengths `k` EXAMPLES:: @@ -1536,10 +1533,9 @@ def twist(self, s, discard_basis=False): INPUT: - - ``s`` -- a nonzero integer - - ``discard_basis`` -- a boolean (default: ``False``). - If ``True``, then the lattice returned is equipped - with the standard basis. + - ``s`` -- nonzero integer + - ``discard_basis`` -- boolean (default: ``False``); if ``True``, then + the lattice returned is equipped with the standard basis EXAMPLES:: diff --git a/src/sage/modules/matrix_morphism.py b/src/sage/modules/matrix_morphism.py index fcce12a0788..c5ca4bdeeb8 100644 --- a/src/sage/modules/matrix_morphism.py +++ b/src/sage/modules/matrix_morphism.py @@ -58,7 +58,7 @@ def is_MatrixMorphism(x): """ - Return True if x is a Matrix morphism of free modules. + Return ``True`` if x is a Matrix morphism of free modules. This function is deprecated. @@ -97,10 +97,9 @@ def __init__(self, parent, side='left'): """ INPUT: - - ``parent`` -- a homspace - - - ``A`` -- matrix + - ``parent`` -- a homspace + - ``A`` -- matrix EXAMPLES:: @@ -244,7 +243,6 @@ def _call_with_args(self, x, args=(), kwds={}): to coefficients in Real Field with 53 bits of precision sage: f((1, 0), coerce=False) (1.00000000000000*I, 0.000000000000000) - """ if self.domain().is_ambient(): x = x.element() @@ -299,7 +297,7 @@ def side(self): sage: m = matrix(2, [1, 1, 0, 1]) sage: V = ZZ^2 - sage: h1 = V.hom(m); h2 = V.hom(m, side="right") + sage: h1 = V.hom(m); h2 = V.hom(m, side='right') sage: h1.side() 'left' sage: h1([1, 0]) @@ -313,7 +311,7 @@ def side(self): def side_switch(self): """ - Return the same morphism, acting on vectors on the opposite side + Return the same morphism, acting on vectors on the opposite side. EXAMPLES:: @@ -565,7 +563,7 @@ def __mul__(self, right): Codomain: Vector space of dimension 2 over Rational Field sage: f(a) (1, 1) - sage: V.hom([V.0 - V.1, V.0 + V.1], side="right")*KtoV + sage: V.hom([V.0 - V.1, V.0 + V.1], side='right')*KtoV Composite map: From: Number Field in a with defining polynomial x^2 + 23 To: Vector space of dimension 2 over Rational Field @@ -585,7 +583,7 @@ def __mul__(self, right): sage: V = ZZ^2 sage: m = matrix(2, [1,1,0,1]) sage: hl = V.hom(m) - sage: hr = V.hom(m, side="right") + sage: hr = V.hom(m, side='right') sage: hl * hl Free module morphism defined by the matrix [1 2] @@ -650,7 +648,7 @@ def __mul__(self, right): if right.side() == "right": return H(self.matrix() * right.matrix(), side=self.side()) else: - return H(right.matrix() * self.matrix().transpose(), side="left") + return H(right.matrix() * self.matrix().transpose(), side='left') def __add__(self, right): """ @@ -694,7 +692,7 @@ def __add__(self, right): sage: V = ZZ^2 sage: m = matrix(2, [1,1,0,1]) sage: hl = V.hom(m) - sage: hr = V.hom(m, side="right") + sage: hr = V.hom(m, side='right') sage: hl + hl Free module morphism defined by the matrix [2 2] @@ -727,12 +725,12 @@ def __add__(self, right): if right.side() == "left": return self.parent()(self.matrix() + right.matrix(), side=self.side()) elif right.side() == "right": - return self.parent()(self.matrix() + right.matrix().transpose(), side="left") + return self.parent()(self.matrix() + right.matrix().transpose(), side='left') if self.side() == "right": if right.side() == "right": return self.parent()(self.matrix() + right.matrix(), side=self.side()) elif right.side() == "left": - return self.parent()(self.matrix().transpose() + right.matrix(), side="left") + return self.parent()(self.matrix().transpose() + right.matrix(), side='left') def __neg__(self): """ @@ -765,7 +763,7 @@ def __sub__(self, other): sage: V = ZZ^2 sage: m = matrix(2, [1,1,0,1]) sage: hl = V.hom(m) - sage: hr = V.hom(m, side="right") + sage: hr = V.hom(m, side='right') sage: hl - hr Free module morphism defined by the matrix [ 0 1] @@ -798,17 +796,17 @@ def __sub__(self, other): if other.side() == "left": return self.parent()(self.matrix() - other.matrix(), side=self.side()) elif other.side() == "right": - return self.parent()(self.matrix() - other.matrix().transpose(), side="left") + return self.parent()(self.matrix() - other.matrix().transpose(), side='left') if self.side() == "right": if other.side() == "right": return self.parent()(self.matrix() - other.matrix(), side=self.side()) elif other.side() == "left": - return self.parent()(self.matrix().transpose() - other.matrix(), side="left") + return self.parent()(self.matrix().transpose() - other.matrix(), side='left') def base_ring(self): """ - Return the base ring of self, that is, the ring over which self is - given by a matrix. + Return the base ring of ``self``, that is, the ring over which ``self`` + is given by a matrix. EXAMPLES:: @@ -820,9 +818,9 @@ def base_ring(self): def decomposition(self, *args, **kwds): """ Return decomposition of this endomorphism, i.e., sequence of - subspaces obtained by finding invariant subspaces of self. + subspaces obtained by finding invariant subspaces of ``self``. - See the documentation for self.matrix().decomposition for more + See the documentation for ``self.matrix().decomposition`` for more details. All inputs to this function are passed onto the matrix one. @@ -838,7 +836,7 @@ def decomposition(self, *args, **kwds): Echelon basis matrix: [ 1 -1] ] - sage: phi2 = V.hom(phi.matrix(), side="right") + sage: phi2 = V.hom(phi.matrix(), side='right') sage: phi2.decomposition() # needs sage.libs.pari [ Free module of degree 2 and rank 1 over Integer Ring @@ -893,7 +891,7 @@ def kernel(self): [1 0 0] [0 0 1] sage: f1 = V.hom(m) - sage: f2 = V.hom(m, side="right") + sage: f2 = V.hom(m, side='right') sage: f1.kernel() Vector space of degree 3 and dimension 1 over Rational Field Basis matrix: @@ -938,7 +936,7 @@ def image(self): [1 0 0] [0 0 1] sage: f1 = V.hom(m) - sage: f2 = V.hom(m, side="right") + sage: f2 = V.hom(m, side='right') sage: f1.image() Vector space of degree 3 and dimension 2 over Rational Field Basis matrix: @@ -1030,7 +1028,7 @@ def _matrix_(self): def rank(self): r""" - Returns the rank of the matrix representing this morphism. + Return the rank of the matrix representing this morphism. EXAMPLES:: @@ -1045,7 +1043,7 @@ def rank(self): def nullity(self): r""" - Returns the nullity of the matrix representing this morphism, which is the + Return the nullity of the matrix representing this morphism, which is the dimension of its kernel. EXAMPLES:: @@ -1065,7 +1063,7 @@ def nullity(self): sage: h1.nullity() 1 sage: W = ZZ^1 - sage: h2 = W.hom(m, side="right") + sage: h2 = W.hom(m, side='right') sage: h2.nullity() 0 """ @@ -1207,7 +1205,7 @@ def is_zero(self): sage: phi.is_zero() True - An image list that just barely makes a non-zero morphism. :: + An image list that just barely makes a nonzero morphism. :: sage: V = ZZ^4 sage: W = ZZ^6 @@ -1347,7 +1345,7 @@ def restrict_domain(self, sub): Free module morphism defined by the matrix [0 2]... sage: m = matrix(2, range(1,5)) - sage: f1 = V.hom(m); f2 = V.hom(m, side="right") + sage: f1 = V.hom(m); f2 = V.hom(m, side='right') sage: SV = V.span([V.0]) sage: f1.restrict_domain(SV) Free module morphism defined by the matrix @@ -1451,7 +1449,7 @@ def restrict_codomain(self, sub): V = sub.free_module() try: if self.side() == "right": - return H(self.matrix().transpose().restrict_codomain(V).transpose(), side="right") + return H(self.matrix().transpose().restrict_codomain(V).transpose(), side='right') else: return H(self.matrix().restrict_codomain(V)) except Exception: @@ -1555,13 +1553,13 @@ class MatrixMorphism(MatrixMorphism_abstract): INPUT: - - ``parent`` -- a homspace + - ``parent`` -- a homspace - - ``A`` -- matrix or a :class:`MatrixMorphism_abstract` instance + - ``A`` -- matrix or a :class:`MatrixMorphism_abstract` instance - - ``copy_matrix`` -- (default: ``True``) make an immutable copy of - the matrix ``A`` if it is mutable; if ``False``, then this makes - ``A`` immutable + - ``copy_matrix`` -- boolean (default: ``True``); make an immutable copy of + the matrix ``A`` if it is mutable. If ``False``, then this makes + ``A`` immutable. """ def __init__(self, parent, A, copy_matrix=True, side='left'): """ diff --git a/src/sage/modules/module.pyx b/src/sage/modules/module.pyx index 845c4b239d8..9a3281cc244 100644 --- a/src/sage/modules/module.pyx +++ b/src/sage/modules/module.pyx @@ -71,7 +71,7 @@ cdef class Module(Parent): INPUT: - - ``base`` -- a ring. The base ring of the module. + - ``base`` -- a ring; the base ring of the module - ``category`` -- a category (default: ``None``), the category for this module. If ``None``, then this is set to the category of modules/vector @@ -112,7 +112,6 @@ cdef class Module(Parent): sage: M.rename('toto') sage: h == M.__hash__() True - """ def __init__(self, base, category=None, names=None): """ @@ -124,7 +123,6 @@ cdef class Module(Parent): sage: M = Module(ZZ) sage: type(M) - """ from sage.categories.modules import Modules if category is None: @@ -170,7 +168,6 @@ cdef class Module(Parent): - Simon King (2010-12) - Peter Bruin (June 2014) - """ try: if (isinstance(M, Module) @@ -193,7 +190,6 @@ cdef class Module(Parent): Traceback (most recent call last): ... NotImplementedError: the method change_ring() has not yet been implemented - """ if R is self.base_ring(): return self @@ -245,7 +241,6 @@ cdef class Module(Parent): ... TypeError: Base extension of self (over 'Cyclotomic Field of order 9 and degree 6') to ring 'Cyclotomic Field of order 3 and degree 2' not defined. - """ if R.has_coerce_map_from(self.base_ring()): return self.change_ring(R) @@ -276,7 +271,7 @@ def is_Module(x): INPUT: - - ``x`` -- anything. + - ``x`` -- anything EXAMPLES:: @@ -302,7 +297,7 @@ def is_VectorSpace(x): INPUT: - - ``x`` -- anything. + - ``x`` -- anything EXAMPLES:: @@ -324,7 +319,6 @@ def is_VectorSpace(x): True sage: is_VectorSpace(M) False - """ from sage.misc.superseded import deprecation_cython deprecation_cython(37924, "the function is_VectorSpace is deprecated; use 'isinstance(..., Module)' and check the base ring instead") diff --git a/src/sage/modules/multi_filtered_vector_space.py b/src/sage/modules/multi_filtered_vector_space.py index 2cbc6cd4c20..1934e71cc8d 100644 --- a/src/sage/modules/multi_filtered_vector_space.py +++ b/src/sage/modules/multi_filtered_vector_space.py @@ -63,8 +63,8 @@ def MultiFilteredVectorSpace(arg, base_ring=None, check=True): base field of the vector space. Must be a field. If not specified, the base field is derived from the filtrations. - - ``check`` -- boolean (optional; default: ``True``). Whether - to perform consistency checks. + - ``check`` -- boolean (default: ``True``); whether + to perform consistency checks EXAMPLES:: @@ -110,15 +110,14 @@ def __init__(self, base_ring, dim, filtrations, check=True): INPUT: - - ``base_ring`` -- a ring. the base ring. + - ``base_ring`` -- the base ring - - ``dim`` -- integer. The dimension of the ambient vector space. + - ``dim`` -- integer; the dimension of the ambient vector space - - ``filtrations`` -- a dictionary whose values are - filtrations. + - ``filtrations`` -- dictionary whose values are filtrations - - ``check`` -- boolean (optional). Whether to perform - additional consistency checks. + - ``check`` -- boolean (default: ``True``); whether to perform + additional consistency checks EXAMPLES:: @@ -161,7 +160,7 @@ def change_ring(self, base_ring): INPUT: - - ``base_ring`` -- a ring. The new base ring. + - ``base_ring`` -- the new base ring OUTPUT: @@ -369,10 +368,10 @@ def get_degree(self, key, deg): INPUT: - - ``key`` -- an element of the :meth:`index_set`. Specifies - which filtration. + - ``key`` -- an element of the :meth:`index_set`; specifies + which filtration - - ``d`` -- Integer. The desired degree of the filtration. + - ``d`` -- integer; the desired degree of the filtration OUTPUT: @@ -398,10 +397,10 @@ def graded(self, key, deg): INPUT: - - ``key`` -- an element of the :meth:`index_set`. Specifies - which filtration. + - ``key`` -- an element of the :meth:`index_set`; specifies + which filtration - - ``d`` -- Integer. The desired degree of the filtration. + - ``d`` -- integer; the desired degree of the filtration OUTPUT: @@ -509,7 +508,7 @@ def direct_sum(self, other): INPUT: - ``other`` -- a multi-filtered vector space with the same - :meth:`index_set`. + :meth:`index_set` OUTPUT: @@ -550,7 +549,7 @@ def tensor_product(self, other): INPUT: - ``other`` -- a multi-filtered vector space with the same - :meth:`index_set`. + :meth:`index_set` OUTPUT: @@ -591,8 +590,8 @@ def exterior_power(self, n): INPUT: - - ``n`` -- integer. Exterior product of how many copies of - ``self``. + - ``n`` -- integer; Exterior product of how many copies of + ``self`` OUTPUT: @@ -621,8 +620,8 @@ def symmetric_power(self, n): INPUT: - - ``n`` -- integer. Symmetric product of how many copies of - ``self``. + - ``n`` -- integer; Symmetric product of how many copies of + ``self`` OUTPUT: @@ -691,11 +690,11 @@ def shift(self, deg): def random_deformation(self, epsilon=None): """ - Return a random deformation + Return a random deformation. INPUT: - - ``epsilon`` -- a number in the base ring. + - ``epsilon`` -- a number in the base ring OUTPUT: diff --git a/src/sage/modules/quotient_module.py b/src/sage/modules/quotient_module.py index a59273cc407..26c9c7629c0 100644 --- a/src/sage/modules/quotient_module.py +++ b/src/sage/modules/quotient_module.py @@ -219,7 +219,7 @@ def cover(self): def relations(self): r""" - Given this quotient space `Q = V/W`, return `W` + Given this quotient space `Q = V/W`, return `W`. EXAMPLES:: @@ -489,9 +489,9 @@ def _element_constructor_(self, x): Convert an element into this quotient space `V/W` if there is a way to make sense of it. - An element converts into self if it can be converted into `V`, + An element converts into ``self`` if it can be converted into `V`, or if not at least if it can be made sense of as a list of - length the dimension of self. + length the dimension of ``self``. EXAMPLES: @@ -534,7 +534,6 @@ def _element_constructor_(self, x): sage: Q((ZZ^3)([1,2,3])) (2, 3) - """ if isinstance(x, self.element_class) and x.parent() is self: return x @@ -576,7 +575,6 @@ def _coerce_map_from_(self, M): sage: V = QQ^3 / [[1,2,3]] sage: V.coerce_map_from(QQ^2) - """ from sage.modules.free_module import FreeModule_ambient if (isinstance(M, FreeModule_ambient) diff --git a/src/sage/modules/tensor_operations.py b/src/sage/modules/tensor_operations.py index 4a28d96880e..2f17640d89e 100644 --- a/src/sage/modules/tensor_operations.py +++ b/src/sage/modules/tensor_operations.py @@ -71,13 +71,13 @@ def symmetrized_coordinate_sums(dim, n): """ - Return formal symmetrized sum of multi-indices + Return formal symmetrized sum of multi-indices. INPUT: - - ``dim`` -- integer. The dimension (range of each index). + - ``dim`` -- integer; the dimension (range of each index) - - ``n`` -- integer. The total number of indices. + - ``n`` -- integer; the total number of indices OUTPUT: @@ -103,13 +103,13 @@ def symmetrized_coordinate_sums(dim, n): def antisymmetrized_coordinate_sums(dim, n): """ - Return formal anti-symmetrized sum of multi-indices + Return formal anti-symmetrized sum of multi-indices. INPUT: - - ``dim`` -- integer. The dimension (range of each index). + - ``dim`` -- integer; the dimension (range of each index) - - ``n`` -- integer. The total number of indices. + - ``n`` -- integer; the total number of indices OUTPUT: @@ -143,9 +143,9 @@ class VectorCollection(FreeModule_ambient_field): INPUT: - - ``dim`` -- integer. The dimension of the ambient vector space. + - ``dim`` -- integer; the dimension of the ambient vector space - - ``base_ring`` -- a field. The base field of the ambient vector space. + - ``base_ring`` -- a field; the base field of the ambient vector space - ``rays`` -- any list/iterable of things than can be converted into vectors of the ambient vector space. These will be used to @@ -189,7 +189,7 @@ def __init__(self, vector_collection, base_ring, dim): def vectors(self): """ - Return the collection of vectors + Return the collection of vectors. OUTPUT: @@ -207,7 +207,7 @@ def vectors(self): def n_vectors(self): """ - Return the number of vectors + Return the number of vectors. OUTPUT: integer @@ -234,10 +234,10 @@ class TensorOperation(VectorCollection): INPUT: - ``vector_collections`` -- a nonempty list/tuple/iterable of - :class:`VectorCollection` objects. + :class:`VectorCollection` objects - - ``operation`` -- string. The tensor operation. Currently allowed - values are ``product``, ``symmetric``, and ``antisymmetric``. + - ``operation`` -- string; the tensor operation. Currently allowed + values are ``'product'``, ``'symmetric'``, and ``'antisymmetric'``. .. TODO:: @@ -298,7 +298,7 @@ def _init_product_vectors(self, i): INPUT: - - `i` -- list/tuple of integers. Multi-index of length equal + - ``i`` -- list/tuple of integers. Multi-index of length equal to the number of constituent vector collections. The `j`-th entry `i[j]` indexes a ray in the `j`-th vector collection. Hence, `i` specifies one element in each vector @@ -351,12 +351,12 @@ def _init_power_operation_vectors(self, i, linear_combinations): INPUT: - - `i` -- list/tuple of integers. Specifies one element + - ``i`` -- list/tuple of integers. Specifies one element (vector) in each vector collection as in - :meth:`_init_product_vector`. + :meth:`_init_product_vector` - ``linear_combination`` -- formal linear combination of - vector indices in the vectors specified by `i`. + vector indices in the vectors specified by `i` EXAMPLES:: @@ -389,7 +389,7 @@ def _init_power_operation_vectors(self, i, linear_combinations): def _init_product(self): """ - Initialization for the tensor product + Initialization for the tensor product. EXAMPLES:: @@ -431,7 +431,7 @@ def _init_symmetric(self): def _init_antisymmetric(self): """ - Initialization for the antisymmetric product + Initialization for the antisymmetric product. EXAMPLES:: @@ -550,7 +550,7 @@ def codomain(self): """ The codomain of the index map. - OUTPUT: a list of integers. The image of :meth:`index_map` + OUTPUT: list of integers; the image of :meth:`index_map` EXAMPLES:: diff --git a/src/sage/modules/torsion_quadratic_module.py b/src/sage/modules/torsion_quadratic_module.py index 7de0bc87f3b..72b79ea95d9 100644 --- a/src/sage/modules/torsion_quadratic_module.py +++ b/src/sage/modules/torsion_quadratic_module.py @@ -97,7 +97,7 @@ class TorsionQuadraticModuleElement(FGP_Element): - ``x`` -- element of ``parent.V()`` - - ``check`` -- bool (default: ``True``) + - ``check`` -- boolean (default: ``True``) TESTS:: @@ -205,7 +205,7 @@ class TorsionQuadraticModule(FGP_Module_class, CachedRepresentation): - ``W`` -- a submodule of ``V`` of the same rank as ``V`` - - ``check`` -- bool (default: ``True``) + - ``check`` -- boolean (default: ``True``) - ``modulus`` -- a rational number dividing `m` (default: `m`); the inner product `b` is defined in `\QQ /` ``modulus`` `\ZZ` @@ -328,7 +328,7 @@ def _module_constructor(self, V, W, check=False): - ``W`` -- a submodule of ``V`` over the same base ring - - ``check`` -- bool (default: ``False``); + - ``check`` -- boolean (default: ``False``) * if ``False``, then the value modulus is inherited from ``self`` * if ``True``, it figures it out on its own. But that is expensive @@ -421,9 +421,7 @@ def brown_invariant(self): The Brown invariant is additive with respect to direct sums of torsion quadratic modules. - OUTPUT: - - - an element of `\Zmod{8}` + OUTPUT: an element of `\Zmod{8}` EXAMPLES:: @@ -752,8 +750,8 @@ def is_genus(self, signature_pair, even=True): INPUT: - - ``signature_pair`` -- a tuple of non negative integers ``(s_plus, s_minus)`` - - ``even`` -- bool (default: ``True``) + - ``signature_pair`` -- tuple of nonnegative integers ``(s_plus, s_minus)`` + - ``even`` -- boolean (default: ``True``) EXAMPLES:: @@ -827,7 +825,7 @@ def orthogonal_group(self, gens=None, check=False): INPUT: - - ``gens`` -- a list of generators, for instance square matrices, + - ``gens`` -- a list of generators, for instance square matrices, something that acts on ``self``, or an automorphism of the underlying abelian group - ``check`` -- perform additional checks on the generators @@ -983,12 +981,10 @@ def normal_form(self, partial=False): INPUT: - - ``partial`` -- bool (default: ``False``) return only a partial normal form; - it is not unique but still useful to extract invariants - - OUTPUT: + - ``partial`` -- boolean (default: ``False``); return only a partial + normal form. It is not unique but still useful to extract invariants. - - a torsion quadratic module + OUTPUT: a torsion quadratic module EXAMPLES:: @@ -1123,11 +1119,9 @@ def primary_part(self, m): INPUT: - - ``m`` -- an integer + - ``m`` -- integer - OUTPUT: - - - a submodule + OUTPUT: a submodule EXAMPLES:: @@ -1160,11 +1154,9 @@ def submodule_with_gens(self, gens): INPUT: - - ``gens`` -- a list of generators that convert into ``self`` - - OUTPUT: + - ``gens`` -- list of generators that convert into ``self`` - - a submodule with the specified generators + OUTPUT: a submodule with the specified generators EXAMPLES:: diff --git a/src/sage/modules/vector_callable_symbolic_dense.py b/src/sage/modules/vector_callable_symbolic_dense.py index eb2cf2eedfd..8f23e78114f 100644 --- a/src/sage/modules/vector_callable_symbolic_dense.py +++ b/src/sage/modules/vector_callable_symbolic_dense.py @@ -55,7 +55,7 @@ class Vector_callable_symbolic_dense(free_module_element.FreeModuleElement_generic_dense): def _repr_(self): """ - Returns the string representation of the vector + Return the string representation of the vector. EXAMPLES:: diff --git a/src/sage/modules/vector_complex_double_dense.pyx b/src/sage/modules/vector_complex_double_dense.pyx index 59b585f912c..c8aaedce365 100644 --- a/src/sage/modules/vector_complex_double_dense.pyx +++ b/src/sage/modules/vector_complex_double_dense.pyx @@ -71,7 +71,7 @@ cdef class Vector_complex_double_dense(Vector_double_dense): def __reduce__(self): """ - Pickling + Pickling. EXAMPLES:: diff --git a/src/sage/modules/vector_double_dense.pyx b/src/sage/modules/vector_double_dense.pyx index 79f42205439..5c184c96967 100644 --- a/src/sage/modules/vector_double_dense.pyx +++ b/src/sage/modules/vector_double_dense.pyx @@ -103,7 +103,7 @@ cdef class Vector_double_dense(Vector_numpy_dense): cpdef _sub_(self, right): """ - Return self - right + Return ``self - right``. EXAMPLES:: @@ -123,7 +123,7 @@ cdef class Vector_double_dense(Vector_numpy_dense): cpdef _dot_product_(self, Vector right): """ - Dot product of self and right. + Dot product of ``self`` and ``right``. EXAMPLES:: @@ -147,7 +147,7 @@ cdef class Vector_double_dense(Vector_numpy_dense): cpdef _pairwise_product_(self, Vector right): """ - Return the component-wise product of self and right. + Return the component-wise product of ``self`` and ``right``. EXAMPLES:: @@ -170,7 +170,7 @@ cdef class Vector_double_dense(Vector_numpy_dense): cpdef _rmul_(self, Element left): """ - Multiply a scalar and vector + Multiply a scalar and vector. EXAMPLES:: @@ -186,7 +186,7 @@ cdef class Vector_double_dense(Vector_numpy_dense): cpdef _lmul_(self, Element right): """ - Multiply a scalar and vector + Multiply a scalar and vector. EXAMPLES:: @@ -200,7 +200,7 @@ cdef class Vector_double_dense(Vector_numpy_dense): return self._new(self._vector_numpy*self._python_dtype(right)) - def inv_fft(self,algorithm="radix2", inplace=False): + def inv_fft(self, algorithm='radix2', inplace=False): """ This performs the inverse fast Fourier transform on the vector. @@ -217,15 +217,15 @@ cdef class Vector_double_dense(Vector_numpy_dense): sage: max(v - w.inv_fft()) < 1e-12 True """ - return self.fft(direction="backward",algorithm=algorithm,inplace=inplace) + return self.fft(direction='backward', algorithm=algorithm, inplace=inplace) - def fft(self, direction = "forward", algorithm = "radix2", inplace=False): + def fft(self, direction='forward', algorithm='radix2', inplace=False): """ This performs a fast Fourier transform on the vector. INPUT: - - direction -- 'forward' (default) or 'backward' + - ``direction`` -- string; ``'forward'`` (default) or ``'backward'`` The algorithm and inplace arguments are ignored. @@ -311,7 +311,7 @@ cdef class Vector_double_dense(Vector_numpy_dense): def zero_at(self, eps): r""" - Returns a copy with small entries replaced by zeros. + Return a copy with small entries replaced by zeros. This is useful for modifying output from algorithms which have large relative errors when producing zero @@ -328,7 +328,6 @@ cdef class Vector_double_dense(Vector_numpy_dense): complex vectors, the real and imaginary parts are considered individually. - EXAMPLES:: sage: v = vector(RDF, [1.0, 2.0, 10^-10, 3.0]) @@ -360,11 +359,11 @@ cdef class Vector_double_dense(Vector_numpy_dense): def norm(self, p=2): r""" - Returns the norm (or related computations) of the vector. + Return the norm (or related computations) of the vector. INPUT: - - ``p`` -- (default: 2); controls which norm is computed, + - ``p`` -- (default: 2) controls which norm is computed, allowable values are any real number and positive and negative infinity. See output discussion for specifics. @@ -376,12 +375,11 @@ cdef class Vector_double_dense(Vector_numpy_dense): - ``p = Infinity`` or ``p = oo``: the maximum of the absolute values of the entries, where the absolute value - of the complex number `a+bi` is `\sqrt{a^2+b^2}`. + of the complex number `a+bi` is `\sqrt{a^2+b^2}` - ``p = -Infinity`` or ``p = -oo``: the minimum of the - absolute values of the entries. - - ``p = 0`` : the number of nonzero entries in the vector. - - ``p`` is any other real number: for a vector `\vec{x}` - this method computes + absolute values of the entries + - ``p = 0``: the number of nonzero entries in the vector + - ``p`` any other real number: for a vector `\vec{x}` this method computes .. MATH:: @@ -470,7 +468,7 @@ cdef class Vector_double_dense(Vector_numpy_dense): except Exception: raise ValueError("vector norm 'p' must be +/- infinity or a real number, not %s" % p) n = numpy.linalg.norm(self._vector_numpy, ord=p) - # p = 0 returns integer *count* of non-zero entries + # p = 0 returns integer *count* of nonzero entries return RDF(n) ############################# @@ -498,7 +496,7 @@ cdef class Vector_double_dense(Vector_numpy_dense): INPUT: - - ``population`` -- If False, calculate the sample variance. + - ``population`` -- if ``False``, calculate the sample variance EXAMPLES:: @@ -523,7 +521,9 @@ cdef class Vector_double_dense(Vector_numpy_dense): Calculate the standard deviation of entries of the vector. INPUT: - population -- If False, calculate the sample standard deviation. + + - ``population`` -- If ``False``, calculate the sample standard + deviation EXAMPLES:: @@ -567,7 +567,7 @@ cdef class Vector_double_dense(Vector_numpy_dense): def prod(self): """ - Return the product of the entries of self. + Return the product of the entries of ``self``. EXAMPLES:: @@ -582,7 +582,7 @@ cdef class Vector_double_dense(Vector_numpy_dense): def sum(self): """ - Return the sum of the entries of self. + Return the sum of the entries of ``self``. EXAMPLES:: diff --git a/src/sage/modules/vector_integer_dense.pyx b/src/sage/modules/vector_integer_dense.pyx index 274f1c0dbff..3605f4cf865 100644 --- a/src/sage/modules/vector_integer_dense.pyx +++ b/src/sage/modules/vector_integer_dense.pyx @@ -196,7 +196,7 @@ cdef class Vector_integer_dense(free_module_element.FreeModuleElement): INPUT: - - ``copy``, ignored optional argument. + - ``copy`` -- ignored optional argument EXAMPLES:: @@ -307,7 +307,7 @@ cdef class Vector_integer_dense(free_module_element.FreeModuleElement): INPUT: - - singular -- \Singular interface instance (default: None) + - ``singular`` -- \Singular interface instance (default: ``None``) EXAMPLES:: diff --git a/src/sage/modules/vector_integer_sparse.pyx b/src/sage/modules/vector_integer_sparse.pyx index b647c22fb23..c6dee834b54 100644 --- a/src/sage/modules/vector_integer_sparse.pyx +++ b/src/sage/modules/vector_integer_sparse.pyx @@ -127,7 +127,7 @@ cdef Py_ssize_t mpz_binary_search(mpz_t* v, Py_ssize_t n, mpz_t x, Py_ssize_t* i cdef int mpz_vector_get_entry(mpz_t ans, mpz_vector* v, Py_ssize_t n) except -1: """ Returns the n-th entry of the sparse vector v. This - would be v[n] in Python syntax. + would be ``v[n]`` in Python syntax. The return is done using the pointer ans, which is to an mpz_t that *must* have been initialized using mpz_init. @@ -153,7 +153,7 @@ cdef bint mpz_vector_is_entry_zero_unsafe(mpz_vector* v, Py_ssize_t n) noexcept: cdef object mpz_vector_to_list(mpz_vector* v): """ - Returns a Python list of 2-tuples (i,x), where x=v[i] runs + Return a Python list of 2-tuples (i,x), where ``x=v[i]`` runs through the nonzero elements of x, in order. """ cdef object X @@ -170,7 +170,7 @@ cdef object mpz_vector_to_list(mpz_vector* v): cdef int mpz_vector_set_entry(mpz_vector* v, Py_ssize_t n, mpz_t x) except -1: """ Set the n-th component of the sparse vector v equal to x. - This would be v[n] = x in Python syntax. + This would be ``v[n] = x`` in Python syntax. """ if n >= v.degree or n < 0: raise IndexError("Index (=%s) must be between 0 and %s." % (n, v.degree - 1)) diff --git a/src/sage/modules/vector_numpy_dense.pyx b/src/sage/modules/vector_numpy_dense.pyx index 9b16a6c354d..b6e6d37473f 100644 --- a/src/sage/modules/vector_numpy_dense.pyx +++ b/src/sage/modules/vector_numpy_dense.pyx @@ -53,7 +53,7 @@ cdef class Vector_numpy_dense(FreeModuleElement): def __cinit__(self, parent, entries, coerce=True, copy=True): """ - Set up a new vector + Set up a new vector. EXAMPLES:: @@ -70,7 +70,7 @@ cdef class Vector_numpy_dense(FreeModuleElement): cdef Vector_numpy_dense _new(self, numpy.ndarray vector_numpy): """ - Return a new vector with same parent as self. + Return a new vector with same parent as ``self``. """ cdef Vector_numpy_dense v v = self.__class__.__new__(self.__class__,self._parent,None,None,None) @@ -103,19 +103,19 @@ cdef class Vector_numpy_dense(FreeModuleElement): cdef bint is_dense_c(self) noexcept: """ - Return True (i.e., 1) if self is dense. + Return ``True`` (i.e., 1) if ``self`` is dense. """ return 1 cdef bint is_sparse_c(self) noexcept: """ - Return True (i.e., 1) if self is sparse. + Return ``True`` (i.e., 1) if ``self`` is sparse. """ return 0 def __copy__(self, copy=True): """ - Return a copy of the vector + Return a copy of the vector. EXAMPLES:: @@ -266,8 +266,9 @@ cdef class Vector_numpy_dense(FreeModuleElement): INPUT: - - ``dtype`` -- if specified, the `numpy dtype `_ - of the returned array. + - ``dtype`` -- if specified, the `numpy dtype + `_ of + the returned array EXAMPLES:: diff --git a/src/sage/modules/vector_rational_dense.pyx b/src/sage/modules/vector_rational_dense.pyx index 864628f10c7..22e3c67fcc3 100644 --- a/src/sage/modules/vector_rational_dense.pyx +++ b/src/sage/modules/vector_rational_dense.pyx @@ -234,7 +234,7 @@ cdef class Vector_rational_dense(free_module_element.FreeModuleElement): INPUT: - - ``copy``, ignored optional argument. + - ``copy`` -- ignored optional argument EXAMPLES:: diff --git a/src/sage/modules/vector_rational_sparse.pyx b/src/sage/modules/vector_rational_sparse.pyx index 2c661f34bab..03073ef2b96 100644 --- a/src/sage/modules/vector_rational_sparse.pyx +++ b/src/sage/modules/vector_rational_sparse.pyx @@ -133,11 +133,11 @@ cdef Py_ssize_t mpq_binary_search(mpq_t* v, Py_ssize_t n, mpq_t x, Py_ssize_t* i cdef int mpq_vector_get_entry(mpq_t ans, mpq_vector* v, Py_ssize_t n) except -1: """ - Returns the n-th entry of the sparse vector v. This - would be v[n] in Python syntax. + Return the n-th entry of the sparse vector v. This + would be ``v[n]`` in Python syntax. - The return is done using the pointer ans, which is to an mpq_t - that *must* have been initialized using mpq_init. + The return is done using the pointer ``ans``, which is to an ``mpq_t`` + that *must* have been initialized using ``mpq_init``. """ if n >= v.degree: raise IndexError("Index must be between 0 and %s." % (v.degree - 1)) @@ -160,7 +160,7 @@ cdef bint mpq_vector_is_entry_zero_unsafe(mpq_vector* v, Py_ssize_t n) noexcept: cdef object mpq_vector_to_list(mpq_vector* v): """ - Returns a Python list of 2-tuples (i,x), where x=v[i] runs + Return a Python list of 2-tuples (i,x), where ``x=v[i]`` runs through the nonzero elements of x, in order. """ cdef object X @@ -177,7 +177,7 @@ cdef object mpq_vector_to_list(mpq_vector* v): cdef int mpq_vector_set_entry(mpq_vector* v, Py_ssize_t n, mpq_t x) except -1: """ Set the n-th component of the sparse vector v equal to x. - This would be v[n] = x in Python syntax. + This would be ``v[n] = x`` in Python syntax. """ if n >= v.degree or n < 0: raise IndexError("Index must be between 0 and the degree minus 1.") @@ -250,7 +250,7 @@ mpq_init(mpq_set_tmp) cdef int mpq_vector_set_entry_str(mpq_vector* v, Py_ssize_t n, char *x_str) except -1: """ Set the n-th component of the sparse vector v equal to x. - This would be v[n] = x in Python syntax. + This would be ``v[n] = x`` in Python syntax. """ mpq_set_str(mpq_set_tmp, x_str, 0) mpq_vector_set_entry(v, n, mpq_set_tmp) diff --git a/src/sage/modules/vector_real_double_dense.pyx b/src/sage/modules/vector_real_double_dense.pyx index 0bedec59d58..8ed7210422b 100644 --- a/src/sage/modules/vector_real_double_dense.pyx +++ b/src/sage/modules/vector_real_double_dense.pyx @@ -62,7 +62,7 @@ cdef class Vector_real_double_dense(Vector_double_dense): def stats_skew(self): """ - Computes the skewness of a data set. + Compute the skewness of a data set. For normally distributed data, the skewness should be about 0. A skewness value > 0 means that there is more weight in the @@ -80,7 +80,7 @@ cdef class Vector_real_double_dense(Vector_double_dense): def __reduce__(self): """ - Pickling + Pickling. EXAMPLES:: diff --git a/src/sage/modules/vector_space_homspace.py b/src/sage/modules/vector_space_homspace.py index 1589e66d640..78ce5cdb352 100644 --- a/src/sage/modules/vector_space_homspace.py +++ b/src/sage/modules/vector_space_homspace.py @@ -254,7 +254,7 @@ def __call__(self, A, check=True, **kwds): INPUT: - ``A`` -- one of several possible inputs representing - a morphism from this vector space homspace. + a morphism from this vector space homspace: - a vector space morphism in this homspace - a matrix representation relative to the bases of the vector spaces, @@ -262,13 +262,12 @@ def __call__(self, A, check=True, **kwds): - a list or tuple containing images of the domain's basis vectors - a function from the domain to the codomain - - ``check`` (default: ``True``) -- ``True`` or ``False``, required for - compatibility with calls from - :meth:`sage.structure.parent.Parent.hom`. + - ``check`` -- boolean (default: ``True``); required for compatibility + with calls from :meth:`sage.structure.parent.Parent.hom` - - the keyword ``side`` can be assigned the values ``"left"`` or - ``"right"``. It corresponds to the side of vectors relative to the - matrix. + - the keyword ``side`` can be assigned the values ``'left'`` or + ``'right'``; it corresponds to the side of vectors relative to the + matrix EXAMPLES:: diff --git a/src/sage/modules/vector_space_morphism.py b/src/sage/modules/vector_space_morphism.py index 460e8fba728..9eee6152585 100644 --- a/src/sage/modules/vector_space_morphism.py +++ b/src/sage/modules/vector_space_morphism.py @@ -345,7 +345,7 @@ def linear_transformation(arg0, arg1=None, arg2=None, side='left'): the same field that are the domain and codomain (respectively) of the linear transformation. - ``side`` is a keyword that is either 'left' or 'right'. + ``side`` is a keyword that is either ``'left'`` or ``'right'``. When a matrix is used to specify a linear transformation, as in the first two call formats below, you may specify if the function is given by matrix multiplication with @@ -781,7 +781,7 @@ def linear_transformation(arg0, arg1=None, arg2=None, side='left'): def is_VectorSpaceMorphism(x) -> bool: r""" - Returns ``True`` if ``x`` is a vector space morphism (a linear transformation). + Return ``True`` if ``x`` is a vector space morphism (a linear transformation). This function is deprecated. @@ -815,17 +815,17 @@ def is_VectorSpaceMorphism(x) -> bool: class VectorSpaceMorphism(free_module_morphism.FreeModuleMorphism): - def __init__(self, homspace, A, side="left"): + def __init__(self, homspace, A, side='left'): r""" Create a linear transformation, a morphism between vector spaces. INPUT: - - ``homspace`` -- a homspace (of vector spaces) to serve - as a parent for the linear transformation and a home for - the domain and codomain of the morphism - - ``A`` -- a matrix representing the linear transformation, - which will act on vectors placed to the left of the matrix + - ``homspace`` -- a homspace (of vector spaces) to serve + as a parent for the linear transformation and a home for + the domain and codomain of the morphism + - ``A`` -- a matrix representing the linear transformation, + which will act on vectors placed to the left of the matrix EXAMPLES: diff --git a/src/sage/modules/vector_symbolic_dense.py b/src/sage/modules/vector_symbolic_dense.py index b1d47f32966..e3d6524a921 100644 --- a/src/sage/modules/vector_symbolic_dense.py +++ b/src/sage/modules/vector_symbolic_dense.py @@ -59,7 +59,7 @@ def apply_map(phi): """ - Returns a function that applies phi to its argument. + Return a function that applies ``phi`` to its argument. EXAMPLES:: @@ -68,7 +68,6 @@ def apply_map(phi): sage: f = apply_map(lambda x: x+1) sage: f(v) (2, 3, 4) - """ def apply(self, *args, **kwds): """ diff --git a/src/sage/modules/vector_symbolic_sparse.py b/src/sage/modules/vector_symbolic_sparse.py index c0e7fc209b6..290aa282a85 100644 --- a/src/sage/modules/vector_symbolic_sparse.py +++ b/src/sage/modules/vector_symbolic_sparse.py @@ -61,7 +61,7 @@ def apply_map(phi): """ - Returns a function that applies phi to its argument. + Return a function that applies ``phi`` to its argument. EXAMPLES:: @@ -70,7 +70,6 @@ def apply_map(phi): sage: f = apply_map(lambda x: x+1) sage: f(v) (2, 3, 4) - """ def apply(self, *args, **kwds): """ diff --git a/src/sage/modules/with_basis/cell_module.py b/src/sage/modules/with_basis/cell_module.py index 2c5f54de21b..7c61057737c 100644 --- a/src/sage/modules/with_basis/cell_module.py +++ b/src/sage/modules/with_basis/cell_module.py @@ -234,7 +234,7 @@ def bilinear_form_matrix(self, ordering=None): @cached_method def nonzero_bilinear_form(self): """ - Return ``True`` if the bilinear form of ``self`` is non-zero. + Return ``True`` if the bilinear form of ``self`` is nonzero. EXAMPLES:: diff --git a/src/sage/modules/with_basis/indexed_element.pyx b/src/sage/modules/with_basis/indexed_element.pyx index 85428fc1f55..47e2fe1cc6f 100644 --- a/src/sage/modules/with_basis/indexed_element.pyx +++ b/src/sage/modules/with_basis/indexed_element.pyx @@ -31,7 +31,7 @@ from sage.categories.modules import _Fields cdef class IndexedFreeModuleElement(ModuleElement): r""" - Element class for :class:`~sage.combinat.free_module.CombinatorialFreeModule` + Element class for :class:`~sage.combinat.free_module.CombinatorialFreeModule`. TESTS:: @@ -235,10 +235,10 @@ cdef class IndexedFreeModuleElement(ModuleElement): INPUT: - - ``copy`` -- (default: ``True``) if ``self`` is internally - represented by a dictionary ``d``, then make a copy of ``d``; - if ``False``, then this can cause undesired behavior by - mutating ``d`` + - ``copy`` -- boolean (default: ``True``); if ``self`` is internally + represented by a dictionary ``d``, then make a copy of ``d``. + If ``False``, then this can cause undesired behavior by + mutating ``d``. EXAMPLES:: @@ -786,7 +786,7 @@ cdef class IndexedFreeModuleElement(ModuleElement): - ``new_base_ring`` -- a ring (default: ``None``) - ``order`` -- (optional) an ordering of the support of ``self`` - - ``sparse`` -- (default: ``False``) whether to return a sparse + - ``sparse`` -- boolean (default: ``False``); whether to return a sparse vector or a dense vector OUTPUT: a :func:`FreeModule` vector diff --git a/src/sage/modules/with_basis/invariant.py b/src/sage/modules/with_basis/invariant.py index 7e7600f3069..bed429a1c75 100644 --- a/src/sage/modules/with_basis/invariant.py +++ b/src/sage/modules/with_basis/invariant.py @@ -257,7 +257,7 @@ def _invariant_map(g, x): # Give the intersection of kernels of the map `s*x-x` to determine when # `s*x = x` for all generators `s` of `S` - basis = M.annihilator_basis(S.gens(), action=_invariant_map, side="left") + basis = M.annihilator_basis(S.gens(), action=_invariant_map, side='left') super().__init__(Family(basis), support_order=M._compute_support_order(basis), @@ -905,7 +905,7 @@ def proj_difference(g, x): basis = M.annihilator_basis(M.basis(), action=proj_difference, - side="left") + side='left') super().__init__(Family(basis), support_order=M._compute_support_order(basis), diff --git a/src/sage/modules/with_basis/morphism.py b/src/sage/modules/with_basis/morphism.py index 5ca0b4ff03f..043dff56290 100644 --- a/src/sage/modules/with_basis/morphism.py +++ b/src/sage/modules/with_basis/morphism.py @@ -133,10 +133,10 @@ class ModuleMorphism(Morphism): INPUT: - ``domain`` -- a parent in ``ModulesWithBasis(...)`` - - ``codomain`` -- a parent in ``Modules(...)``; + - ``codomain`` -- a parent in ``Modules(...)`` - ``category`` -- a category or ``None`` (default: `None``) - ``affine`` -- whether we define an affine module morphism - (default: ``False``). + (default: ``False``) Construct a module morphism from ``domain`` to ``codomain`` in the category ``category``. By default, the category is the first of @@ -164,7 +164,7 @@ class of ``self`` upon construction. """ def __init__(self, domain, codomain=None, category=None, affine=False): """ - Initialization of module morphisms + Initialization of module morphisms. TESTS:: @@ -252,7 +252,7 @@ def __init__(self, domain, function, codomain=None, category=None): """ TESTS:: - sage: X = CombinatorialFreeModule(ZZ, [1,2,3]); X.rename("X"); x = X.basis() + sage: X = CombinatorialFreeModule(ZZ, [1,2,3]); X.rename('X'); x = X.basis() sage: from sage.modules.with_basis.morphism import ModuleMorphismFromFunction sage: def f(x): return 3*x sage: import __main__; __main__.f = f # Fake f being defined in a python module @@ -277,7 +277,7 @@ class ModuleMorphismByLinearity(ModuleMorphism): ``domain`` as ``position``-th argument - ``codomain`` -- a parent in ``Modules(...)`` (default: ``on_basis.codomain()``) - - ``position`` -- a non-negative integer (default: 0) + - ``position`` -- nonnegative integer (default: 0) - ``zero`` -- the zero of the codomain (defaults: ``codomain.zero()``) .. SEEALSO:: @@ -341,7 +341,6 @@ def _richcmp_(self, other, op): sage: h3 = X.module_morphism(on_basis=Y.monomial * abs, category=Modules(ZZ)) sage: f == g, f == h1, f == h2, f == h3, f == 1, 1 == f (True, False, False, False, False, False) - """ if op == op_EQ: return (self.__class__ is other.__class__ @@ -418,7 +417,7 @@ def __call__(self, *args): class TriangularModuleMorphism(ModuleMorphism): r""" - An abstract class for triangular module morphisms + An abstract class for triangular module morphisms. Let `X` and `Y` be modules over the same base ring, with distinguished bases `F` indexed by `I` and `G` indexed by `J`, @@ -446,10 +445,10 @@ class TriangularModuleMorphism(ModuleMorphism): - ``codomain`` -- a module with basis `Y` (default: `X`) - ``category`` -- a category, as for :class:`ModuleMorphism` - - ``triangular`` -- ``"upper"`` or ``"lower"`` (default: ``"upper"``) + - ``triangular`` -- ``'upper'`` or ``'lower'`` (default: ``'upper'``) - ``unitriangular`` -- boolean (default: ``False``) - As a shorthand, one may use ``unitriangular="lower"`` - for ``triangular="lower", unitriangular=True``. + As a shorthand, one may use ``unitriangular='lower'`` + for ``triangular='lower', unitriangular=True``. - ``key`` -- a comparison key on `J` (default: the usual comparison of elements of `J`) @@ -461,7 +460,7 @@ class TriangularModuleMorphism(ModuleMorphism): domain. This of course requires the domain to be finite dimensional. - - ``invertible`` -- a boolean or ``None`` (default: ``None``); can + - ``invertible`` -- boolean or ``None`` (default: ``None``); can be set to specify that `\phi` is known to be (or not to be) invertible. If the domain and codomain share the same indexing set, this is by default automatically set to ``True`` if @@ -494,10 +493,10 @@ class TriangularModuleMorphism(ModuleMorphism): two free `\QQ`-modules:: sage: I = range(1,200) - sage: X = CombinatorialFreeModule(QQ, I); X.rename("X"); x = X.basis() - sage: Y = CombinatorialFreeModule(QQ, I); Y.rename("Y"); y = Y.basis() + sage: X = CombinatorialFreeModule(QQ, I); X.rename('X'); x = X.basis() + sage: Y = CombinatorialFreeModule(QQ, I); Y.rename('Y'); y = Y.basis() sage: ut = Y.sum_of_monomials * divisors # This * is map composition. - sage: phi = X.module_morphism(ut, unitriangular="upper", codomain=Y) + sage: phi = X.module_morphism(ut, unitriangular='upper', codomain=Y) sage: phi(x[2]) B[1] + B[2] sage: phi(x[6]) @@ -515,9 +514,9 @@ class TriangularModuleMorphism(ModuleMorphism): A lower triangular (but not unitriangular) morphism:: - sage: X = CombinatorialFreeModule(QQ, [1, 2, 3]); X.rename("X"); x = X.basis() + sage: X = CombinatorialFreeModule(QQ, [1, 2, 3]); X.rename('X'); x = X.basis() sage: def lt(i): return sum(j*x[j] for j in range(i,4)) - sage: phi = X.module_morphism(lt, triangular="lower", codomain=X) + sage: phi = X.module_morphism(lt, triangular='lower', codomain=X) sage: phi(x[2]) 2*B[2] + 3*B[3] sage: phi.preimage(x[2]) @@ -528,10 +527,10 @@ class TriangularModuleMorphism(ModuleMorphism): Using the ``key`` keyword, we can use triangularity even if the map becomes triangular only after a permutation of the basis:: - sage: X = CombinatorialFreeModule(QQ, [1, 2, 3]); X.rename("X"); x = X.basis() + sage: X = CombinatorialFreeModule(QQ, [1, 2, 3]); X.rename('X'); x = X.basis() sage: def ut(i): return (x[1] + x[2] if i == 1 else x[2] + (x[3] if i == 3 else 0)) sage: perm = [0, 2, 1, 3] - sage: phi = X.module_morphism(ut, triangular="upper", codomain=X, + sage: phi = X.module_morphism(ut, triangular='upper', codomain=X, ....: key=lambda a: perm[a]) sage: [phi(x[i]) for i in range(1, 4)] [B[1] + B[2], B[2], B[2] + B[3]] @@ -541,7 +540,7 @@ class TriangularModuleMorphism(ModuleMorphism): The same works in the lower-triangular case:: sage: def lt(i): return (x[1] + x[2] + x[3] if i == 2 else x[i]) - sage: phi = X.module_morphism(lt, triangular="lower", codomain=X, + sage: phi = X.module_morphism(lt, triangular='lower', codomain=X, ....: key=lambda a: perm[a]) sage: [phi(x[i]) for i in range(1, 4)] [B[1], B[1] + B[2] + B[3], B[3]] @@ -555,7 +554,7 @@ class TriangularModuleMorphism(ModuleMorphism): sage: X = CombinatorialFreeModule(QQ, [1,2,3]); x = X.basis() sage: Y = CombinatorialFreeModule(QQ, [1,2,3,4,5]); y = Y.basis() sage: ult = lambda i: sum( y[j] for j in range(i+1,6) ) - sage: phi = X.module_morphism(ult, unitriangular="lower", codomain=Y, + sage: phi = X.module_morphism(ult, unitriangular='lower', codomain=Y, ....: inverse_on_support=lambda i: i-1 if i in [2,3,4] else None) sage: phi(x[2]) B[3] + B[4] + B[5] @@ -567,13 +566,13 @@ class TriangularModuleMorphism(ModuleMorphism): them has to be permuted in order to render the morphism triangular. For example:: - sage: X = CombinatorialFreeModule(QQ, [1, 2, 3]); X.rename("X"); x = X.basis() + sage: X = CombinatorialFreeModule(QQ, [1, 2, 3]); X.rename('X'); x = X.basis() sage: def ut(i): ....: return (x[3] if i == 1 else x[1] if i == 2 ....: else x[1] + x[2]) sage: def perm(i): ....: return (2 if i == 1 else 3 if i == 2 else 1) - sage: phi = X.module_morphism(ut, triangular="upper", codomain=X, + sage: phi = X.module_morphism(ut, triangular='upper', codomain=X, ....: inverse_on_support=perm) sage: [phi(x[i]) for i in range(1, 4)] [B[3], B[1], B[1] + B[2]] @@ -582,13 +581,13 @@ class TriangularModuleMorphism(ModuleMorphism): The same works if the permutation induces lower triangularity:: - sage: X = CombinatorialFreeModule(QQ, [1, 2, 3]); X.rename("X"); x = X.basis() + sage: X = CombinatorialFreeModule(QQ, [1, 2, 3]); X.rename('X'); x = X.basis() sage: def lt(i): ....: return (x[3] if i == 1 else x[2] if i == 2 ....: else x[1] + x[2]) sage: def perm(i): ....: return 4 - i - sage: phi = X.module_morphism(lt, triangular="lower", codomain=X, + sage: phi = X.module_morphism(lt, triangular='lower', codomain=X, ....: inverse_on_support=perm) sage: [phi(x[i]) for i in range(1, 4)] [B[3], B[2], B[1] + B[2]] @@ -601,8 +600,8 @@ class TriangularModuleMorphism(ModuleMorphism): sage: X = CombinatorialFreeModule(QQ, [1, 2, 3]); x = X.basis() sage: Y = CombinatorialFreeModule(QQ, [1, 2, 3, 4]); y = Y.basis() sage: ut = lambda i: sum( y[j] for j in range(1,i+2) ) - sage: phi = X.module_morphism(ut, triangular="upper", codomain=Y, - ....: inverse_on_support="compute") + sage: phi = X.module_morphism(ut, triangular='upper', codomain=Y, + ....: inverse_on_support='compute') sage: tx = "{} {} {}" sage: for j in Y.basis().keys(): ....: i = phi._inverse_on_support(j) @@ -614,7 +613,7 @@ class TriangularModuleMorphism(ModuleMorphism): The ``inverse_on_basis`` and ``key`` keywords can be combined:: - sage: X = CombinatorialFreeModule(QQ, [1, 2, 3]); X.rename("X") + sage: X = CombinatorialFreeModule(QQ, [1, 2, 3]); X.rename('X') sage: x = X.basis() sage: def ut(i): ....: return (2*x[2] + 3*x[3] if i == 1 @@ -623,22 +622,22 @@ class TriangularModuleMorphism(ModuleMorphism): sage: def perm(i): ....: return (2 if i == 1 else 3 if i == 2 else 1) sage: perverse_key = lambda a: (a - 2) % 3 - sage: phi = X.module_morphism(ut, triangular="upper", codomain=X, + sage: phi = X.module_morphism(ut, triangular='upper', codomain=X, ....: inverse_on_support=perm, key=perverse_key) sage: [phi(x[i]) for i in range(1, 4)] [2*B[2] + 3*B[3], B[1] + B[2] + B[3], 4*B[2]] sage: [phi.preimage(x[i]) for i in range(1, 4)] [-1/3*B[1] + B[2] - 1/12*B[3], 1/4*B[3], 1/3*B[1] - 1/6*B[3]] """ - def __init__(self, triangular="upper", unitriangular=False, + def __init__(self, triangular='upper', unitriangular=False, key=None, inverse=None, inverse_on_support=identity, invertible=None): """ TESTS:: - sage: X = CombinatorialFreeModule(QQ, [1, 2, 3]); X.rename("X"); x = X.basis() + sage: X = CombinatorialFreeModule(QQ, [1, 2, 3]); X.rename('X'); x = X.basis() sage: def lt(i): return sum(j*x[j] for j in range(i,4)) sage: import __main__; __main__.lt = lt # Fake lt being defined in a python module - sage: phi = X.module_morphism(lt, triangular="lower", codomain=X) + sage: phi = X.module_morphism(lt, triangular='lower', codomain=X) sage: phi.__class__ sage: phi._invertible @@ -647,14 +646,14 @@ def __init__(self, triangular="upper", unitriangular=False, With the option ``compute``:: - sage: phi = X.module_morphism(lt, triangular="lower", codomain=X, - ....: inverse_on_support="compute") + sage: phi = X.module_morphism(lt, triangular='lower', codomain=X, + ....: inverse_on_support='compute') sage: TestSuite(phi).run(skip=["_test_pickling"]) Pickling works in Python3 (:issue:`17957`):: - sage: phi = X.module_morphism(lt, triangular="lower", codomain=X, - ....: inverse_on_support="compute") + sage: phi = X.module_morphism(lt, triangular='lower', codomain=X, + ....: inverse_on_support='compute') sage: loads(dumps(phi)) Generic endomorphism of X sage: phi._inverse_on_support @@ -699,22 +698,21 @@ def _richcmp_(self, other, op): TESTS:: - sage: X = CombinatorialFreeModule(QQ, [1, 2, 3]); X.rename("X"); x = X.basis() + sage: X = CombinatorialFreeModule(QQ, [1, 2, 3]); X.rename('X'); x = X.basis() sage: def ut(i): return (x[1] + x[2] if i == 1 else x[2] + (x[3] if i == 3 else 0)) sage: perm = [0, 2, 1, 3] sage: our_key = lambda a: perm[a] - sage: phi = X.module_morphism(ut, triangular="upper", codomain=X, key=our_key) + sage: phi = X.module_morphism(ut, triangular='upper', codomain=X, key=our_key) sage: def ut2(i): return (x[1] + 7*x[2] if i == 1 else x[2] + (x[3] if i == 3 else 0)) - sage: phi2 = X.module_morphism(ut2, triangular="upper", codomain=X, key=our_key) + sage: phi2 = X.module_morphism(ut2, triangular='upper', codomain=X, key=our_key) sage: def lt(i): return (x[1] + x[2] + x[3] if i == 2 else x[i]) - sage: psi = X.module_morphism(lt, triangular="lower", codomain=X, key=our_key) + sage: psi = X.module_morphism(lt, triangular='lower', codomain=X, key=our_key) sage: phi == phi True sage: phi == phi2 False sage: phi == psi False - """ if op == op_EQ: return (self.__class__ is other.__class__ @@ -729,7 +727,7 @@ def _richcmp_(self, other, op): def _test_triangular(self, **options): """ - Test that ``self`` is actually triangular + Test that ``self`` is actually triangular. See also: :class:`sage.misc.sage_unittest.TestSuite`. @@ -738,11 +736,11 @@ def _test_triangular(self, **options): sage: X = CombinatorialFreeModule(QQ, [1, 2, 3]); x = X.basis() sage: Y = CombinatorialFreeModule(QQ, [1, 2, 3]); y = Y.basis() sage: lt = lambda i: sum( y[j] for j in range(i,4) ) - sage: phi = X.module_morphism(lt, triangular="lower", codomain=Y) + sage: phi = X.module_morphism(lt, triangular='lower', codomain=Y) sage: phi._test_triangular() sage: lt = lambda i: sum( y[j] for j in range(i+1,4) ) - sage: phi = X.module_morphism(lt, triangular="lower", codomain=Y) + sage: phi = X.module_morphism(lt, triangular='lower', codomain=Y) sage: phi._test_triangular() Traceback (most recent call last): ... @@ -751,12 +749,12 @@ def _test_triangular(self, **options): sage: X = CombinatorialFreeModule(QQ, [1,2,3]); x = X.basis() sage: Y = CombinatorialFreeModule(QQ, [1,2,3,4,5]); y = Y.basis() sage: ult = lambda i: sum( y[j] for j in range(i+1,6) ) - sage: phi = X.module_morphism(ult, unitriangular="lower", codomain=Y, + sage: phi = X.module_morphism(ult, unitriangular='lower', codomain=Y, ....: inverse_on_support=lambda i: i-1 if i in [2,3,4] else None) sage: phi._test_triangular() sage: ult = lambda i: sum( 2*y[j] for j in range(i+1,6) ) - sage: phi = X.module_morphism(ult, unitriangular="lower", codomain=Y, + sage: phi = X.module_morphism(ult, unitriangular='lower', codomain=Y, ....: inverse_on_support=lambda i: i-1 if i in [2,3,4] else None) sage: phi._test_triangular() Traceback (most recent call last): @@ -791,11 +789,11 @@ def __invert__(self): sage: ut = lambda i: sum(j*y[j] for j in range(1,i+1)) # upper sage: lt = lambda i: sum(j*y[j] for j in range(i,4 )) # lower sage: f_uut = X.module_morphism(uut, codomain=Y, - ....: unitriangular="upper") + ....: unitriangular='upper') sage: f_ult = X.module_morphism(ult, codomain=Y, - ....: unitriangular="lower") - sage: f_ut = X.module_morphism(ut, codomain=Y, triangular="upper") - sage: f_lt = X.module_morphism(lt, codomain=Y, triangular="lower") + ....: unitriangular='lower') + sage: f_ut = X.module_morphism(ut, codomain=Y, triangular='upper') + sage: f_lt = X.module_morphism(lt, codomain=Y, triangular='lower') sage: (~f_uut)(y[2]) -B[1] + B[2] sage: (~f_ult)(y[2]) @@ -826,7 +824,7 @@ def section(self): sage: X.rename('X') sage: Y = CombinatorialFreeModule(QQ, [1,2,3,4,5]); y = Y.basis() sage: ult = lambda i: sum( y[j] for j in range(i+1,6) ) # uni-lower - sage: phi = X.module_morphism(ult, triangular="lower", codomain=Y, + sage: phi = X.module_morphism(ult, triangular='lower', codomain=Y, ....: inverse_on_support=lambda i: i-1 if i in [2,3,4] else None) sage: ~phi Traceback (most recent call last): @@ -877,7 +875,7 @@ def _invert_on_basis(self, i): sage: X = CombinatorialFreeModule(QQ, [1, 2, 3]); x = X.basis() sage: Y = CombinatorialFreeModule(QQ, [1, 2, 3]); y = Y.basis() sage: ult = lambda i: sum( y[j] for j in range(i,4) ) # uni-lower - sage: phi = X.module_morphism(ult, triangular="lower", codomain=Y) + sage: phi = X.module_morphism(ult, triangular='lower', codomain=Y) sage: phi._invert_on_basis(2) B[2] - B[3] """ @@ -892,7 +890,7 @@ def preimage(self, f): sage: X = CombinatorialFreeModule(QQ, [1, 2, 3]); x = X.basis() sage: Y = CombinatorialFreeModule(QQ, [1, 2, 3]); y = Y.basis() sage: ult = lambda i: sum( y[j] for j in range(i,4) ) # uni-lower - sage: phi = X.module_morphism(ult, triangular="lower", codomain=Y) + sage: phi = X.module_morphism(ult, triangular='lower', codomain=Y) sage: phi.preimage(y[1] + y[2]) B[1] - B[3] @@ -902,7 +900,7 @@ def preimage(self, f): sage: X = CombinatorialFreeModule(QQ, [1, 2, 3]); x = X.basis() sage: Y = CombinatorialFreeModule(QQ, [1, 2, 3, 4]); y = Y.basis() sage: lt = lambda i: sum( y[j] for j in range(i,5) ) - sage: phi = X.module_morphism(lt, triangular="lower", codomain=Y) + sage: phi = X.module_morphism(lt, triangular='lower', codomain=Y) sage: phi.preimage(y[1] + y[2]) B[1] - B[3] @@ -912,7 +910,7 @@ def preimage(self, f): sage: X = CombinatorialFreeModule(QQ, [1, 2, 3]); x = X.basis() sage: Y = CombinatorialFreeModule(QQ, [1, 2, 3, 4, 5]); y = Y.basis() sage: lt = lambda i: sum( y[j] for j in range(i+1,6) ) # lower - sage: phi = X.module_morphism(lt, triangular="lower", codomain=Y, + sage: phi = X.module_morphism(lt, triangular='lower', codomain=Y, ....: inverse_on_support=lambda i: i-1 if i in [2,3,4] else None) sage: phi(x[1]) B[2] + B[3] + B[4] + B[5] @@ -941,7 +939,7 @@ def preimage(self, f): sage: X = CombinatorialFreeModule(ZZ, [1, 2, 3]); x = X.basis() sage: Y = CombinatorialFreeModule(ZZ, [1, 2, 3]); y = Y.basis() sage: lt = lambda i: sum( 2* y[j] for j in range(i,4) ) # lower - sage: phi = X.module_morphism(lt, triangular="lower", codomain=Y) + sage: phi = X.module_morphism(lt, triangular='lower', codomain=Y) sage: phi.preimage(2*y[1] + 2*y[2]) B[1] - B[3] @@ -1004,7 +1002,7 @@ def coreduced(self, y): sage: X = CombinatorialFreeModule(QQ, [1,2,3]); x = X.basis() sage: Y = CombinatorialFreeModule(QQ, [1,2,3,4,5]); y = Y.basis() sage: ult = lambda i: sum( y[j] for j in range(i+1,6) ) - sage: phi = X.module_morphism(ult, unitriangular="lower", codomain=Y, + sage: phi = X.module_morphism(ult, unitriangular='lower', codomain=Y, ....: inverse_on_support=lambda i: i-1 if i in [2,3,4] else None) sage: [phi(v) for v in X.basis()] [B[2] + B[3] + B[4] + B[5], @@ -1018,7 +1016,7 @@ def coreduced(self, y): Now with a non unitriangular morphism:: sage: lt = lambda i: sum( j*y[j] for j in range(i+1,6) ) - sage: phi = X.module_morphism(lt, triangular="lower", codomain=Y, + sage: phi = X.module_morphism(lt, triangular='lower', codomain=Y, ....: inverse_on_support=lambda i: i-1 if i in [2,3,4] else None) sage: [phi(v) for v in X.basis()] [2*B[2] + 3*B[3] + 4*B[4] + 5*B[5], @@ -1034,14 +1032,14 @@ def coreduced(self, y): sage: X = CombinatorialFreeModule(ZZ, [1,2,3]); x = X.basis() sage: Y = CombinatorialFreeModule(ZZ, [1,2,3,4,5]); y = Y.basis() - sage: phi = X.module_morphism(ult, unitriangular="lower", codomain=Y, + sage: phi = X.module_morphism(ult, unitriangular='lower', codomain=Y, ....: inverse_on_support=lambda i: i-1 if i in [2,3,4] else None) sage: [phi.coreduced(y[1]-2*y[4])] [B[1] + 2*B[5]] sage: [phi.coreduced(v) for v in y] [B[1], 0, 0, -B[5], B[5]] - sage: phi = X.module_morphism(lt, triangular="lower", codomain=Y, + sage: phi = X.module_morphism(lt, triangular='lower', codomain=Y, ....: inverse_on_support=lambda i: i-1 if i in [2,3,4] else None) sage: [phi.coreduced(v) for v in y] Traceback (most recent call last): @@ -1103,12 +1101,12 @@ def cokernel_basis_indices(self): sage: X = CombinatorialFreeModule(ZZ, [1,2,3]); x = X.basis() sage: Y = CombinatorialFreeModule(ZZ, [1,2,3,4,5]); y = Y.basis() sage: uut = lambda i: sum( y[j] for j in range(i+1,6) ) # uni-upper - sage: phi = X.module_morphism(uut, unitriangular="upper", codomain=Y, + sage: phi = X.module_morphism(uut, unitriangular='upper', codomain=Y, ....: inverse_on_support=lambda i: i-1 if i in [2,3,4] else None) sage: phi.cokernel_basis_indices() [1, 5] - sage: phi = X.module_morphism(uut, triangular="upper", codomain=Y, + sage: phi = X.module_morphism(uut, triangular='upper', codomain=Y, ....: inverse_on_support=lambda i: i-1 if i in [2,3,4] else None) sage: phi.cokernel_basis_indices() Traceback (most recent call last): @@ -1116,7 +1114,7 @@ def cokernel_basis_indices(self): NotImplementedError: cokernel_basis_indices for a triangular but not unitriangular morphism over a ring sage: Y = CombinatorialFreeModule(ZZ, NN); y = Y.basis() - sage: phi = X.module_morphism(uut, unitriangular="upper", codomain=Y, + sage: phi = X.module_morphism(uut, unitriangular='upper', codomain=Y, ....: inverse_on_support=lambda i: i-1 if i in [2,3,4] else None) sage: phi.cokernel_basis_indices() Traceback (most recent call last): @@ -1143,7 +1141,7 @@ def cokernel_projection(self, category=None): sage: X = CombinatorialFreeModule(QQ, [1,2,3]); x = X.basis() sage: Y = CombinatorialFreeModule(QQ, [1,2,3,4,5]); y = Y.basis() sage: lt = lambda i: sum( y[j] for j in range(i+1,6) ) # lower - sage: phi = X.module_morphism(lt, triangular="lower", codomain=Y, + sage: phi = X.module_morphism(lt, triangular='lower', codomain=Y, ....: inverse_on_support=lambda i: i-1 if i in [2,3,4] else None) sage: phipro = phi.cokernel_projection() sage: phipro(y[1] + y[2]) @@ -1263,7 +1261,7 @@ class ModuleMorphismFromMatrix(ModuleMorphismByLinearity): - ``matrix`` -- a matrix with base ring `R` and dimensions matching that of `F` and `G`, respectively - - ``side`` -- "left" or "right" (default: "left") + - ``side`` -- ``'left'`` or ``'right'`` (default: ``'left'``) If ``side`` is "left", this morphism is considered as acting on the left; i.e. each column of the matrix @@ -1274,8 +1272,8 @@ class ModuleMorphismFromMatrix(ModuleMorphismByLinearity): EXAMPLES:: - sage: X = CombinatorialFreeModule(ZZ, [1,2]); X.rename("X"); x = X.basis() - sage: Y = CombinatorialFreeModule(ZZ, [3,4]); Y.rename("Y"); y = Y.basis() + sage: X = CombinatorialFreeModule(ZZ, [1,2]); X.rename('X'); x = X.basis() + sage: Y = CombinatorialFreeModule(ZZ, [3,4]); Y.rename('Y'); y = Y.basis() sage: m = matrix([[1,2],[3,5]]) sage: phi = X.module_morphism(matrix=m, codomain=Y) sage: phi.parent() @@ -1288,7 +1286,7 @@ class ModuleMorphismFromMatrix(ModuleMorphismByLinearity): 2*B[3] + 5*B[4] sage: m = matrix([[1,2],[3,5]]) - sage: phi = X.module_morphism(matrix=m, codomain=Y, side="right", + sage: phi = X.module_morphism(matrix=m, codomain=Y, side='right', ....: category=Modules(ZZ).WithBasis()) sage: phi.parent() Set of Morphisms from X to Y @@ -1303,20 +1301,20 @@ class ModuleMorphismFromMatrix(ModuleMorphismByLinearity): Possibly implement rank, addition, multiplication, matrix, etc, from the stored matrix. """ - def __init__(self, domain, matrix, codomain=None, category=None, side="left"): + def __init__(self, domain, matrix, codomain=None, category=None, side='left'): r""" Initialize ``self``. TESTS:: sage: from sage.modules.with_basis.morphism import ModuleMorphismFromMatrix - sage: X = CombinatorialFreeModule(ZZ, [1,2]); X.rename("X"); x = X.basis() - sage: Y = CombinatorialFreeModule(ZZ, [3,4]); Y.rename("Y"); y = Y.basis() + sage: X = CombinatorialFreeModule(ZZ, [1,2]); X.rename('X'); x = X.basis() + sage: Y = CombinatorialFreeModule(ZZ, [3,4]); Y.rename('Y'); y = Y.basis() sage: m = matrix([[1,2],[3,5]]) - sage: phi = ModuleMorphismFromMatrix(matrix=m, domain=X, codomain=Y, side="right") + sage: phi = ModuleMorphismFromMatrix(matrix=m, domain=X, codomain=Y, side='right') sage: phi.__class__ - sage: phi.matrix(side="right") == m + sage: phi.matrix(side='right') == m True sage: TestSuite(phi).run(skip=["_test_pickling"]) @@ -1334,7 +1332,7 @@ def __init__(self, domain, matrix, codomain=None, category=None, side="left"): [1 2] [3 5] - sage: phi = ModuleMorphismFromMatrix(matrix=m, side="left", + sage: phi = ModuleMorphismFromMatrix(matrix=m, side='left', ....: domain=X, codomain=Y) sage: phi._matrix [1 3] @@ -1375,17 +1373,17 @@ def _richcmp_(self, other, op): TESTS:: sage: from sage.modules.with_basis.morphism import ModuleMorphismFromMatrix - sage: X = CombinatorialFreeModule(ZZ, [1,2]); X.rename("X"); x = X.basis() - sage: Y = CombinatorialFreeModule(ZZ, [3,4]); Y.rename("Y"); y = Y.basis() + sage: X = CombinatorialFreeModule(ZZ, [1,2]); X.rename('X'); x = X.basis() + sage: Y = CombinatorialFreeModule(ZZ, [3,4]); Y.rename('Y'); y = Y.basis() sage: m = matrix([[1,2],[3,5]]) - sage: phi = ModuleMorphismFromMatrix(matrix=m, domain=X, codomain=Y, side="right") - sage: phi2 = ModuleMorphismFromMatrix(matrix=m, domain=X, codomain=Y, side="right") + sage: phi = ModuleMorphismFromMatrix(matrix=m, domain=X, codomain=Y, side='right') + sage: phi2 = ModuleMorphismFromMatrix(matrix=m, domain=X, codomain=Y, side='right') sage: phi == phi2 True sage: phi is phi2 False sage: m2 = matrix([[1,2],[4,5]]) - sage: phi2 = ModuleMorphismFromMatrix(matrix=m2, domain=X, codomain=Y, side="right") + sage: phi2 = ModuleMorphismFromMatrix(matrix=m2, domain=X, codomain=Y, side='right') sage: phi == phi2 False """ @@ -1433,7 +1431,7 @@ class DiagonalModuleMorphism(ModuleMorphismByLinearity): EXAMPLES:: - sage: X = CombinatorialFreeModule(QQ, [1, 2, 3]); X.rename("X") + sage: X = CombinatorialFreeModule(QQ, [1, 2, 3]); X.rename('X') sage: phi = X.module_morphism(diagonal=factorial, codomain=X) sage: x = X.basis() sage: phi(x[1]), phi(x[2]), phi(x[3]) @@ -1445,7 +1443,7 @@ def __init__(self, domain, diagonal, codomain=None, category=None): TESTS:: - sage: X = CombinatorialFreeModule(QQ, [1, 2, 3]); X.rename("X") + sage: X = CombinatorialFreeModule(QQ, [1, 2, 3]); X.rename('X') sage: phi = X.module_morphism(diagonal=factorial, codomain=X) sage: phi.__class__ @@ -1472,14 +1470,13 @@ def _richcmp_(self, other, op): TESTS:: - sage: X = CombinatorialFreeModule(QQ, [1, 2, 3]); X.rename("X") + sage: X = CombinatorialFreeModule(QQ, [1, 2, 3]); X.rename('X') sage: phi = X.module_morphism(diagonal=factorial, codomain=X) sage: psi = X.module_morphism(diagonal=factorial, codomain=X) sage: phi == psi True sage: phi is psi False - """ if op == op_EQ: return (self.__class__ is other.__class__ @@ -1494,8 +1491,8 @@ def _on_basis(self, i): TESTS:: - sage: X = CombinatorialFreeModule(QQ, [1, 2, 3]); X.rename("X"); x = X.basis() - sage: Y = CombinatorialFreeModule(QQ, [1, 2, 3]); Y.rename("Y"); y = Y.basis() + sage: X = CombinatorialFreeModule(QQ, [1, 2, 3]); X.rename('X'); x = X.basis() + sage: Y = CombinatorialFreeModule(QQ, [1, 2, 3]); Y.rename('Y'); y = Y.basis() sage: phi = X.module_morphism(diagonal=factorial, codomain=X) sage: phi._on_basis(3) 6*B[3] @@ -1508,8 +1505,8 @@ def __invert__(self): EXAMPLES:: - sage: X = CombinatorialFreeModule(QQ, [1, 2, 3]); X.rename("X"); x = X.basis() - sage: Y = CombinatorialFreeModule(QQ, [1, 2, 3]); Y.rename("Y"); y = Y.basis() + sage: X = CombinatorialFreeModule(QQ, [1, 2, 3]); X.rename('X'); x = X.basis() + sage: Y = CombinatorialFreeModule(QQ, [1, 2, 3]); Y.rename('Y'); y = Y.basis() sage: phi = X.module_morphism(diagonal=factorial, codomain=X) sage: phi_inv = ~phi sage: phi_inv diff --git a/src/sage/modules/with_basis/representation.py b/src/sage/modules/with_basis/representation.py index b7d09675a05..893029505ed 100644 --- a/src/sage/modules/with_basis/representation.py +++ b/src/sage/modules/with_basis/representation.py @@ -34,8 +34,8 @@ class Representation_abstract: INPUT: - ``semigroup`` -- a semigroup - - ``side`` -- (default: ``"left"``) whether this is a - ``"left"`` or ``"right"`` representation + - ``side`` -- (default: ``'left'``) whether this is a + ``'left'`` or ``'right'`` representation - ``algebra`` -- (default: ``semigroup.algebra(self.base_ring())``) the semigroup algebra @@ -125,9 +125,7 @@ def side(self): """ Return whether ``self`` is a left, right, or two-sided representation. - OUTPUT: - - - the string ``"left"``, ``"right"``, or ``"twosided"`` + OUTPUT: the string ``'left'``, ``'right'``, or ``'twosided'`` EXAMPLES:: @@ -135,7 +133,7 @@ def side(self): sage: R = G.regular_representation() sage: R.side() 'left' - sage: S = G.regular_representation(side="right") + sage: S = G.regular_representation(side='right') sage: S.side() 'right' sage: R = G.sign_representation() @@ -171,9 +169,7 @@ def invariant_module(self, S=None, **kwargs): Two sided actions are considered as left actions for the invariant module. - OUTPUT: - - - :class:`~sage.modules.with_basis.invariant.FiniteDimensionalInvariantModule` + OUTPUT: :class:`~sage.modules.with_basis.invariant.FiniteDimensionalInvariantModule` EXAMPLES:: @@ -214,16 +210,14 @@ def twisted_invariant_module(self, chi, G=None, **kwargs): INPUT: - - ``chi`` -- a list/tuple of character values or an instance + - ``chi`` -- list/tuple of character values or an instance of :class:`~sage.groups.class_function.ClassFunction_gap` - ``G`` -- a finitely-generated semigroup (default: the semigroup this is a representation of) This also accepts the first argument to be the group. - OUTPUT: - - - :class:`~sage.modules.with_basis.invariant.FiniteDimensionalTwistedInvariantModule` + OUTPUT: :class:`~sage.modules.with_basis.invariant.FiniteDimensionalTwistedInvariantModule` EXAMPLES:: @@ -262,8 +256,8 @@ def representation_matrix(self, g, side=None, sparse=False): sage: S3 = SymmetricGroup(3) sage: g = S3.an_element(); g (2,3) - sage: L = S3.regular_representation(side="left") - sage: R = S3.regular_representation(side="right") + sage: L = S3.regular_representation(side='left') + sage: R = S3.regular_representation(side='right') sage: R.representation_matrix(g) [0 0 0 1 0 0] [0 0 0 0 0 1] @@ -431,7 +425,7 @@ def brauer_character(self): sage: T.brauer_character() (0, 0, 0) - sage: W = CoxeterGroup(['D', 4], implementation="permutation") + sage: W = CoxeterGroup(['D', 4], implementation='permutation') sage: R = W.reflection_representation(GF(2)) sage: R.brauer_character() (4, 1) @@ -676,7 +670,7 @@ def subrepresentation(self, gens, check=True, already_echelonized=False, - ``gens`` -- the generators of the submodule - ``check`` -- ignored - ``already_echelonized`` -- (default: ``False``) whether - the elements of ``gens`` are already in (not necessarily + the elements of ``gens`` are already in (not necessarily reduced) echelon form - ``is_closed`` -- (keyword only; default: ``False``) whether ``gens`` already spans the subspace closed under the semigroup action @@ -841,10 +835,10 @@ def _composition_series_data(self): data = {i: lift(prev._basis[i]) for i in prev._basis.keys()} lift = prev.module_morphism(data.__getitem__, codomain=self, - triangular="lower", + triangular='lower', unitriangular=False, key=W._support_key, - inverse_on_support="compute") + inverse_on_support='compute') retract = lift.section() ret.append(ret[-1].subrepresentation([], is_closed=True)) @@ -960,7 +954,7 @@ def _acted_upon_(self, scalar, self_on_left=False): s2*s1*s2 + 2*s1*s2 + s2 + 3 sage: G = groups.misc.WeylGroup(['B',2], prefix='s') - sage: R = G.regular_representation(side="right") + sage: R = G.regular_representation(side='right') sage: s1,s2 = G.gens() sage: x = R.an_element(); x 2*s2*s1*s2 + s1*s2 + 3*s2 + 1 @@ -1052,8 +1046,8 @@ class Representation(Representation_abstract, CombinatorialFreeModule): ``g`` is an element of the semigroup and ``m`` is an element of the indexing set for the basis, and returns the result of ``g`` acting on ``m`` - - ``side`` -- (default: ``"left"``) whether this is a - ``"left"`` or ``"right"`` representation + - ``side`` -- (default: ``'left'``) whether this is a + ``'left'`` or ``'right'`` representation EXAMPLES: @@ -1098,7 +1092,7 @@ class Representation(Representation_abstract, CombinatorialFreeModule): - :wikipedia:`Group_representation` """ - def __init__(self, semigroup, module, on_basis, side="left", **kwargs): + def __init__(self, semigroup, module, on_basis, side='left', **kwargs): """ Initialize ``self``. @@ -1184,7 +1178,7 @@ def _test_representation(self, **options): sage: M = CombinatorialFreeModule(QQ, ['v']) sage: def on_basis(g, m): ....: return M.term(m, (-1)**g.length()) - sage: R = G.representation(M, on_basis, side="right") + sage: R = G.representation(M, on_basis, side='right') sage: R._test_representation(max_runs=500) """ from sage.misc.functional import sqrt @@ -1527,8 +1521,8 @@ def _semigroup_action(self, g, vec, vec_on_left): EXAMPLES:: sage: S3 = SymmetricGroup(3) - sage: L = S3.regular_representation(side="left") - sage: R = S3.regular_representation(side="right") + sage: L = S3.regular_representation(side='left') + sage: R = S3.regular_representation(side='right') sage: T = tensor([R, L]) sage: g = S3.an_element(); g (2,3) @@ -1564,14 +1558,14 @@ def __init__(self, rep, degree=None, category=None, **options): EXAMPLES:: sage: G = groups.matrix.GL(3, 2) - sage: R = G.regular_representation(side="right") + sage: R = G.regular_representation(side='right') sage: E2 = R.exterior_power(2) sage: E2.category() Category of finite dimensional modules with basis over Integer Ring sage: TestSuite(E2).run() sage: G = groups.matrix.GL(2, 3) - sage: L = G.regular_representation(side="left") + sage: L = G.regular_representation(side='left') sage: E48 = L.exterior_power(48) sage: TestSuite(E48).run() @@ -1732,7 +1726,7 @@ def _from_repr_to_ext(self, elt): EXAMPLES:: sage: G = groups.matrix.GL(2, 2) - sage: L = G.regular_representation(side="left") + sage: L = G.regular_representation(side='left') sage: E = L.exterior_power() sage: E._from_repr_to_ext(sum(i*b for i,b in enumerate(L.basis(), start=1))) e0 + 2*e1 + 3*e2 + 4*e3 + 5*e4 + 6*e5 @@ -1751,7 +1745,7 @@ def _semigroup_action(self, g, vec, vec_on_left): sage: DC3 = groups.permutation.DiCyclic(3) sage: g = DC3.an_element(); g (1,4,2,3)(5,6) - sage: R = DC3.regular_representation(side="right") + sage: R = DC3.regular_representation(side='right') sage: E2 = R.exterior_power(2) sage: vec = E2.an_element(); vec 2*()*(5,6,7) + 2*()*(5,7,6) + 3*()*(1,2)(3,4) @@ -1774,7 +1768,7 @@ def _action_on_basis(self, g, b, vec_on_left): sage: S3 = SymmetricGroup(3) sage: g = S3.an_element(); g (2,3) - sage: L = S3.regular_representation(side="left") + sage: L = S3.regular_representation(side='left') sage: E2 = L.exterior_power(2) sage: vec = E2.an_element(); vec 2*()*(1,3,2) + 2*()*(1,2,3) + 3*()*(2,3) @@ -1810,14 +1804,14 @@ def __init__(self, rep, degree=None, category=None, **options): EXAMPLES:: sage: G = groups.matrix.GL(3, 2) - sage: R = G.regular_representation(side="right") + sage: R = G.regular_representation(side='right') sage: E0 = R.exterior_power(0) sage: E0.category() Category of finite dimensional algebras with basis over Integer Ring sage: TestSuite(E0).run() sage: G = groups.matrix.GL(2, 3) - sage: L = G.regular_representation(side="left") + sage: L = G.regular_representation(side='left') sage: E = L.exterior_power() sage: E.category() Category of finite dimensional algebras with basis over Integer Ring @@ -1836,7 +1830,7 @@ def one_basis(self): EXAMPLES:: sage: S3 = SymmetricGroup(3) - sage: L = S3.regular_representation(side="left") + sage: L = S3.regular_representation(side='left') sage: E = L.exterior_power() sage: E.one_basis() 0 @@ -1853,7 +1847,7 @@ def product_on_basis(self, x, y): EXAMPLES:: sage: S3 = SymmetricGroup(3) - sage: L = S3.regular_representation(side="left") + sage: L = S3.regular_representation(side='left') sage: E = L.exterior_power() sage: B = list(E.basis()) sage: B[:7] @@ -1877,7 +1871,7 @@ def __init__(self, rep, degree, **options): EXAMPLES:: sage: G = groups.matrix.GL(3, 2) - sage: R = G.regular_representation(side="right") + sage: R = G.regular_representation(side='right') sage: S2 = R.symmetric_power(2) sage: TestSuite(S2).run() sage: S0 = R.symmetric_power(0) @@ -2063,7 +2057,7 @@ def _from_repr_to_sym(self, elt): EXAMPLES:: sage: G = groups.matrix.GL(2, 2) - sage: L = G.regular_representation(side="left") + sage: L = G.regular_representation(side='left') sage: S3L = L.symmetric_power(3) sage: S3L._from_repr_to_sym(sum(i*b for i,b in enumerate(L.basis(), start=1))) e0 + 2*e1 + 3*e2 + 4*e3 + 5*e4 + 6*e5 @@ -2081,7 +2075,7 @@ def _semigroup_action(self, g, vec, vec_on_left): sage: DC3 = groups.permutation.DiCyclic(3) sage: g = DC3.an_element(); g (1,4,2,3)(5,6) - sage: R = DC3.regular_representation(side="right") + sage: R = DC3.regular_representation(side='right') sage: S2L = R.symmetric_power(2) sage: vec = S2L.an_element(); vec 3*()*(5,7,6) + 2*()*(5,6,7) + 2*()^2 @@ -2104,7 +2098,7 @@ def _action_on_basis(self, g, b, vec_on_left): sage: S3 = SymmetricGroup(3) sage: g = S3.an_element(); g (2,3) - sage: L = S3.regular_representation(side="left") + sage: L = S3.regular_representation(side='left') sage: S2L = L.symmetric_power(2) sage: vec = S2L.an_element(); vec 3*()*(1,2,3) + 2*()*(1,3,2) + 2*()^2 @@ -2144,14 +2138,14 @@ class RegularRepresentation(Representation): - ``semigroup`` -- a semigroup - ``base_ring`` -- the base ring for the representation - - ``side`` -- (default: ``"left"``) whether this is a - ``"left"`` or ``"right"`` representation + - ``side`` -- (default: ``'left'``) whether this is a + ``'left'`` or ``'right'`` representation REFERENCES: - :wikipedia:`Regular_representation` """ - def __init__(self, semigroup, base_ring, side="left"): + def __init__(self, semigroup, base_ring, side='left'): """ Initialize ``self``. @@ -2178,7 +2172,7 @@ def _repr_(self): sage: G.regular_representation() Left Regular Representation of Dihedral group of order 8 as a permutation group over Integer Ring - sage: G.regular_representation(side="right") + sage: G.regular_representation(side='right') Right Regular Representation of Dihedral group of order 8 as a permutation group over Integer Ring """ @@ -2207,7 +2201,7 @@ def _right_on_basis(self, g, m): EXAMPLES:: sage: G = groups.permutation.Dihedral(4) - sage: R = G.regular_representation(side="right") + sage: R = G.regular_representation(side='right') sage: R._test_representation() # indirect doctest """ return self.monomial(m * g) diff --git a/src/sage/modules/with_basis/subquotient.py b/src/sage/modules/with_basis/subquotient.py index 48a235b4ab9..d914ba88f0c 100644 --- a/src/sage/modules/with_basis/subquotient.py +++ b/src/sage/modules/with_basis/subquotient.py @@ -89,7 +89,7 @@ def __init__(self, submodule, category, *args, **opts): TESTS:: sage: from sage.modules.with_basis.subquotient import QuotientModuleWithBasis - sage: X = CombinatorialFreeModule(QQ, range(3), prefix="x"); x = X.basis() + sage: X = CombinatorialFreeModule(QQ, range(3), prefix='x'); x = X.basis() sage: I = X.submodule( (x[0]-x[1], x[1]-x[2]) ) sage: Y = QuotientModuleWithBasis(I) sage: Y.print_options(prefix='y') @@ -115,7 +115,7 @@ def ambient(self): EXAMPLES:: - sage: X = CombinatorialFreeModule(QQ, range(3), prefix="x"); x = X.basis() + sage: X = CombinatorialFreeModule(QQ, range(3), prefix='x'); x = X.basis() sage: Y = X.quotient_module((x[0]-x[1], x[1]-x[2])) sage: Y.ambient() is X True @@ -132,7 +132,7 @@ def lift(self, x): EXAMPLES:: - sage: X = CombinatorialFreeModule(QQ, range(3), prefix="x"); x = X.basis() + sage: X = CombinatorialFreeModule(QQ, range(3), prefix='x'); x = X.basis() sage: Y = X.quotient_module((x[0]-x[1], x[1]-x[2])); y = Y.basis() sage: Y.lift(y[2]) x[2] @@ -150,7 +150,7 @@ def retract(self, x): EXAMPLES:: - sage: X = CombinatorialFreeModule(QQ, range(3), prefix="x"); x = X.basis() + sage: X = CombinatorialFreeModule(QQ, range(3), prefix='x'); x = X.basis() sage: Y = X.quotient_module((x[0]-x[1], x[1]-x[2])); y = Y.basis() sage: Y.print_options(prefix='y') sage: Y.retract(x[0]) @@ -231,7 +231,7 @@ def __init__(self, basis, support_order, ambient, unitriangular, category, TESTS:: sage: from sage.modules.with_basis.subquotient import SubmoduleWithBasis - sage: X = CombinatorialFreeModule(QQ, range(3), prefix="x"); x = X.basis() + sage: X = CombinatorialFreeModule(QQ, range(3), prefix='x'); x = X.basis() sage: ybas = (x[0]-x[1], x[1]-x[2]) sage: Y = SubmoduleWithBasis(ybas, [0, 1, 2], X) sage: Y.print_options(prefix='y') @@ -287,7 +287,7 @@ def lift(self): EXAMPLES:: - sage: X = CombinatorialFreeModule(QQ, range(3), prefix="x"); x = X.basis() + sage: X = CombinatorialFreeModule(QQ, range(3), prefix='x'); x = X.basis() sage: Y = X.submodule((x[0]-x[1], x[1]-x[2]), already_echelonized=True); y = Y.basis() sage: Y.lift Generic morphism: @@ -300,10 +300,10 @@ def lift(self): """ return self.module_morphism(self.lift_on_basis, codomain=self._ambient, - triangular="lower", + triangular='lower', unitriangular=self._unitriangular, key=self._support_key, - inverse_on_support="compute") + inverse_on_support='compute') @lazy_attribute def reduce(self): @@ -315,7 +315,7 @@ def reduce(self): EXAMPLES:: - sage: X = CombinatorialFreeModule(QQ, range(3), prefix="x"); x = X.basis() + sage: X = CombinatorialFreeModule(QQ, range(3), prefix='x'); x = X.basis() sage: Y = X.submodule((x[0]-x[1], x[1]-x[2]), already_echelonized=True) sage: Y.reduce Generic endomorphism of Free module generated by {0, 1, 2} over Rational Field @@ -338,7 +338,7 @@ def retract(self): EXAMPLES:: - sage: X = CombinatorialFreeModule(QQ, range(3), prefix="x"); x = X.basis() + sage: X = CombinatorialFreeModule(QQ, range(3), prefix='x'); x = X.basis() sage: Y = X.submodule((x[0]-x[1], x[1]-x[2]), already_echelonized=True) sage: Y.print_options(prefix='y') sage: Y.retract @@ -661,7 +661,7 @@ def subspace(self, gens, *args, **opts): INPUT: - - ``gens`` -- a list or family of elements of ``self`` + - ``gens`` -- list or family of elements of ``self`` For additional optional arguments, see :meth:`ModulesWithBasis.ParentMethods.submodule`. diff --git a/src/sage/monoids/automatic_semigroup.py b/src/sage/monoids/automatic_semigroup.py index 4f351d372ef..5e3da3472f4 100644 --- a/src/sage/monoids/automatic_semigroup.py +++ b/src/sage/monoids/automatic_semigroup.py @@ -117,7 +117,7 @@ class AutomaticSemigroup(UniqueRepresentation, Parent): [1, 3, 5, 9] sage: # needs sage.graphs - sage: G = M.cayley_graph(side="twosided"); G + sage: G = M.cayley_graph(side='twosided'); G Looped multi-digraph on 4 vertices sage: G.edges(sort=True, key=str) [([1, 1], [1, 1], (2, 'left')), @@ -184,8 +184,8 @@ class AutomaticSemigroup(UniqueRepresentation, Parent): Let us construct and play with the 0-Hecke Monoid:: sage: # needs sage.graphs sage.modules - sage: W = WeylGroup(['A',4]); W.rename("W") - sage: ambient_monoid = FiniteSetMaps(W, action="right") + sage: W = WeylGroup(['A',4]); W.rename('W') + sage: ambient_monoid = FiniteSetMaps(W, action='right') sage: pi = W.simple_projections(length_increasing=True).map(ambient_monoid) sage: M = AutomaticSemigroup(pi, one=ambient_monoid.one()); M A submonoid of (Maps from W to itself) with 4 generators @@ -351,7 +351,7 @@ def __classcall_private__(cls, generators, ambient=None, one=None, mul=operator. def __init__(self, generators, ambient, one, mul, category): """ - Initializes this semigroup. + Initialize this semigroup. TESTS:: @@ -409,7 +409,7 @@ def _repr_(self): sage: AutomaticSemigroup(Family({1: R(3), 2: R(5)}), mul=operator.add, one=R.zero()) A semigroup with 2 generators - sage: S5 = SymmetricGroup(5); S5.rename("S5") # needs sage.groups + sage: S5 = SymmetricGroup(5); S5.rename('S5') # needs sage.groups sage: AutomaticSemigroup(Family({1: S5((1,2))}), # needs sage.groups ....: category=Groups().Finite().Subobjects()) A subgroup of (S5) with 1 generators @@ -419,7 +419,7 @@ def _repr_(self): if self in category: typ = "A " + category._repr_object_names()[:-1] for category in [Groups(), Monoids(), Semigroups()]: - if self.ambient() in category and self in category.Subobjects(): + if self.ambient() in category and ``self`` in category.Subobjects(): typ = "A sub" + category._repr_object_names()[:-1] break if self._mul is operator.mul: @@ -429,9 +429,9 @@ def _repr_(self): return f"{typ}{of} with {len(self._generators)} generators" - def repr_element_method(self, style="ambient"): + def repr_element_method(self, style='ambient'): """ - Sets the representation of the elements of the monoid. + Set the representation of the elements of the monoid. INPUT: @@ -501,7 +501,7 @@ def retract(self, ambient_element, check=True): sage: # needs sage.groups sage: from sage.monoids.automatic_semigroup import AutomaticSemigroup - sage: S5 = SymmetricGroup(5); S5.rename("S5") + sage: S5 = SymmetricGroup(5); S5.rename('S5') sage: M = AutomaticSemigroup(Family({1:S5((1,2)), 2:S5((1,2,3,4))}), ....: one=S5.one()) sage: m = M.retract(S5((3,1))); m @@ -773,7 +773,7 @@ def from_reduced_word(self, l): INPUT: - - ``l`` -- a list of indices of the generators + - ``l`` -- list of indices of the generators .. NOTE:: @@ -804,9 +804,9 @@ def construct(self, up_to=None, n=None): INPUT: - - ``up_to`` -- an element of ``self`` or of the ambient semigroup. + - ``up_to`` -- an element of ``self`` or of the ambient semigroup - - ``n`` -- an integer or ``None`` (default: ``None``) + - ``n`` -- integer or ``None`` (default: ``None``) This construct all the elements of this semigroup, their reduced words, and the right Cayley graph. If `n` is @@ -818,8 +818,8 @@ def construct(self, up_to=None, n=None): sage: # needs sage.groups sage.modules sage: from sage.monoids.automatic_semigroup import AutomaticSemigroup - sage: W = WeylGroup(['A',3]); W.rename("W") - sage: ambient_monoid = FiniteSetMaps(W, action="right") + sage: W = WeylGroup(['A',3]); W.rename('W') + sage: ambient_monoid = FiniteSetMaps(W, action='right') sage: pi = W.simple_projections(length_increasing=True).map(ambient_monoid) sage: M = AutomaticSemigroup(pi, one=ambient_monoid.one()); M A submonoid of (Maps from W to itself) with 3 generators @@ -876,7 +876,7 @@ def reduced_word(self): r""" Return the length-lexicographic shortest word of ``self``. - OUTPUT: a list of indexes of the generators + OUTPUT: list of indexes of the generators Obtaining the reduced word requires having constructed the Cayley graph of the semigroup up to ``self``. If this is diff --git a/src/sage/monoids/free_abelian_monoid.py b/src/sage/monoids/free_abelian_monoid.py index 13f26e9df69..907414e4291 100644 --- a/src/sage/monoids/free_abelian_monoid.py +++ b/src/sage/monoids/free_abelian_monoid.py @@ -71,11 +71,9 @@ class FreeAbelianMonoidFactory(UniqueFactory): INPUT: + - ``n`` -- integer - - ``n`` -- integer - - - ``names`` -- names of generators - + - ``names`` -- names of generators OUTPUT: free abelian monoid @@ -126,7 +124,7 @@ def FreeAbelianMonoid(index_set=None, names=None, **kwds): - ``index_set`` -- an indexing set for the generators; if an integer, then this becomes `\{0, 1, \ldots, n-1\}` - - ``names`` -- names of generators + - ``names`` -- names of generators OUTPUT: a free abelian monoid @@ -161,7 +159,7 @@ def FreeAbelianMonoid(index_set=None, names=None, **kwds): def is_FreeAbelianMonoid(x): """ - Return True if `x` is a free abelian monoid. + Return ``True`` if `x` is a free abelian monoid. EXAMPLES:: @@ -229,7 +227,7 @@ def __call__(self, x): def __contains__(self, x): """ - Return True if `x` is an element of this abelian monoid. + Return ``True`` if `x` is an element of this abelian monoid. EXAMPLES:: diff --git a/src/sage/monoids/free_abelian_monoid_element.pyx b/src/sage/monoids/free_abelian_monoid_element.pyx index 9f66e83942d..1cd087584cf 100644 --- a/src/sage/monoids/free_abelian_monoid_element.pyx +++ b/src/sage/monoids/free_abelian_monoid_element.pyx @@ -47,7 +47,7 @@ def is_FreeAbelianMonoidElement(x): INPUT: - - ``x`` -- an object. + - ``x`` -- an object OUTPUT: diff --git a/src/sage/monoids/free_monoid.py b/src/sage/monoids/free_monoid.py index 4b194297641..9e8553184d1 100644 --- a/src/sage/monoids/free_monoid.py +++ b/src/sage/monoids/free_monoid.py @@ -85,7 +85,7 @@ class FreeMonoid(Monoid_class, UniqueRepresentation): - ``names`` -- names of generators - - ``commutative`` -- (default: ``False``) whether the free + - ``commutative`` -- boolean (default: ``False``); whether the free monoid is commutative or not OUTPUT: a free monoid diff --git a/src/sage/monoids/free_monoid_element.py b/src/sage/monoids/free_monoid_element.py index 993fef9c72d..abcb08bc049 100644 --- a/src/sage/monoids/free_monoid_element.py +++ b/src/sage/monoids/free_monoid_element.py @@ -134,7 +134,7 @@ def _repr_(self): def _latex_(self) -> str: r""" - Return latex representation of self. + Return latex representation of ``self``. EXAMPLES:: diff --git a/src/sage/monoids/hecke_monoid.py b/src/sage/monoids/hecke_monoid.py index b76867d6e0d..bc25f9769a7 100644 --- a/src/sage/monoids/hecke_monoid.py +++ b/src/sage/monoids/hecke_monoid.py @@ -19,7 +19,7 @@ def HeckeMonoid(W): INPUT: - - `W` -- a finite Coxeter group + - ``W`` -- a finite Coxeter group Let `s_1,\ldots,s_n` be the simple reflections of `W`. The 0-Hecke monoid is the monoid generated by projections `\pi_1,\ldots,\pi_n` @@ -57,7 +57,7 @@ def HeckeMonoid(W): sage: H.cardinality() 24 """ - ambient_monoid = FiniteSetMaps(W, action="right") + ambient_monoid = FiniteSetMaps(W, action='right') pi = W.simple_projections(length_increasing=True).map(ambient_monoid) H = ambient_monoid.submonoid(pi) H.rename("0-Hecke monoid of the %s" % W) diff --git a/src/sage/monoids/indexed_free_monoid.py b/src/sage/monoids/indexed_free_monoid.py index 66af0a2fb5c..798ce6508a4 100644 --- a/src/sage/monoids/indexed_free_monoid.py +++ b/src/sage/monoids/indexed_free_monoid.py @@ -205,7 +205,7 @@ def __iter__(self): def _richcmp_(self, other, op): r""" - Comparisons + Comparisons. TESTS:: @@ -271,7 +271,7 @@ def _richcmp_(self, other, op): def support(self): """ Return a list of the objects indexing ``self`` with - non-zero exponents. + nonzero exponents. EXAMPLES:: diff --git a/src/sage/monoids/string_monoid.py b/src/sage/monoids/string_monoid.py index 7aa51ad9776..64592388b4d 100644 --- a/src/sage/monoids/string_monoid.py +++ b/src/sage/monoids/string_monoid.py @@ -35,10 +35,10 @@ def __init__(self, n, alphabet=()): INPUT: - - ``n`` -- Integer + - ``n`` -- integer - - ``alphabet`` -- String or tuple whose characters or elements denote - the generators. + - ``alphabet`` -- string or tuple whose characters or elements denote + the generators EXAMPLES:: @@ -596,7 +596,7 @@ def __call__(self, x, check=True): else: raise TypeError("Argument x (= %s) is of the wrong type." % x) - def characteristic_frequency(self, table_name="beker_piper"): + def characteristic_frequency(self, table_name='beker_piper'): r""" Return a table of the characteristic frequency probability distribution of the English alphabet. In written English, various @@ -630,15 +630,15 @@ def characteristic_frequency(self, table_name="beker_piper"): INPUT: - - ``table_name`` -- (default ``"beker_piper"``) the table of + - ``table_name`` -- (default: ``'beker_piper'``) the table of characteristic frequency probability distribution to use. The following tables are supported: - - ``"beker_piper"`` -- the table of characteristic frequency + - ``'beker_piper'`` -- the table of characteristic frequency probability distribution by Beker and Piper [BP1982]_. This is the default table to use. - - ``"lewand"`` -- the table of characteristic frequency + - ``'lewand'`` -- the table of characteristic frequency probability distribution by Lewand as described on page 36 of [Lew2000]_. @@ -654,7 +654,7 @@ def characteristic_frequency(self, table_name="beker_piper"): Beker and Piper [BP1982]_:: sage: A = AlphabeticStrings() - sage: table = A.characteristic_frequency(table_name="beker_piper") + sage: table = A.characteristic_frequency(table_name='beker_piper') sage: sorted(table.items()) [('A', 0.0820000000000000), @@ -687,7 +687,7 @@ def characteristic_frequency(self, table_name="beker_piper"): The characteristic frequency probability distribution table of Lewand [Lew2000]_:: - sage: table = A.characteristic_frequency(table_name="lewand") + sage: table = A.characteristic_frequency(table_name='lewand') sage: sorted(table.items()) [('A', 0.0816700000000000), @@ -767,7 +767,7 @@ def characteristic_frequency(self, table_name="beker_piper"): Traceback (most recent call last): ... ValueError: Table name must be either 'beker_piper' or 'lewand'. - sage: table = A.characteristic_frequency(table_name="none") + sage: table = A.characteristic_frequency(table_name='none') Traceback (most recent call last): ... ValueError: Table name must be either 'beker_piper' or 'lewand'. diff --git a/src/sage/monoids/string_monoid_element.py b/src/sage/monoids/string_monoid_element.py index 6a7719c9d7c..f91431824c3 100644 --- a/src/sage/monoids/string_monoid_element.py +++ b/src/sage/monoids/string_monoid_element.py @@ -30,46 +30,34 @@ def is_StringMonoidElement(x): - r""" - """ return isinstance(x, StringMonoidElement) def is_AlphabeticStringMonoidElement(x): - r""" - """ from .string_monoid import AlphabeticStringMonoid return isinstance(x, StringMonoidElement) and \ isinstance(x.parent(), AlphabeticStringMonoid) def is_BinaryStringMonoidElement(x): - r""" - """ from .string_monoid import BinaryStringMonoid return isinstance(x, StringMonoidElement) and \ isinstance(x.parent(), BinaryStringMonoid) def is_OctalStringMonoidElement(x): - r""" - """ from .string_monoid import OctalStringMonoid return isinstance(x, StringMonoidElement) and \ isinstance(x.parent(), OctalStringMonoid) def is_HexadecimalStringMonoidElement(x): - r""" - """ from .string_monoid import HexadecimalStringMonoid return isinstance(x, StringMonoidElement) and \ isinstance(x.parent(), HexadecimalStringMonoid) def is_Radix64StringMonoidElement(x): - r""" - """ from .string_monoid import Radix64StringMonoid return isinstance(x, StringMonoidElement) and \ isinstance(x.parent(), Radix64StringMonoid) @@ -140,7 +128,7 @@ def _repr_(self): def _latex_(self): """ - Return latex representation of self. + Return latex representation of ``self``. EXAMPLES:: @@ -191,12 +179,12 @@ def __pow__(self, n): sage: x**(-1) Traceback (most recent call last): ... - IndexError: Argument n (= -1) must be non-negative. + IndexError: Argument n (= -1) must be nonnegative. """ if not isinstance(n, (int, Integer)): raise TypeError("Argument n (= %s) must be an integer." % n) if n < 0: - raise IndexError("Argument n (= %s) must be non-negative." % n) + raise IndexError("Argument n (= %s) must be nonnegative." % n) elif n == 0: return self.parent()('') elif n == 1: @@ -444,7 +432,7 @@ def frequency_distribution(self, length=1, prec=0): INPUT: - - ``length`` -- (default ``1``) if ``length=1`` then consider the + - ``length`` -- (default: ``1``) if ``length=1`` then consider the probability space of monogram frequency, i.e. probability distribution of single characters. If ``length=2`` then consider the probability space of digram frequency, i.e. probability @@ -452,7 +440,7 @@ def frequency_distribution(self, length=1, prec=0): supports the generation of probability spaces for monogram frequency (``length=1``) and digram frequency (``length=2``). - - ``prec`` -- (default ``0``) a non-negative integer representing + - ``prec`` -- (default: ``0``) a nonnegative integer representing the precision (in number of bits) of a floating-point number. The default value ``prec=0`` means that we use 53 bits to represent the mantissa of a floating-point number. For more information on diff --git a/src/sage/monoids/trace_monoid.py b/src/sage/monoids/trace_monoid.py index 56f8759aa83..6b72feca4b5 100644 --- a/src/sage/monoids/trace_monoid.py +++ b/src/sage/monoids/trace_monoid.py @@ -182,7 +182,7 @@ def _flat_elements(self): r""" Return flatten list of generator numbers representing the trace. - OUTPUT: a list of generator indexes + OUTPUT: list of generator indexes TESTS:: @@ -229,7 +229,7 @@ def dependence_graph(self): return DiGraph(graph) @cached_method - def hasse_diagram(self, algorithm="naive"): + def hasse_diagram(self, algorithm='naive'): r""" Return Hasse diagram of the trace. @@ -766,9 +766,7 @@ def dependence(self): r""" Return dependence relation over the monoid. - OUTPUT: - - Set of non-commuting generator pairs. + OUTPUT: set of non-commuting generator pairs EXAMPLES:: @@ -797,7 +795,7 @@ def dependence_graph(self): """ return Graph({frozenset((e1, e2)) if e1 != e2 else (e1, e2) for e1, e2 in self.dependence()}, loops=True, - format="list_of_edges", + format='list_of_edges', immutable=True) @cached_method diff --git a/src/sage/parallel/decorate.py b/src/sage/parallel/decorate.py index b8ea5e75bb3..05f668f4348 100644 --- a/src/sage/parallel/decorate.py +++ b/src/sage/parallel/decorate.py @@ -99,9 +99,7 @@ def __call__(self, f): - ``f`` -- Python callable object or function - OUTPUT: - - - Decorated version of ``f`` + OUTPUT: decorated version of ``f`` EXAMPLES:: @@ -137,10 +135,9 @@ def __init__(self, parallel, func): INPUT: - ``parallel`` -- a :class:`Parallel` object which controls - how the parallel execution will be done. + how the parallel execution will be done - ``func`` -- Python callable object or function - """ self.parallel = parallel self.func = func @@ -228,7 +225,7 @@ def __get__(self, instance, owner): def _sage_argspec_(self): """ - Returns the argument specification for this object, which is + Return the argument specification for this object, which is just the argument specification for the underlying function. See :mod:`sage.misc.sageinspect` for more information on this convention. @@ -249,7 +246,7 @@ def _sage_argspec_(self): def _sage_src_(self): """ - Returns the source code for this object, which is just the + Return the source code for this object, which is just the source code for the underlying function. See :mod:`sage.misc.sageinspect` for more information on this convention. @@ -269,7 +266,7 @@ def _sage_src_(self): def _instancedoc_(self): r""" - Returns the docstring for this object, which is just the + Return the docstring for this object, which is just the docstring for the underlying function. See :mod:`sage.misc.sageinspect` for more information on this convention. @@ -304,13 +301,13 @@ def parallel(p_iter='fork', ncpus=None, **kwds): INPUT: - - ``p_iter`` -- parallel iterator function or string: - - ``'fork'`` -- (default) use a new forked subprocess for each input - - ``'multiprocessing'`` -- use multiprocessing library - - ``'reference'`` -- use a fake serial reference implementation - - ``ncpus`` -- integer, maximal number of subprocesses to use at the same time - - ``timeout`` -- number of seconds until each subprocess is killed (only supported - by 'fork'; zero means not at all) + - ``p_iter`` -- parallel iterator function or string: + - ``'fork'`` -- (default) use a new forked subprocess for each input + - ``'multiprocessing'`` -- use multiprocessing library + - ``'reference'`` -- use a fake serial reference implementation + - ``ncpus`` -- integer; maximal number of subprocesses to use at the same time + - ``timeout`` -- number of seconds until each subprocess is killed (only supported + by ``'fork'``; zero means not at all) .. warning:: @@ -318,7 +315,6 @@ def parallel(p_iter='fork', ncpus=None, **kwds): subprocess is spawned, so none of your local state (variables, certain functions, etc.) is available. - EXAMPLES: We create a simple decoration for a simple function. The number @@ -436,7 +432,7 @@ def __init__(self, timeout=0, verbose=False): - ``timeout`` -- (default: 0) kill the subprocess after it has run this many seconds (wall time), or if ``timeout`` is zero, do not kill it. - - ``verbose`` -- (default: ``False``) whether to print anything about + - ``verbose`` -- boolean (default: ``False``); whether to print anything about what the decorator does (e.g., killing the subprocess) EXAMPLES:: @@ -455,9 +451,7 @@ def __call__(self, f): - ``f`` -- a function - OUTPUT: - - - A decorated function. + OUTPUT: a decorated function EXAMPLES:: @@ -488,7 +482,7 @@ def fork(f=None, timeout=0, verbose=False): - ``f`` -- a function - ``timeout`` -- (default: 0) if positive, kill the subprocess after this many seconds (wall time) - - ``verbose`` -- (default: ``False``) whether to print anything + - ``verbose`` -- boolean (default: ``False``); whether to print anything about what the decorator does (e.g., killing the subprocess) .. warning:: diff --git a/src/sage/parallel/map_reduce.py b/src/sage/parallel/map_reduce.py index 9a61d3b9116..a7de8f363c7 100644 --- a/src/sage/parallel/map_reduce.py +++ b/src/sage/parallel/map_reduce.py @@ -293,7 +293,7 @@ should be a prefix (including a possible directory) for the profile dump:: sage: import tempfile - sage: d = tempfile.TemporaryDirectory(prefix="RESetMR_profile") + sage: d = tempfile.TemporaryDirectory(prefix='RESetMR_profile') sage: res = S.run(profile=d.name) # random [RESetMapReduceWorker-1:58] (20:00:41.444) Profiling in /home/user/.sage/temp/.../32414/RESetMR_profilewRCRAx/profcomp1 @@ -393,16 +393,16 @@ map-reduce protocol: - ``_results`` -- a :class:`~multiprocessing.queues.SimpleQueue` where - the master gathers the results sent by the workers. + the master gathers the results sent by the workers - ``_active_tasks`` -- a :class:`~multiprocessing.Semaphore` recording - the number of active tasks. The work is complete when it reaches 0. + the number of active tasks; the work is complete when it reaches 0 - ``_done`` -- a :class:`~multiprocessing.Lock` which ensures that - shutdown is done only once. + shutdown is done only once - ``_aborted`` -- a :func:`~multiprocessing.Value` storing a shared :class:`ctypes.c_bool` which is ``True`` if the computation was aborted - before all workers ran out of work. -- ``_workers`` -- a list of :class:`RESetMapReduceWorker` objects. - Each worker is identified by its position in this list. + before all workers ran out of work +- ``_workers`` -- list of :class:`RESetMapReduceWorker` objects + Each worker is identified by its position in this list Each **worker** is a process (:class:`RESetMapReduceWorker` inherits from :class:`~multiprocessing.Process`) which contains: @@ -413,11 +413,11 @@ worker. It is used as a stack by the worker. Thiefs steal from the bottom of this queue. - ``worker._request`` -- a :class:`~multiprocessing.queues.SimpleQueue` storing - steal request submitted to ``worker``. + steal request submitted to ``worker`` - ``worker._read_task``, ``worker._write_task`` -- a - :class:`~multiprocessing.queues.Pipe` used to transfer node during steal. + :class:`~multiprocessing.queues.Pipe` used to transfer node during steal - ``worker._thief`` -- a :class:`~threading.Thread` which is in charge of - stealing from ``worker._todo``. + stealing from ``worker._todo`` Here is a schematic of the architecture: @@ -515,7 +515,7 @@ - :class:`RESetMPExample` -- a simple basic example - :class:`RESetParallelIterator` -- a more advanced example using non standard - communication configuration. + communication configuration Tests ----- @@ -591,8 +591,7 @@ def proc_number(max_proc=None): INPUT: - - ``max_proc`` -- an upper bound on the number of processes or - ``None``. + - ``max_proc`` -- an upper bound on the number of processes or ``None`` EXAMPLES:: @@ -644,7 +643,7 @@ def __init__(self, task_number): sage: from sage.parallel.map_reduce import ActiveTaskCounterDarwin as ATC sage: t = ATC(4) - sage: TestSuite(t).run(skip="_test_pickling", verbose=True) + sage: TestSuite(t).run(skip='_test_pickling', verbose=True) running ._test_new() . . . pass """ self._active_tasks = mp.Value(ctypes.c_int, task_number) @@ -778,7 +777,7 @@ def __init__(self, task_number): sage: from sage.parallel.map_reduce import ActiveTaskCounter as ATC sage: t = ATC(4) - sage: TestSuite(t).run(skip="_test_pickling", verbose=True) + sage: TestSuite(t).run(skip='_test_pickling', verbose=True) running ._test_new() . . . pass """ self._active_tasks = mp.Semaphore(task_number) @@ -897,7 +896,7 @@ class RESetMapReduce(): - or a triple ``roots, children, post_process`` as follows - - ``roots=r`` -- The root of the enumeration + - ``roots=r`` -- the root of the enumeration - ``children=c`` -- a function iterating through children nodes, given a parent node - ``post_process=p`` -- a post-processing function @@ -908,9 +907,9 @@ class RESetMapReduce(): Description of the map/reduce operation: - - ``map_function=f`` -- (default to ``None``) - - ``reduce_function=red`` -- (default to ``None``) - - ``reduce_init=init`` -- (default to ``None``) + - ``map_function=f`` -- (default: ``None``) + - ``reduce_function=red`` -- (default: ``None``) + - ``reduce_init=init`` -- (default: ``None``) .. SEEALSO:: @@ -1097,8 +1096,8 @@ def setup_workers(self, max_proc=None, reduce_locally=True): INPUT: - - ``max_proc`` -- (integer) an upper bound on the number of - worker processes. + - ``max_proc`` -- integer; an upper bound on the number of + worker processes - ``reduce_locally`` -- whether the workers should reduce locally their work or sends results to the master as soon as possible. @@ -1425,7 +1424,7 @@ def run(self, maximum number of worker processors to use. The actual number is also bounded by the value of the environment variable ``SAGE_NUM_THREADS`` (the number of cores by default). - - ``reduce_locally`` -- See :class:`RESetMapReduceWorker` (default: ``True``) + - ``reduce_locally`` -- see :class:`RESetMapReduceWorker` (default: ``True``) - ``timeout`` -- a timeout on the computation (default: ``None``) - ``profile`` -- directory/filename prefix for profiling, or ``None`` for no profiling (default: ``None``) @@ -1562,9 +1561,9 @@ class RESetMapReduceWorker(mp.Process): INPUT: - ``mapred`` -- the instance of :class:`RESetMapReduce` for which - this process is working. + this process is working - - ``iproc`` -- the id of this worker. + - ``iproc`` -- the id of this worker - ``reduce_locally`` -- when reducing the results. Three possible values are supported: @@ -1649,7 +1648,7 @@ def steal(self): sage: # known bug (Issue #27537) sage: w0, w1 = EX._workers sage: w0._todo.append(42) - sage: thief0 = Thread(target = w0._thief, name="Thief") + sage: thief0 = Thread(target = w0._thief, name='Thief') sage: thief0.start() sage: w1.steal() 42 @@ -1743,7 +1742,7 @@ def run_myself(self): self._stats[0] = 0 self._stats[3] = 0 logger.debug("Launching thief") - self._thief = Thread(target=self._thief, name="Thief") + self._thief = Thread(target=self._thief, name='Thief') self._thief.start() self._res = reduce_init() @@ -1800,7 +1799,7 @@ def walk_branch_locally(self, node): INPUT: - - ``node`` -- the root of the subtree explored. + - ``node`` -- the root of the subtree explored OUTPUT: nothing, the result are stored in ``self._res`` @@ -1855,7 +1854,7 @@ class RESetMPExample(RESetMapReduce): INPUT: - - ``maxl`` -- the maximum size of permutations generated (default to `9`). + - ``maxl`` -- the maximum size of permutations generated (default: `9`) This computes the generating series of permutations counted by their size up to size ``maxl``. @@ -1869,7 +1868,6 @@ class RESetMPExample(RESetMapReduce): + 24*x^4 + 6*x^3 + 2*x^2 + x + 1 .. SEEALSO:: This is an example of :class:`RESetMapReduce` - """ def __init__(self, maxl=9): r""" @@ -1903,7 +1901,7 @@ def children(self, l): INPUT: - - ``l`` -- a list containing a permutation + - ``l`` -- list containing a permutation OUTPUT: @@ -1924,7 +1922,7 @@ def map_function(self, l): INPUT: - - ``l`` -- a list containing a permutation + - ``l`` -- list containing a permutation OUTPUT: diff --git a/src/sage/parallel/multiprocessing_sage.py b/src/sage/parallel/multiprocessing_sage.py index 2ccab49ac0f..ab2ee3f95ee 100644 --- a/src/sage/parallel/multiprocessing_sage.py +++ b/src/sage/parallel/multiprocessing_sage.py @@ -25,11 +25,9 @@ def pyprocessing(processes=0): INPUT: - ``processes`` -- integer (default: 0); if 0, set to the number - of processors on the computer. + of processors on the computer - OUTPUT: - - - a (partially evaluated) function + OUTPUT: a (partially evaluated) function EXAMPLES:: @@ -55,9 +53,7 @@ def parallel_iter(processes, f, inputs): - ``f`` -- function - ``inputs`` -- an iterable of pairs (args, kwds) - OUTPUT: - - - iterator over values of ``f`` at ``args,kwds`` in some random order. + OUTPUT: iterator over values of ``f`` at ``args, kwds`` in some random order EXAMPLES:: diff --git a/src/sage/parallel/parallelism.py b/src/sage/parallel/parallelism.py index 010372467d9..6df09f58fad 100644 --- a/src/sage/parallel/parallelism.py +++ b/src/sage/parallel/parallelism.py @@ -82,7 +82,6 @@ class Parallelism(Singleton, SageObject): Switching off all parallelizations:: sage: Parallelism().set(nproc=1) - """ def __init__(self): r""" @@ -104,7 +103,6 @@ def __init__(self): The test suite is passed:: sage: TestSuite(par).run() - """ self._default = ncpus() # default number of proc. used in parallelizations @@ -121,7 +119,6 @@ def _repr_(self): sage: Parallelism()._repr_() 'Number of processes for parallelization:\n - linbox computations: 1\n - tensor computations: 1' - """ resu = "Number of processes for parallelization:\n" for field in sorted(self._nproc): @@ -164,7 +161,6 @@ def reset(self): - tensor computations: 1 sage: Parallelism().get_default() # random (depends on the computer) 8 - """ self._default = ncpus() for field in self._nproc: @@ -233,7 +229,6 @@ def set(self, field=None, nproc=None): Number of processes for parallelization: - linbox computations: 1 - tensor computations: 1 - """ if field is None: for fi in self._nproc: @@ -277,7 +272,6 @@ def get(self, field): sage: Parallelism().set('tensor', nproc=4) sage: Parallelism().get('tensor') 4 - """ if field not in self._nproc: raise KeyError("entry for field {} is not ".format(field) + @@ -305,7 +299,6 @@ def get_all(self): sage: Parallelism().set(nproc=4) sage: Parallelism().get_all() {'linbox': 4, 'tensor': 4} - """ return self._nproc @@ -339,7 +332,6 @@ def set_default(self, nproc=None): sage: Parallelism().set_default() sage: Parallelism().get_default() # random (depends on the computer) 8 - """ if nproc is None: self._default = ncpus() @@ -367,6 +359,5 @@ def get_default(self): sage: Parallelism().set_default(nproc=4) sage: Parallelism().get_default() 4 - """ return self._default diff --git a/src/sage/parallel/reference.py b/src/sage/parallel/reference.py index 36dd7a8bb76..6a855874330 100644 --- a/src/sage/parallel/reference.py +++ b/src/sage/parallel/reference.py @@ -16,15 +16,13 @@ def parallel_iter(f, inputs): INPUT: - ``f`` -- a Python function that can be pickled using - the pickle_function command. + the ``pickle_function`` command - - ``inputs`` -- a list of pickleable pairs (args, kwds), where - args is a tuple and kwds is a dictionary. + - ``inputs`` -- list of pickleable pairs (args, kwds), where + args is a tuple and kwds is a dictionary - OUTPUT: - - - iterator over 2-tuples ``(inputs[i], f(inputs[i]))``, where the - order may be completely random + OUTPUT: iterator over 2-tuples ``(inputs[i], f(inputs[i]))``, where the + order may be completely random EXAMPLES:: diff --git a/src/sage/parallel/use_fork.py b/src/sage/parallel/use_fork.py index 6cf67a3c44d..bab3487e354 100644 --- a/src/sage/parallel/use_fork.py +++ b/src/sage/parallel/use_fork.py @@ -27,11 +27,11 @@ class WorkerData(): This just stores three attributes: - - ``input``: the input value used by this worker + - ``input`` -- the input value used by this worker - - ``starttime``: the walltime when this worker started + - ``starttime`` -- the walltime when this worker started - - ``failure``: an optional message indicating the kind of failure + - ``failure`` -- an optional message indicating the kind of failure EXAMPLES:: @@ -61,15 +61,13 @@ class p_iter_fork(): INPUT: - - ``ncpus`` -- the maximal number of simultaneous - subprocesses to spawn - - ``timeout`` -- (float, default: 0) wall time in seconds until - a subprocess is automatically killed - - ``verbose`` -- (default: ``False``) whether to print - anything about what the iterator does (e.g., killing - subprocesses) - - ``reset_interfaces`` -- (default: ``True``) whether to reset - all pexpect interfaces + - ``ncpus`` -- the maximal number of simultaneous subprocesses to spawn + - ``timeout`` -- (float, default: 0) wall time in seconds until a + subprocess is automatically killed + - ``verbose`` -- boolean (default: ``False``); whether to print anything + about what the iterator does (e.g., killing subprocesses) + - ``reset_interfaces`` -- boolean (default: ``True``); whether to reset all + pexpect interfaces EXAMPLES:: @@ -114,9 +112,9 @@ def __call__(self, f, inputs): - ``f`` -- a function (or more general, any callable) - - ``inputs`` -- a list of pairs ``(args, kwds)`` to be used as + - ``inputs`` -- list of pairs ``(args, kwds)`` to be used as arguments to ``f``, where ``args`` is a tuple and ``kwds`` is - a dictionary. + a dictionary EXAMPLES:: @@ -261,7 +259,7 @@ def _subprocess(self, f, dir, args, kwds={}): - ``dir`` -- name of a directory - - ``args`` -- a tuple with positional arguments for ``f`` + - ``args`` -- tuple with positional arguments for ``f`` - ``kwds`` -- (optional) a dict with keyword arguments for ``f`` diff --git a/src/sage/probability/probability_distribution.pyx b/src/sage/probability/probability_distribution.pyx index e2c71af9c25..461bdb2fc60 100644 --- a/src/sage/probability/probability_distribution.pyx +++ b/src/sage/probability/probability_distribution.pyx @@ -101,7 +101,7 @@ cdef class ProbabilityDistribution: the probability distribution - ``bins`` -- (optional) number of bins to divide the samples - into. + into OUTPUT: @@ -152,13 +152,13 @@ cdef class ProbabilityDistribution: INPUT: - - ``name`` -- file to save the histogram plot (as a PNG). + - ``name`` -- file to save the histogram plot (as a PNG) - ``num_samples`` -- (optional) number of times to sample from the probability distribution - ``bins`` -- (optional) number of bins to divide the samples - into. + into EXAMPLES: @@ -566,7 +566,6 @@ cdef class RealDistribution(ProbabilityDistribution): sage: Xs = [RealDistribution('gaussian', 1).get_random_element() for _ in range(1000)] sage: len(set(Xs)) > 2^^32 True - """ cdef gsl_rng_type *T cdef gsl_rng *r @@ -682,7 +681,6 @@ cdef class RealDistribution(ProbabilityDistribution): sage: T = RealDistribution('gaussian', 1, seed=0) sage: T.get_random_element() # rel tol 4e-16 0.13391860811867587 - """ cdef double result if self.distribution_type == uniform: @@ -1035,19 +1033,17 @@ cdef class GeneralDiscreteDistribution(ProbabilityDistribution): INPUT: - - ``P`` -- list of probabilities. The list will automatically be - normalised if ``sum(P)`` is not equal to 1. + - ``P`` -- list of probabilities; the list will automatically be + normalised if ``sum(P)`` is not equal to 1 - - ``rng`` -- (optional) random number generator to use. May be - one of ``'default'``, ``'luxury'``, or ``'taus'``. + - ``rng`` -- (optional) random number generator to use; may be + one of ``'default'``, ``'luxury'``, or ``'taus'`` - ``seed`` -- (optional) seed to use with the random number - generator. - - OUTPUT: + generator - - a probability distribution where the probability of selecting - ``x`` is ``P[x]``. + OUTPUT: a probability distribution where the probability of selecting + ``x`` is ``P[x]``. EXAMPLES: @@ -1090,12 +1086,12 @@ cdef class GeneralDiscreteDistribution(ProbabilityDistribution): sage: len(set(Xs)) > 2^^32 True - The distribution probabilities must be non-negative:: + The distribution probabilities must be nonnegative:: sage: GeneralDiscreteDistribution([0.1, -0.1]) Traceback (most recent call last): ... - ValueError: The distribution probabilities must be non-negative + ValueError: The distribution probabilities must be nonnegative """ cdef gsl_rng_type * T cdef gsl_rng * r @@ -1160,7 +1156,7 @@ cdef class GeneralDiscreteDistribution(ProbabilityDistribution): for i in range(n): if P[i] < 0: raise ValueError("The distribution probabilities must " - "be non-negative") + "be nonnegative") P_vec[i] = P[i] self.dist = gsl_ran_discrete_preproc(n, P_vec) diff --git a/src/sage/probability/random_variable.py b/src/sage/probability/random_variable.py index 1a779aba083..cb5c0426c5a 100644 --- a/src/sage/probability/random_variable.py +++ b/src/sage/probability/random_variable.py @@ -93,8 +93,8 @@ def __init__(self, X, f, codomain=None, check=False): INPUT: - - X -- a probability space - - f -- a dictionary such that X[x] = value for x in X + - ``X`` -- a probability space + - ``f`` -- dictionary such that X[x] = value for x in X is the discrete function on X """ if not isinstance(X, DiscreteProbabilitySpace): @@ -134,7 +134,7 @@ def function(self): def expectation(self): r""" The expectation of the discrete random variable, namely - `\sum_{x \in S} p(x) X[x]`, where `X` = self and + `\sum_{x \in S} p(x) X[x]`, where `X` = ``self`` and `S` is the probability space of `X`. """ E = 0 @@ -197,8 +197,8 @@ def translation_variance(self, map): def covariance(self, other): r""" - The covariance of the discrete random variable X = self with Y = - other. + The covariance of the discrete random variable X = ``self`` with Y = + ``other``. Let `S` be the probability space of `X` = self, with probability function `p`, and `E(X)` be the @@ -220,8 +220,8 @@ def covariance(self, other): def translation_covariance(self, other, map): r""" - The covariance of the probability space X = self with image of Y = - other under the given map of the probability space. + The covariance of the probability space X = ``self`` with image of Y = + ``other`` under the given map of the probability space. Let `S` be the probability space of `X` = self, with probability function `p`, and `E(X)` be the @@ -259,23 +259,23 @@ def standard_deviation(self): def translation_standard_deviation(self, map): r""" The standard deviation of the translated discrete random variable - `X \circ e`, where `X` = self and `e` = + `X \circ e`, where `X` = ``self`` and `e` = map. - Let `S` be the probability space of `X` = self, + Let `S` be the probability space of `X` = ``self``, with probability function `p`, and `E(X)` be the expectation of `X`. Then the standard deviation of `X` is defined to be .. MATH:: - \sigma(X) = \sqrt{ \sum_{x \in S} p(x) (X(x) - E(x))^2} + \sigma(X) = \sqrt{ \sum_{x \in S} p(x) (X(x) - E(x))^2} """ return sqrt(self.translation_variance(map)) def correlation(self, other): """ - The correlation of the probability space X = self with Y = other. + The correlation of the probability space X = ``self`` with Y = ``other``. """ cov = self.covariance(other) sigX = self.standard_deviation() @@ -286,8 +286,8 @@ def correlation(self, other): def translation_correlation(self, other, map): """ - The correlation of the probability space X = self with image of Y = - other under map. + The correlation of the probability space X = ``self`` with image of Y = + ``other`` under map. """ cov = self.translation_covariance(other, map) sigX = self.standard_deviation() diff --git a/src/sage/quivers/algebra.py b/src/sage/quivers/algebra.py index 90def69304a..9d948556305 100644 --- a/src/sage/quivers/algebra.py +++ b/src/sage/quivers/algebra.py @@ -45,9 +45,7 @@ class PathAlgebra(CombinatorialFreeModule): "degrevlex", "negdeglex" or "deglex", defining the monomial order to be used. - OUTPUT: - - - the path algebra `kP` with the given monomial order + OUTPUT: the path algebra `kP` with the given monomial order .. NOTE:: @@ -67,7 +65,7 @@ class PathAlgebra(CombinatorialFreeModule): sage: A is P.algebra(GF(7)) True - sage: A is P.algebra(GF(7), order="degrevlex") + sage: A is P.algebra(GF(7), order='degrevlex') False sage: A is P.algebra(RR) False @@ -132,7 +130,7 @@ class PathAlgebra(CombinatorialFreeModule): # # ########################################################################### - def __init__(self, k, P, order="negdegrevlex"): + def __init__(self, k, P, order='negdegrevlex'): """ Create a :class:`PathAlgebra` object. @@ -179,9 +177,9 @@ def order_string(self) -> str: EXAMPLES:: sage: P1 = DiGraph({1:{1:['x','y','z']}}).path_semigroup().algebra(GF(25,'t')) - sage: P2 = DiGraph({1:{1:['x','y','z']}}).path_semigroup().algebra(GF(25,'t'), order="degrevlex") - sage: P3 = DiGraph({1:{1:['x','y','z']}}).path_semigroup().algebra(GF(25,'t'), order="negdeglex") - sage: P4 = DiGraph({1:{1:['x','y','z']}}).path_semigroup().algebra(GF(25,'t'), order="deglex") + sage: P2 = DiGraph({1:{1:['x','y','z']}}).path_semigroup().algebra(GF(25,'t'), order='degrevlex') + sage: P3 = DiGraph({1:{1:['x','y','z']}}).path_semigroup().algebra(GF(25,'t'), order='negdeglex') + sage: P4 = DiGraph({1:{1:['x','y','z']}}).path_semigroup().algebra(GF(25,'t'), order='deglex') sage: P1.order_string() 'negdegrevlex' sage: P2.order_string() @@ -190,7 +188,6 @@ def order_string(self) -> str: 'negdeglex' sage: P4.order_string() 'deglex' - """ return self._ordstr @@ -277,7 +274,6 @@ def ngens(self): sage: A = P.algebra(GF(5)) sage: A.ngens() 7 - """ return self._semigroup.ngens() @@ -300,7 +296,6 @@ def _element_constructor_(self, x): 2*e_0 + 2*e_1 + 2*e_2 + 2*e_3 sage: B([(0,1,'a'),(1,2,'c')]) # indirect doctest a*c - """ from sage.quivers.paths import QuiverPath # If it's an element of another path algebra, do a linear combination @@ -399,7 +394,6 @@ def _coerce_map_from_(self, other): 2*e_0 + 2*e_1 + 2*e_2 + 2*e_3 sage: B(2)*x*B(3) # indirect doctest e_2 + b + e_3 - """ if isinstance(other, PathAlgebra) and self._base.has_coerce_map_from(other._base): OQ = other._quiver @@ -439,7 +433,6 @@ def _repr_monomial(self, data): sage: X = sage_eval('a+2*b+3*c+5*e_0+3*e_2', A.gens_dict()) sage: X # indirect doctest 5*e_0 + a + 2*b + 3*c + 3*e_2 - """ # m is [list, pos, mid], where the list gives the nb of arrows, pos # gives the component in the module, and mid gives the length of the @@ -462,7 +455,6 @@ def _latex_monomial(self, data): sage: X = sage_eval('a+2*b+3*c+5*e_0+3*e_2', A.gens_dict()) sage: latex(X) # indirect doctest 5 e_0 + a + 2 b + 3 c + 3 e_2 - """ arrows = self.variable_names() return '\\cdot '.join(arrows[n] for n in data) @@ -496,9 +488,7 @@ def quiver(self): """ Return the quiver from which the algebra ``self`` was formed. - OUTPUT: - - - :class:`DiGraph`, the quiver of the algebra + OUTPUT: :class:`DiGraph`; the quiver of the algebra EXAMPLES:: @@ -563,11 +553,11 @@ def degree_on_basis(self, x): def sum(self, iter_of_elements): """ - Return the sum of all elements in ``iter_of_elements`` + Return the sum of all elements in ``iter_of_elements``. INPUT: - - ``iter_of_elements``: iterator of elements of ``self`` + - ``iter_of_elements`` -- iterator of elements of ``self`` .. NOTE:: @@ -654,7 +644,6 @@ def homogeneous_component(self, n): sage: A = P.algebra(ZZ) sage: A.homogeneous_component(3) Free module spanned by [a*b*c, b*c*a, c*a*b] over Integer Ring - """ basis = [] for v in self._semigroup._quiver: @@ -667,7 +656,7 @@ def homogeneous_component(self, n): def homogeneous_components(self): r""" - Return the non-zero homogeneous components of ``self``. + Return the nonzero homogeneous components of ``self``. EXAMPLES:: diff --git a/src/sage/quivers/algebra_elements.pyx b/src/sage/quivers/algebra_elements.pyx index 63d187b05f6..a9c9366af57 100644 --- a/src/sage/quivers/algebra_elements.pyx +++ b/src/sage/quivers/algebra_elements.pyx @@ -106,7 +106,6 @@ cdef class PathAlgebraElement(RingElement): computations are not available for path algebras, yet. Hence, to implement computations in graded quotients of free algebras, the letterplace implementation currently is the only option. - """ def __cinit__(self): """ @@ -139,11 +138,11 @@ cdef class PathAlgebraElement(RingElement): INPUT: - - ``S``, a path algebra. + - ``S`` -- path algebra - - ``data``, a dictionary. Most of its keys are + - ``data`` -- dictionary; most of its keys are :class:`~sage.quivers.paths.QuiverPath`, the value giving its - coefficient. + coefficient .. NOTE:: @@ -156,17 +155,17 @@ cdef class PathAlgebraElement(RingElement): Defining e_1, x, y, z sage: (x+2*z+1)^2 e_1 + 4*z + 2*x + 4*z*z + 2*x*z + 2*z*x + x*x - sage: P2 = DiGraph({1:{1:['x','y','z']}}).path_semigroup().algebra(GF(25,'t'), order="degrevlex") + sage: P2 = DiGraph({1:{1:['x','y','z']}}).path_semigroup().algebra(GF(25,'t'), order='degrevlex') sage: P2.inject_variables() Defining e_1, x, y, z sage: (x+2*z+1)^2 4*z*z + 2*x*z + 2*z*x + x*x + 4*z + 2*x + e_1 - sage: P3 = DiGraph({1:{1:['x','y','z']}}).path_semigroup().algebra(GF(25,'t'), order="negdeglex") + sage: P3 = DiGraph({1:{1:['x','y','z']}}).path_semigroup().algebra(GF(25,'t'), order='negdeglex') sage: P3.inject_variables() Defining e_1, x, y, z sage: (x+2*z+1)^2 e_1 + 4*z + 2*x + 4*z*z + 2*z*x + 2*x*z + x*x - sage: P4 = DiGraph({1:{1:['x','y','z']}}).path_semigroup().algebra(GF(25,'t'), order="deglex") + sage: P4 = DiGraph({1:{1:['x','y','z']}}).path_semigroup().algebra(GF(25,'t'), order='deglex') sage: P4.inject_variables() Defining e_1, x, y, z sage: (x+2*z+1)^2 @@ -408,7 +407,7 @@ cdef class PathAlgebraElement(RingElement): EXAMPLES:: - sage: P = DiGraph({1:{1:['x','y','z']}}).path_semigroup().algebra(GF(25,'t'), order="degrevlex") + sage: P = DiGraph({1:{1:['x','y','z']}}).path_semigroup().algebra(GF(25,'t'), order='degrevlex') sage: P.inject_variables() Defining e_1, x, y, z sage: p = (x+2*z+1)^3 @@ -464,7 +463,7 @@ cdef class PathAlgebraElement(RingElement): EXAMPLES:: - sage: P = DiGraph({1:{1:['x','y','z']}}).path_semigroup().algebra(GF(25,'t'), order="degrevlex") + sage: P = DiGraph({1:{1:['x','y','z']}}).path_semigroup().algebra(GF(25,'t'), order='degrevlex') sage: P.inject_variables() Defining e_1, x, y, z sage: p = (x+2*z+1)^3 @@ -503,7 +502,7 @@ cdef class PathAlgebraElement(RingElement): EXAMPLES:: - sage: P = DiGraph({1:{1:['x','y','z']}}).path_semigroup().algebra(GF(25,'t'), order="degrevlex") + sage: P = DiGraph({1:{1:['x','y','z']}}).path_semigroup().algebra(GF(25,'t'), order='degrevlex') sage: P.inject_variables() Defining e_1, x, y, z sage: p = (x+2*z+1)^3 @@ -560,7 +559,7 @@ cdef class PathAlgebraElement(RingElement): EXAMPLES:: - sage: P = DiGraph({1:{1:['x','y','z']}}).path_semigroup().algebra(GF(25,'t'), order="degrevlex") + sage: P = DiGraph({1:{1:['x','y','z']}}).path_semigroup().algebra(GF(25,'t'), order='degrevlex') sage: P.inject_variables() Defining e_1, x, y, z sage: p = (x+2*z+1)^3 @@ -615,7 +614,7 @@ cdef class PathAlgebraElement(RingElement): EXAMPLES:: - sage: P = DiGraph({1:{1:['x','y','z']}}).path_semigroup().algebra(GF(25,'t'), order="degrevlex") + sage: P = DiGraph({1:{1:['x','y','z']}}).path_semigroup().algebra(GF(25,'t'), order='degrevlex') sage: P.inject_variables() Defining e_1, x, y, z sage: p = (x+2*z+1)^3 @@ -699,7 +698,7 @@ cdef class PathAlgebraElement(RingElement): EXAMPLES:: - sage: P = DiGraph({1:{1:['x','y','z']}}).path_semigroup().algebra(GF(25,'t'), order="degrevlex") + sage: P = DiGraph({1:{1:['x','y','z']}}).path_semigroup().algebra(GF(25,'t'), order='degrevlex') sage: P.inject_variables() Defining e_1, x, y, z sage: p = (x+2*z+1)^3 @@ -737,7 +736,7 @@ cdef class PathAlgebraElement(RingElement): EXAMPLES:: - sage: P = DiGraph({1:{1:['x','y','z']}}).path_semigroup().algebra(GF(25,'t'), order="degrevlex") + sage: P = DiGraph({1:{1:['x','y','z']}}).path_semigroup().algebra(GF(25,'t'), order='degrevlex') sage: P.inject_variables() Defining e_1, x, y, z sage: p = (x+2*z+1)^3 @@ -789,7 +788,7 @@ cdef class PathAlgebraElement(RingElement): """ EXAMPLES:: - sage: P = DiGraph({1:{1:['x','y','z']}}).path_semigroup().algebra(GF(25,'t'), order="degrevlex") + sage: P = DiGraph({1:{1:['x','y','z']}}).path_semigroup().algebra(GF(25,'t'), order='degrevlex') sage: P.inject_variables() Defining e_1, x, y, z sage: p = (x+2*z+1)^3 @@ -921,7 +920,7 @@ cdef class PathAlgebraElement(RingElement): EXAMPLES:: sage: P1 = DiGraph({1:{1:['x','y','z']}}).path_semigroup().algebra(GF(3,'t')) - sage: P2 = DiGraph({1:{1:['x','y','z']}}).path_semigroup().algebra(GF(3,'t'), order="deglex") + sage: P2 = DiGraph({1:{1:['x','y','z']}}).path_semigroup().algebra(GF(3,'t'), order='deglex') sage: P1.inject_variables() Defining e_1, x, y, z sage: p = x+y diff --git a/src/sage/quivers/ar_quiver.py b/src/sage/quivers/ar_quiver.py index daa1e755fa5..f13c67dfa32 100644 --- a/src/sage/quivers/ar_quiver.py +++ b/src/sage/quivers/ar_quiver.py @@ -213,7 +213,7 @@ def _repr_(self): # add options to class class options(GlobalOptions): r""" - Sets and displays the global options for Auslander-Reiten quivers. + Set and display the global options for Auslander-Reiten quivers. If no parameters are set, then the function returns a copy of the options dictionary. @@ -240,7 +240,7 @@ class options(GlobalOptions): """ NAME = 'AuslanderReitenQuiver' module = 'sage.quivers.ar_quiver' - latex = dict(default="node", + latex = dict(default='node', description='Specifies how nodes of the AR quiver should be latexed', values=dict(node='latex as the node description', dimension_vector='latex as the dimension vector', @@ -356,7 +356,7 @@ def edge_options(data): edge_opts["label"] = LatexExpr(r"\tau") return edge_opts - G.set_latex_options(format="dot2tex", edge_options=edge_options) + G.set_latex_options(format='dot2tex', edge_options=edge_options) return G def digraph_preprojectives(self, max_depth, with_translations=False): @@ -395,7 +395,7 @@ def digraph_preprojectives(self, max_depth, with_translations=False): prev = cur cur = self._dim_vecs_level(k) - G = DiGraph([verts, edges], format="vertices_and_edges", multiedges=True, immutable=True) + G = DiGraph([verts, edges], format='vertices_and_edges', multiedges=True, immutable=True) return self._digraph_set_latex_options(G) def digraph_postinjectives(self, max_depth, with_translations=False): @@ -434,7 +434,7 @@ def digraph_postinjectives(self, max_depth, with_translations=False): prev = cur cur = self._dim_vecs_level(-k) - G = DiGraph([verts, edges], format="vertices_and_edges", multiedges=True, immutable=True) + G = DiGraph([verts, edges], format='vertices_and_edges', multiedges=True, immutable=True) return self._digraph_set_latex_options(G) @cached_method @@ -444,8 +444,8 @@ def digraph(self, with_translations=False): INPUT: - - ``with_translations`` -- (default: ``False``) if ``True``, then - include the arrows corresponding to the translations. + - ``with_translations`` -- boolean (default: ``False``); if ``True``, then + include the arrows corresponding to the translations EXAMPLES:: @@ -491,7 +491,7 @@ def digraph(self, with_translations=False): cur = self._dim_vecs_level(k) self._injectives = Family(injectives) - G = DiGraph([verts, edges], format="vertices_and_edges", immutable=True) + G = DiGraph([verts, edges], format='vertices_and_edges', immutable=True) return self._digraph_set_latex_options(G) diff --git a/src/sage/quivers/homspace.py b/src/sage/quivers/homspace.py index 6a987c339ec..c614979f694 100644 --- a/src/sage/quivers/homspace.py +++ b/src/sage/quivers/homspace.py @@ -272,9 +272,7 @@ def __call__(self, *data, **kwds): default call method of :class:`~sage.categories.homset.Homset` is called instead. - OUTPUT: - - - :class:`QuiverRepHom` + OUTPUT: :class:`QuiverRepHom` EXAMPLES:: @@ -383,9 +381,7 @@ def _identity(self): """ Return the identity map. - OUTPUT: - - - :class:`QuiverRepHom` + OUTPUT: :class:`QuiverRepHom` EXAMPLES:: @@ -427,9 +423,7 @@ def quiver(self): """ Return the quiver of the representations. - OUTPUT: - - - :class:`DiGraph`, the quiver of the representations + OUTPUT: :class:`DiGraph`; the quiver of the representations EXAMPLES:: @@ -444,9 +438,7 @@ def domain(self): """ Return the domain of the hom space. - OUTPUT: - - - :class:`QuiverRep`, the domain of the Hom space + OUTPUT: :class:`QuiverRep`; the domain of the Hom space EXAMPLES:: @@ -462,9 +454,7 @@ def codomain(self): """ Return the codomain of the hom space. - OUTPUT: - - - :class:`QuiverRep`, the codomain of the Hom space + OUTPUT: :class:`QuiverRep`; the codomain of the Hom space EXAMPLES:: @@ -487,9 +477,7 @@ def dimension(self): """ Return the dimension of the hom space. - OUTPUT: - - - integer, the dimension + OUTPUT: integer; the dimension EXAMPLES:: @@ -505,9 +493,7 @@ def gens(self) -> tuple: Return a tuple of generators of the hom space (as a `k`-vector space). - OUTPUT: - - - tuple of :class:`QuiverRepHom` objects, the generators + OUTPUT: tuple of :class:`QuiverRepHom` objects; the generators EXAMPLES:: @@ -584,9 +570,7 @@ def left_module(self, basis=False): elements of this list are the homomorphisms which correspond to the basis elements of that vertex in the module. - OUTPUT: - - - :class:`QuiverRep` or tuple + OUTPUT: :class:`QuiverRep` or tuple .. WARNING:: diff --git a/src/sage/quivers/morphism.py b/src/sage/quivers/morphism.py index f6c2ca180a6..3c017de4dab 100644 --- a/src/sage/quivers/morphism.py +++ b/src/sage/quivers/morphism.py @@ -66,9 +66,7 @@ class QuiverRepHom(CallMorphism): and from ``C`` to the codomain of ``self``. The composition of these maps is the result. - OUTPUT: - - - :class:`QuiverRepHom` + OUTPUT: :class:`QuiverRepHom` EXAMPLES:: @@ -446,7 +444,7 @@ def __isub__(self, other): def __neg__(self): """ - This function overrides the unary ``-`` operator + This function overrides the unary ``-`` operator. TESTS:: @@ -469,7 +467,7 @@ def __neg__(self): def __pos__(self): """ - This function overrides the unary ``+`` operator + This function overrides the unary ``+`` operator. TESTS:: @@ -490,7 +488,7 @@ def __pos__(self): def __eq__(self, other): """ - This function overrides the ``==`` operator + This function overrides the ``==`` operator. TESTS:: @@ -536,7 +534,7 @@ def __hash__(self): def __ne__(self, other): """ - This function overrides the ``!=`` operator + This function overrides the ``!=`` operator. TESTS:: @@ -588,7 +586,7 @@ def __bool__(self) -> bool: def __mul__(self, other): """ - This function overrides the ``*`` operator + This function overrides the ``*`` operator. TESTS:: @@ -659,9 +657,7 @@ def domain(self): """ Return the domain of the homomorphism. - OUTPUT: - - - :class:`QuiverRep`, the domain + OUTPUT: :class:`QuiverRep`; the domain EXAMPLES:: @@ -680,9 +676,7 @@ def codomain(self): """ Return the codomain of the homomorphism. - OUTPUT: - - - :class:`QuiverRep`, the codomain + OUTPUT: :class:`QuiverRep`; the codomain EXAMPLES:: @@ -704,12 +698,10 @@ def get_matrix(self, vertex): INPUT: - - ``vertex`` -- integer, a vertex of the quiver + - ``vertex`` -- integer; a vertex of the quiver - OUTPUT: - - - matrix, the matrix representing the homomorphism associated to - the given vertex + OUTPUT: the matrix representing the homomorphism associated to + the given vertex EXAMPLES:: @@ -741,11 +733,9 @@ def get_map(self, vertex): INPUT: - - ``vertex`` -- integer, a vertex of the quiver + - ``vertex`` -- integer; a vertex of the quiver - OUTPUT: - - - homomorphism, the homomorphism associated to the given vertex + OUTPUT: the homomorphism associated to the given vertex EXAMPLES:: @@ -781,9 +771,7 @@ def base_ring(self): """ Return the base ring of the representation in the codomain. - OUTPUT: - - - ring, the base ring of the codomain + OUTPUT: the base ring of the codomain EXAMPLES:: @@ -806,9 +794,8 @@ def is_injective(self): """ Test whether the homomorphism is injective. - OUTPUT: - - - bool, ``True`` if the homomorphism is injective, ``False`` otherwise + OUTPUT: boolean; ``True`` if the homomorphism is injective, ``False`` + otherwise EXAMPLES:: @@ -829,9 +816,8 @@ def is_surjective(self): """ Test whether the homomorphism is surjective. - OUTPUT: - - - bool, ``True`` if the homomorphism is surjective, ``False`` otherwise + OUTPUT: boolean; ``True`` if the homomorphism is surjective, ``False`` + otherwise EXAMPLES:: @@ -857,10 +843,8 @@ def is_isomorphism(self): """ Test whether the homomorphism is an isomorphism. - OUTPUT: - - - bool, ``True`` if the homomorphism is bijective, ``False`` - otherwise + OUTPUT: boolean; ``True`` if the homomorphism is bijective, ``False`` + otherwise EXAMPLES:: @@ -880,9 +864,8 @@ def is_zero(self): """ Test whether the homomorphism is the zero homomorphism. - OUTPUT: - - - bool, ``True`` if the homomorphism is zero, ``False`` otherwise + OUTPUT: boolean; ``True`` if the homomorphism is zero, ``False`` + otherwise EXAMPLES:: @@ -902,10 +885,8 @@ def is_endomorphism(self): """ Test whether the homomorphism is an endomorphism. - OUTPUT: - - - bool, ``True`` if the domain equals the codomain, ``False`` - otherwise + OUTPUT: boolean; ``True`` if the domain equals the codomain, ``False`` + otherwise EXAMPLES:: @@ -926,9 +907,7 @@ def rank(self): Return the rank of the homomorphism ``self`` (as a `k`-linear map). - OUTPUT: - - - integer, the rank + OUTPUT: integer; the rank EXAMPLES:: @@ -953,9 +932,7 @@ def kernel(self): """ Return the kernel of ``self``. - OUTPUT: - - - :class:`QuiverRep`, the kernel + OUTPUT: :class:`QuiverRep`; the kernel .. NOTE:: @@ -982,9 +959,7 @@ def image(self): """ Return the image of ``self``. - OUTPUT: - - - :class:`QuiverRep`, the image + OUTPUT: :class:`QuiverRep`; the image .. NOTE:: @@ -1011,9 +986,7 @@ def cokernel(self): """ Return the cokernel of ``self``. - OUTPUT: - - - :class:`QuiverRep`, the cokernel + OUTPUT: :class:`QuiverRep`; the cokernel .. NOTE:: @@ -1040,9 +1013,7 @@ def linear_dual(self): Compute the linear dual `Df : DN \to DM` of ``self`` = `f : M \to N` where `D(-) = Hom_k(-, k)`. - OUTPUT: - - - :class:`QuiverRepHom`, the map `Df : DN \to DM` + OUTPUT: :class:`QuiverRepHom`; the map `Df : DN \to DM` .. NOTE:: @@ -1088,9 +1059,7 @@ def algebraic_dual(self): Compute the algebraic dual `f^t : N^t \to M^t` of ``self`` = `f : M \to N` where `(-)^t = Hom_Q(-, kQ)`. - OUTPUT: - - - :class:`QuiverRepHom`, the map `f^t : N^t \to M^t` + OUTPUT: :class:`QuiverRepHom`; the map `f^t : N^t \to M^t` .. NOTE:: @@ -1131,7 +1100,7 @@ def direct_sum(self, maps, return_maps=False, pinch=None): - ``maps`` -- :class:`QuiverRepHom` or list of :class:`QuiverRepHom`'s - - ``return_maps`` -- bool (default: ``False``). If ``False``, then + - ``return_maps`` -- boolean (default: ``False``); if ``False``, then the return value is a :class:`QuiverRepHom` which is the direct sum of ``self`` with the :class:`QuiverRepHoms` in ``maps``. If ``True``, then the return value is a tuple of length either 3 @@ -1147,7 +1116,7 @@ def direct_sum(self, maps, return_maps=False, pinch=None): If ``pinch`` is either ``'domain'`` or ``'codomain'`` then the tuple will have length 3. - - ``pinch`` -- string or ``None`` (default: ``None``). If this is + - ``pinch`` -- string or ``None`` (default: ``None``); if this is equal to ``'domain'``, then the domains of ``self`` and the given maps must be equal. The direct sum of `f: A \to B` and `g: A \to C` returned is then the map `A \to B \oplus C` defined @@ -1161,9 +1130,7 @@ def direct_sum(self, maps, return_maps=False, pinch=None): `A \oplus C \to B \oplus D` defined by sending `(x, y)` to `(f(x), g(y))`. - OUTPUT: - - - :class:`QuiverRepHom` or tuple + OUTPUT: :class:`QuiverRepHom` or tuple EXAMPLES:: @@ -1246,9 +1213,7 @@ def lift(self, x): - ``x`` -- :class:`QuiverRepElement` - OUTPUT: - - - :class:`QuiverRepElement` + OUTPUT: :class:`QuiverRepElement` EXAMPLES:: diff --git a/src/sage/quivers/path_semigroup.py b/src/sage/quivers/path_semigroup.py index 860242334ba..86f420713ee 100644 --- a/src/sage/quivers/path_semigroup.py +++ b/src/sage/quivers/path_semigroup.py @@ -268,7 +268,7 @@ def _coerce_map_from_(self, other): def _element_constructor_(self, data, check=True): """ - The accepted data are + The accepted data are: - the integer ``1``, which returns the first idempotent, - a list, whose only item is a tuple ``(v,v)`` for a vertex ``v``, @@ -599,7 +599,6 @@ def __iter__(self): c*b*d a*d*c*a a*d*c*b - """ d = 0 length_d_available = True @@ -617,8 +616,8 @@ def iter_paths_by_length_and_startpoint(self, d, v): INPUT: - - ``d`` -- an integer, the path length - - ``v`` -- a vertex, start point of the paths + - ``d`` -- integer; the path length + - ``v`` -- a vertex; start point of the paths EXAMPLES:: @@ -659,7 +658,7 @@ def iter_paths_by_length_and_startpoint(self, d, v): """ # iterate over length d paths starting at vertex v if not d >= 0: - raise ValueError("path length must be a non-negative integer") + raise ValueError("path length must be a nonnegative integer") if v not in self._quiver: raise ValueError("the starting point {} is not a vertex of the underlying quiver".format(v)) if not d: @@ -675,8 +674,8 @@ def iter_paths_by_length_and_endpoint(self, d, v): INPUT: - - ``d`` -- an integer, the path length - - ``v`` -- a vertex, end point of the paths + - ``d`` -- integer; the path length + - ``v`` -- a vertex; end point of the paths EXAMPLES:: @@ -693,7 +692,7 @@ def iter_paths_by_length_and_endpoint(self, d, v): """ # iterate over length d paths ending at vertex v if not d >= 0: - raise ValueError("path length must be a non-negative integer") + raise ValueError("path length must be a nonnegative integer") if v not in self._quiver: raise ValueError("the starting point {} is not a vertex of the underlying quiver".format(v)) if not d: @@ -739,7 +738,7 @@ def reverse(self): """ return self._quiver.reverse().path_semigroup() - def algebra(self, k, order="negdegrevlex"): + def algebra(self, k, order='negdegrevlex'): """ Return the path algebra of the underlying quiver. @@ -765,9 +764,9 @@ def algebra(self, k, order="negdegrevlex"): Now some example with different monomial orderings:: sage: P1 = DiGraph({1:{1:['x','y','z']}}).path_semigroup().algebra(GF(25,'t')) - sage: P2 = DiGraph({1:{1:['x','y','z']}}).path_semigroup().algebra(GF(25,'t'), order="degrevlex") - sage: P3 = DiGraph({1:{1:['x','y','z']}}).path_semigroup().algebra(GF(25,'t'), order="negdeglex") - sage: P4 = DiGraph({1:{1:['x','y','z']}}).path_semigroup().algebra(GF(25,'t'), order="deglex") + sage: P2 = DiGraph({1:{1:['x','y','z']}}).path_semigroup().algebra(GF(25,'t'), order='degrevlex') + sage: P3 = DiGraph({1:{1:['x','y','z']}}).path_semigroup().algebra(GF(25,'t'), order='negdeglex') + sage: P4 = DiGraph({1:{1:['x','y','z']}}).path_semigroup().algebra(GF(25,'t'), order='deglex') sage: P1.order_string() 'negdegrevlex' sage: sage_eval('(x+2*z+1)^3', P1.gens_dict()) @@ -778,7 +777,6 @@ def algebra(self, k, order="negdegrevlex"): e_1 + z + 3*x + 2*z*z + z*x + x*z + 3*x*x + 3*z*z*z + 4*z*z*x + 4*z*x*z + 2*z*x*x + 4*x*z*z + 2*x*z*x + 2*x*x*z + x*x*x sage: sage_eval('(x+2*z+1)^3', P4.gens_dict()) 3*z*z*z + 4*z*z*x + 4*z*x*z + 2*z*x*x + 4*x*z*z + 2*x*z*x + 2*x*x*z + x*x*x + 2*z*z + z*x + x*z + 3*x*x + z + 3*x + e_1 - """ from sage.quivers.algebra import PathAlgebra return PathAlgebra(k, self, order) @@ -817,14 +815,12 @@ def S(self, k, vertex): INPUT: - - `k` -- ring, the base ring of the representation + - ``k`` -- the base ring of the representation - - ``vertex`` -- integer, a vertex of the quiver + - ``vertex`` -- integer; a vertex of the quiver - OUTPUT: - - - :class:`~sage.quivers.representation.QuiverRep`, the simple module - at ``vertex`` with base ring `k` + OUTPUT: :class:`~sage.quivers.representation.QuiverRep`; the simple + module at ``vertex`` with base ring `k` EXAMPLES:: @@ -861,14 +857,12 @@ def P(self, k, vertex): INPUT: - - `k` -- ring, the base ring of the representation + - ``k`` -- the base ring of the representation - - ``vertex`` -- integer, a vertex of the quiver + - ``vertex`` -- integer; a vertex of the quiver - OUTPUT: - - - :class:`~sage.quivers.representation.QuiverRep`, the indecomposable - projective module at ``vertex`` with base ring `k` + OUTPUT: :class:`~sage.quivers.representation.QuiverRep`, the + indecomposable projective module at ``vertex`` with base ring `k` EXAMPLES:: @@ -901,9 +895,9 @@ def I(self, k, vertex): INPUT: - - `k` -- ring, the base ring of the representation + - ``k`` -- the base ring of the representation - - ``vertex`` -- integer, a vertex of the quiver + - ``vertex`` -- integer; a vertex of the quiver OUTPUT: @@ -939,7 +933,7 @@ def free_module(self, k): INPUT: - - ``k`` -- ring, the base ring of the representation. + - ``k`` -- ring; the base ring of the representation OUTPUT: @@ -1016,9 +1010,7 @@ def all_paths(self, start=None, end=None): vertex of the paths in the output; if ``None`` is given then the terminal vertex is arbitrary - OUTPUT: - - - list of paths, excluding the invalid path + OUTPUT: list of paths, excluding the invalid path .. TODO:: diff --git a/src/sage/quivers/paths.pyx b/src/sage/quivers/paths.pyx index b8148497a72..aeb4e07b82f 100644 --- a/src/sage/quivers/paths.pyx +++ b/src/sage/quivers/paths.pyx @@ -105,7 +105,6 @@ cdef class QuiverPath(MonoidElement): sage: Q = DiGraph({1:{2:['a']}, 2:{3:['b']}}).path_semigroup() sage: p = Q([(1, 1)]) * Q([(1, 1)]) sage: del p # indirect doctest - """ biseq_dealloc(self._path) @@ -125,17 +124,17 @@ cdef class QuiverPath(MonoidElement): def __init__(self, parent, start, end, path): """ - Creates a path object. Type ``QuiverPath?`` for more information. + Create a path object. Type ``QuiverPath?`` for more information. INPUT: - - ``parent``, a path semigroup. - - ``start``, integer, the label of the initial vertex. - - ``end``, integer, the label of the terminal vertex. - - ``path``, list of integers, providing the list of arrows + - ``parent`` -- a path semigroup + - ``start`` -- integer; the label of the initial vertex + - ``end`` -- integer; the label of the terminal vertex + - ``path`` -- list of integers, providing the list of arrows occurring in the path, labelled according to the position in the list of all arrows (resp. the list of outgoing arrows at - each vertex). + each vertex) TESTS:: @@ -322,7 +321,6 @@ cdef class QuiverPath(MonoidElement): False sage: a < a False - """ # Since QuiverPath inherits from Element, it is guaranteed that # both arguments are elements of the same path semigroup @@ -404,7 +402,6 @@ cdef class QuiverPath(MonoidElement): e_4 sage: p[20:40].initial_vertex() == p.terminal_vertex() True - """ cdef tuple E cdef Py_ssize_t start, stop, step, slicelength @@ -527,7 +524,6 @@ cdef class QuiverPath(MonoidElement): a*b sage: print(p % e2) None - """ cdef QuiverPath right = other # Handle trivial case @@ -594,7 +590,6 @@ cdef class QuiverPath(MonoidElement): b*a*c*d*a*c*d*a*b sage: print(p2[2:-1].gcd(p2[1:])) (None, None, None) - """ if self._parent is not P._parent: return (None, None, None) @@ -624,7 +619,6 @@ cdef class QuiverPath(MonoidElement): (b*c, b*a*d*d) sage: (b*c*a*d*b).complement(a*c) (None, None) - """ cdef mp_size_t i = biseq_contains(self._path, subpath._path, 0) if i == -1: @@ -637,8 +631,8 @@ cdef class QuiverPath(MonoidElement): INPUT: - ``subpath``, a path of positive length in the same path semigroup as - this path. + - ``subpath`` -- a path of positive length in the same path semigroup + as this path EXAMPLES:: @@ -676,7 +670,7 @@ cdef class QuiverPath(MonoidElement): INPUT: - ``subpath``, a path in the same path semigroup as this path. + - ``subpath`` -- a path in the same path semigroup as this path OUTPUT: ``0`` or ``1``, which stands for ``False`` resp. ``True`` @@ -693,7 +687,6 @@ cdef class QuiverPath(MonoidElement): 1 sage: (c*b*e*a).has_prefix(e_2) 0 - """ if subpath._parent is not self._parent: raise ValueError("the two paths belong to different quivers") @@ -709,9 +702,7 @@ cdef class QuiverPath(MonoidElement): """ Return the initial vertex of the path. - OUTPUT: - - - integer, the label of the initial vertex + OUTPUT: integer; the label of the initial vertex EXAMPLES:: @@ -726,9 +717,7 @@ cdef class QuiverPath(MonoidElement): """ Return the terminal vertex of the path. - OUTPUT: - - - integer, the label of the terminal vertex + OUTPUT: integer; the label of the terminal vertex EXAMPLES:: @@ -757,7 +746,6 @@ cdef class QuiverPath(MonoidElement): e_1 sage: e.reversal() e_1 - """ Q = self._parent.reverse() # Handle trivial paths @@ -786,16 +774,16 @@ def NewQuiverPath(Q, start, end, biseq_data): INPUT: - - ``Q``, the path semigroup of a quiver - - ``start``, an integer, the label of the startpoint - - ``end``, an integer, the label of the endpoint - - ``biseq_data``, a tuple formed by + - ``Q`` -- the path semigroup of a quiver + - ``start`` -- integer; the label of the startpoint + - ``end`` -- integer; the label of the endpoint + - ``biseq_data`` -- tuple formed by - - A string, encoding a bitmap representing the path as integer - at base `32`, - - the number of bits used to store the path, + - a string, encoding a bitmap representing the path as integer + at base `32` + - the number of bits used to store the path - the number of bits used to store a single item - - the number of items in the path. + - the number of items in the path TESTS:: diff --git a/src/sage/quivers/representation.py b/src/sage/quivers/representation.py index be58c37fd70..b1093a98891 100644 --- a/src/sage/quivers/representation.py +++ b/src/sage/quivers/representation.py @@ -480,15 +480,15 @@ class QuiverRepFactory(UniqueFactory): are ignored; the keywords are only checked in the event that the argument list does not have enough entries after ``P``. - - ``spaces`` -- dict (default: empty); a dictionary associating to each - vertex a free module over the base ring `k`. Not all vertices must be - specified; unspecified vertices are automatically set to `k^0`. Keys + - ``spaces`` -- dictionary (default: empty); a dictionary associating to + each vertex a free module over the base ring `k`. Not all vertices must + be specified; unspecified vertices are automatically set to `k^0`. Keys of the dictionary that don't correspond to vertices are ignored. - - ``maps`` -- dict (default: empty); a dictionary associating to each edge - a map whose domain and codomain are the spaces associated to the initial - and terminal vertex of the edge respectively. Not all edges must be - specified; unspecified edges are automatically set to the zero map. + - ``maps`` -- dictionary (default: empty); a dictionary associating to each + edge a map whose domain and codomain are the spaces associated to the + initial and terminal vertex of the edge respectively. Not all edges must + be specified; unspecified edges are automatically set to the zero map. Keys of the dictionary that don't correspond to edges are ignored. The second option is the ``paths`` option which creates a module by @@ -522,12 +522,10 @@ class QuiverRepFactory(UniqueFactory): Using the second and third options requires that the following keyword be passed to the constructor. This must be passed as a keyword. - - ``option`` -- string (default: ``None``), either ``'values'`` or - ``'paths'`` or ``'dual paths'``. ``None`` is equivalent to ``'values'``. + - ``option`` -- string (default: ``None``); either ``'values'`` or + ``'paths'`` or ``'dual paths'``. ``None`` is equivalent to ``'values'`` - OUTPUT: - - - :class:`QuiverRep` + OUTPUT: :class:`QuiverRep` EXAMPLES:: @@ -573,7 +571,8 @@ class QuiverRepFactory(UniqueFactory): In the following example, the 3rd and 4th paths are actually the same, so the duplicate is removed:: - sage: N = Q1.representation(QQ, [[(1, 1)], [(2, 2)], [(1, 2, 'a')], [(1, 2, 'a')]], option='paths') + sage: N = Q1.representation(QQ, [[(1, 1)], [(2, 2)], [(1, 2, 'a')], + ....: [(1, 2, 'a')]], option='paths') sage: N.dimension() 3 @@ -607,9 +606,7 @@ def create_key(self, k, P, *args, **kwds): See the class documentation. - OUTPUT: - - - tuple + OUTPUT: tuple EXAMPLES:: @@ -763,9 +760,7 @@ def create_object(self, version, key, **extra_args): - ``version`` -- the version of sage, this is currently ignored - ``key`` -- tuple - OUTPUT: - - - :class:`QuiverRep_generic` or :class:`QuiverRep_with_path_basis` + OUTPUT: :class:`QuiverRep_generic` or :class:`QuiverRep_with_path_basis` EXAMPLES:: @@ -825,20 +820,18 @@ class QuiverRepElement(ModuleElement): INPUT: - - ``module`` -- :class:`QuiverRep` (default: ``None``), the module to + - ``module`` -- :class:`QuiverRep` (default: ``None``); the module to which the element belongs - - ``elements`` -- dict (default: empty), a dictionary associating to each - vertex a vector or an object from which sage can create a vector. + - ``elements`` -- dictionary (default: empty); a dictionary associating to + each vertex a vector or an object from which sage can create a vector. Not all vertices must be specified, unspecified vertices will be assigned the zero vector of the space associated to that vertex in the given module. Keys that do not correspond to a vertex are ignored. - - ``name`` -- string (default: ``None``), the name of the element - - OUTPUT: + - ``name`` -- string (default: ``None``); the name of the element - - :class:`QuiverRepElement` + OUTPUT: :class:`QuiverRepElement` .. NOTE:: @@ -986,7 +979,7 @@ def _neg_(self): def __mul__(self, other): """ - Implements ``*`` for right multiplication by quiver algebra elements. + Implement ``*`` for right multiplication by quiver algebra elements. TESTS:: @@ -1126,9 +1119,7 @@ def quiver(self): """ Return the quiver of the representation. - OUTPUT: - - - :class:`DiGraph`, the quiver of the representation + OUTPUT: :class:`DiGraph`, the quiver of the representation EXAMPLES:: @@ -1146,11 +1137,9 @@ def get_element(self, vertex): INPUT: - - ``vertex`` -- integer, a vertex of the quiver - - OUTPUT: + - ``vertex`` -- integer; a vertex of the quiver - - vector, the vector assigned to the given vertex + OUTPUT: the vector assigned to the given vertex EXAMPLES:: @@ -1178,7 +1167,7 @@ def _set_element(self, vector, vertex): - ``vector`` -- a vector or an object from which the space associated to the given vertex in the parent can create a vector - - ``vertex`` -- integer, a vertex of the quiver + - ``vertex`` -- integer; a vertex of the quiver .. WARNING:: @@ -1212,10 +1201,8 @@ def is_zero(self): """ Test whether ``self`` is zero. - OUTPUT: - - - bool, ``True`` if the element is the zero element, ``False`` - otherwise + OUTPUT: boolean, ``True`` if the element is the zero element, ``False`` + otherwise EXAMPLES:: @@ -1249,9 +1236,7 @@ def support(self): The support is the set of vertices to which a nonzero vector is associated. - OUTPUT: - - - list, the support + OUTPUT: list; the support EXAMPLES:: @@ -1319,22 +1304,20 @@ class QuiverRep_generic(WithEqualityById, Module): - ``P`` -- the path semigroup of the quiver `Q` of the representation - - ``spaces`` -- dict (default: empty), a dictionary associating to each - vertex a free module over the base ring `k`. Not all vertices need + - ``spaces`` -- dictionary (default: empty); a dictionary associating to + each vertex a free module over the base ring `k`. Not all vertices need to be specified, unspecified vertices are automatically set to `k^0`. Keys of the dictionary that don't correspond to vertices are ignored. - - ``maps`` -- dict (default: empty), a dictionary associating to each - edge a map whose domain and codomain are the spaces associated to + - ``maps`` -- dictionary (default: empty); a dictionary associating to + each edge a map whose domain and codomain are the spaces associated to the initial and terminal vertex of the edge respectively. Not all edges need to be specified, unspecified edges are automatically set to the zero map. Keys of the dictionary that don't correspond to edges are ignored. - OUTPUT: - - - :class:`QuiverRep` + OUTPUT: :class:`QuiverRep` EXAMPLES:: @@ -1576,11 +1559,9 @@ def _coerce_map_from_(self, domain): INPUT: - - ``domain`` -= a Sage object - - OUTPUT: + - ``domain`` -- a Sage object - - :class:`QuiverRepHom` or bool + OUTPUT: :class:`QuiverRepHom` or boolean TESTS:: @@ -1658,7 +1639,7 @@ def get_space(self, vertex): INPUT: - - ``vertex`` -- integer, a vertex of the quiver of the module + - ``vertex`` -- integer; a vertex of the quiver of the module EXAMPLES:: @@ -1694,9 +1675,7 @@ def quiver(self): """ Return the quiver of the representation. - OUTPUT: - - - :class:`DiGraph` + OUTPUT: :class:`DiGraph` EXAMPLES:: @@ -1711,9 +1690,7 @@ def actor(self): r""" Return the quiver path algebra acting on this representation. - OUTPUT: - - - a quiver path algebra + OUTPUT: a quiver path algebra EXAMPLES:: @@ -1778,9 +1755,7 @@ def dimension_vector(self): """ Return the dimension vector of the representation. - OUTPUT: - - - tuple + OUTPUT: tuple .. NOTE:: @@ -1806,9 +1781,7 @@ def is_zero(self): """ Test whether the representation is zero. - OUTPUT: - - - bool + OUTPUT: boolean EXAMPLES:: @@ -1830,9 +1803,7 @@ def is_simple(self): """ Test whether the representation is simple. - OUTPUT: - - - bool + OUTPUT: boolean EXAMPLES:: @@ -1850,9 +1821,7 @@ def is_semisimple(self): """ Test whether the representation is semisimple. - OUTPUT: - - - bool + OUTPUT: boolean EXAMPLES:: @@ -1872,9 +1841,7 @@ def an_element(self): """ Return an element of ``self``. - OUTPUT: - - - :class:`QuiverRepElement` + OUTPUT: :class:`QuiverRepElement` EXAMPLES:: @@ -2030,9 +1997,7 @@ def linear_combination_of_basis(self, coordinates): coefficient of the `i`-th basis vector in the linear combination. - OUTPUT: - - - :class:`QuiverRepElement` + OUTPUT: :class:`QuiverRepElement` EXAMPLES:: @@ -2071,7 +2036,7 @@ def submodule(self, elements=[], spaces=None): - ``elements`` -- a collection of QuiverRepElements (default: empty list), each should be an element of ``self`` - - ``spaces`` -- dictionary (default: empty), this dictionary + - ``spaces`` -- dictionary (default: empty); this dictionary should contain entries of the form ``{v: S}`` where `v` is a vertex of the quiver and `S` is a subspace of the vector space associated to `v` @@ -2183,13 +2148,11 @@ def quotient(self, sub, check=True): associated to each edge `e` of ``sub`` is the restriction of the map associated to `e` in ``self`` - - ``check`` -- bool; if ``True`` then ``sub`` is checked to verify + - ``check`` -- boolean; if ``True`` then ``sub`` is checked to verify that it is indeed a submodule of ``self`` and an error is raised if it is not - OUTPUT: - - - :class:`QuiverRep`, the quotient module ``self / sub`` + OUTPUT: :class:`QuiverRep`, the quotient module ``self / sub`` .. NOTE:: @@ -2256,9 +2219,7 @@ def socle(self): """ The socle of ``self``. - OUTPUT: - - - :class:`QuiverRep`, the socle + OUTPUT: :class:`QuiverRep`; the socle EXAMPLES:: @@ -2280,9 +2241,7 @@ def radical(self): """ Return the Jacobson radical of ``self``. - OUTPUT: - - - :class:`QuiverRep`, the Jacobson radical + OUTPUT: :class:`QuiverRep`; the Jacobson radical EXAMPLES:: @@ -2304,9 +2263,7 @@ def top(self): """ Return the top of ``self``. - OUTPUT: - - - :class:`QuiverRep`, the quotient of ``self`` by its radical + OUTPUT: :class:`QuiverRep`; the quotient of ``self`` by its radical EXAMPLES:: @@ -2323,9 +2280,7 @@ def zero_submodule(self): """ Return the zero submodule of ``self``. - OUTPUT: - - - :class:`QuiverRep`, the zero submodule of ``self``. + OUTPUT: :class:`QuiverRep`; the zero submodule of ``self`` EXAMPLES:: @@ -2345,9 +2300,7 @@ def linear_dual(self): Compute the linear dual `Hom_k(M, k)` of the module `M =` ``self`` over the base ring `k`. - OUTPUT: - - - :class:`QuiverRep`, the dual representation + OUTPUT: :class:`QuiverRep`; the dual representation .. NOTE:: @@ -2399,16 +2352,14 @@ def algebraic_dual(self, basis=False): INPUT: - - ``basis`` -- bool; if ``False``, then only the module is + - ``basis`` -- boolean; if ``False``, then only the module is returned. If ``True``, then a tuple is returned. The first element is the :class:`QuiverRep` and the second element is a dictionary which associates to each vertex a list. The elements of this list are the homomorphisms which correspond to the basis elements of that vertex in the module. - OUTPUT: - - - :class:`QuiverRep` or tuple + OUTPUT: :class:`QuiverRep` or tuple .. NOTE:: @@ -2452,7 +2403,7 @@ def direct_sum(self, modules, return_maps=False): - ``modules`` -- :class:`QuiverRep` or list of :class:`QuiverRep`'s - - ``return_maps`` -- Boolean (default: ``False``); if ``False``, then + - ``return_maps`` -- boolean (default: ``False``); if ``False``, then the output is a single QuiverRep object which is the direct sum of ``self`` with the given module or modules. If ``True``, then the output is a list ``[sum, iota, pi]``. The first entry @@ -2463,9 +2414,7 @@ def direct_sum(self, modules, return_maps=False): The summands are ordered as given with ``self`` being the zeroth summand. - OUTPUT: - - - :class:`QuiverRep` or tuple + OUTPUT: :class:`QuiverRep` or tuple EXAMPLES:: @@ -2618,9 +2567,7 @@ def transpose(self): If `p^t` is the algebraic dual of `p` then define `\mbox{Tr} M = \mbox{coker} p^t`. - OUTPUT: - - - :class:`QuiverRep` + OUTPUT: :class:`QuiverRep` EXAMPLES:: @@ -2860,7 +2807,7 @@ def _left_edge_action(self, edge, element): - ``element`` -- :class:`QuiverRepElement`; an element of ``self`` - - ``edge`` -- An edge of the quiver (a tuple) or a list of edges in + - ``edge`` -- an edge of the quiver (a tuple) or a list of edges in the quiver. Such a list can be empty (in which case no action is performed) and can contain trivial paths (tuples of the form `(v, v)` where `v` is a vertex of the quiver) diff --git a/src/sage/sandpiles/examples.py b/src/sage/sandpiles/examples.py index 586c49608a1..2ce08e810fb 100644 --- a/src/sage/sandpiles/examples.py +++ b/src/sage/sandpiles/examples.py @@ -76,11 +76,9 @@ def Complete(self, n): INPUT: - - ``n`` -- positive integer + - ``n`` -- positive integer - OUTPUT: - - - Sandpile + OUTPUT: Sandpile EXAMPLES:: @@ -98,11 +96,9 @@ def Cycle(self, n): INPUT: - - ``n`` -- a non-negative integer - - OUTPUT: + - ``n`` -- nonnegative integer - - Sandpile + OUTPUT: Sandpile EXAMPLES:: @@ -123,13 +119,7 @@ def Diamond(self): """ Sandpile on the diamond graph. - INPUT: - - None - - OUTPUT: - - - Sandpile + OUTPUT: Sandpile EXAMPLES:: @@ -145,11 +135,9 @@ def Fan(self, n, deg_three_verts=False): INPUT: - - ``n`` -- a non-negative integer - - OUTPUT: + - ``n`` -- nonnegative integer - - Sandpile + OUTPUT: Sandpile EXAMPLES:: @@ -181,11 +169,9 @@ def Grid(self, m, n): INPUT: - - ``m``, ``n`` -- negative integers + - ``m``, ``n`` -- negative integers - OUTPUT: - - - Sandpile + OUTPUT: Sandpile EXAMPLES:: @@ -209,13 +195,7 @@ def House(self): """ Sandpile on the House graph. - INPUT: - - None - - OUTPUT: - - - Sandpile + OUTPUT: Sandpile EXAMPLES:: @@ -231,11 +211,9 @@ def Wheel(self, n): INPUT: - - ``n`` -- a non-negative integer - - OUTPUT: + - ``n`` -- nonnegative integer - - Sandpile + OUTPUT: Sandpile EXAMPLES:: diff --git a/src/sage/sandpiles/sandpile.py b/src/sage/sandpiles/sandpile.py index 50bbb2f815c..84692af6edc 100644 --- a/src/sage/sandpiles/sandpile.py +++ b/src/sage/sandpiles/sandpile.py @@ -363,7 +363,7 @@ def _sandpile_help(cls, usage, verbose=True): """ - Prints help text for classes in this module; see the ``help()`` methods on + Print help text for classes in this module; see the ``help()`` methods on individual classes in this module for example usage. """ @@ -417,7 +417,6 @@ def version(): OUTPUT: string - EXAMPLES:: sage: Sandpile.version() @@ -436,7 +435,7 @@ def help(verbose=True): INPUT: - - ``verbose`` -- (default: ``True``) boolean + - ``verbose`` -- boolean (default: ``True``) OUTPUT: printed string @@ -513,8 +512,8 @@ def __init__(self, g, sink=None): INPUT: - - ``g`` -- dict for directed multigraph with edges weighted by - nonnegative integers (see NOTE), a Graph or DiGraph. + - ``g`` -- dictionary for directed multigraph with edges weighted by + nonnegative integers (see NOTE), a Graph or DiGraph - ``sink`` -- (optional) A sink vertex. Any outgoing edges from the designated sink are ignored for the purposes of stabilization. It is @@ -765,7 +764,7 @@ def __str__(self) -> str: def _repr_(self): r""" - String representation of self. + String representation of ``self``. EXAMPLES:: @@ -821,7 +820,7 @@ def dict(self): r""" A dictionary of dictionaries representing a directed graph. - OUTPUT: dict + OUTPUT: dictionary EXAMPLES:: @@ -935,10 +934,7 @@ def max_stable(self): r""" The maximal stable configuration. - OUTPUT: - - SandpileConfig (the maximal stable configuration) - + OUTPUT: SandpileConfig (the maximal stable configuration) EXAMPLES:: @@ -1149,7 +1145,7 @@ def burning_script(self): r""" A script for the minimal burning configuration. - OUTPUT: dict + OUTPUT: dictionary EXAMPLES:: @@ -1255,7 +1251,7 @@ def zero_config(self): def _set_identity(self): r""" - Computes ``_identity``, the variable holding the identity configuration + Compute ``_identity``, the variable holding the identity configuration of the sandpile group, when ``identity()`` is first called by a user. EXAMPLES:: @@ -1271,16 +1267,13 @@ def _set_identity(self): def identity(self, verbose=True): r""" The identity configuration. If ``verbose`` is ``False``, the - configuration are converted to a list of integers. + configuration is converted to a list of integers. INPUT: - - ``verbose`` -- (default: ``True``) boolean - - OUTPUT: + - ``verbose`` -- boolean (default: ``True``) - SandpileConfig or a list of integers If ``verbose`` is ``False``, the - configuration are converted to a list of integers. + OUTPUT: SandpileConfig or a list of integers EXAMPLES:: @@ -1299,7 +1292,7 @@ def identity(self, verbose=True): def _set_recurrents(self): """ - Computes ``_recurrents``, the variable holding the list of recurrent + Compute ``_recurrents``, the variable holding the list of recurrent configurations, when ``recurrents()`` is first called by a user. EXAMPLES:: @@ -1338,11 +1331,10 @@ def recurrents(self, verbose=True): INPUT: - - ``verbose`` -- (default: ``True``) boolean + - ``verbose`` -- boolean (default: ``True``) OUTPUT: list of recurrent configurations - EXAMPLES:: sage: r = Sandpile(graphs.HouseXGraph(),0).recurrents() @@ -1375,7 +1367,7 @@ def recurrents(self, verbose=True): def _set_superstables(self): r""" - Computes ``_superstables``, the variable holding the list of superstable + Compute ``_superstables``, the variable holding the list of superstable configurations, when ``superstables()`` is first called by a user. EXAMPLES:: @@ -1395,11 +1387,10 @@ def superstables(self, verbose=True): INPUT: - - ``verbose`` -- (default: ``True``) boolean + - ``verbose`` -- boolean (default: ``True``) OUTPUT: list of SandpileConfig - EXAMPLES:: sage: sp = Sandpile(graphs.HouseXGraph(),0).superstables() @@ -1453,7 +1444,7 @@ def group_gens(self, verbose=True): INPUT: - - ``verbose`` -- (default: ``True``) boolean + - ``verbose`` -- boolean (default: ``True``) OUTPUT: @@ -1517,7 +1508,7 @@ def is_undirected(self): def _set_min_recurrents(self): r""" - Computes the minimal recurrent elements. If the underlying graph is + Compute the minimal recurrent elements. If the underlying graph is undirected, these are the recurrent elements of least degree. EXAMPLES:: @@ -1546,7 +1537,7 @@ def min_recurrents(self, verbose=True): INPUT: - - ``verbose`` -- (default: ``True``) boolean + - ``verbose`` -- boolean (default: ``True``) OUTPUT: list of SandpileConfig @@ -1581,7 +1572,7 @@ def max_superstables(self, verbose=True): INPUT: - - ``verbose`` -- (default: ``True``) boolean + - ``verbose`` -- boolean (default: ``True``) OUTPUT: tuple of SandpileConfig @@ -1660,7 +1651,7 @@ def avalanche_polynomial(self, multivariable=True): INPUT: - - ``multivariable`` -- (default: ``True``) boolean + - ``multivariable`` -- boolean (default: ``True``) OUTPUT: polynomial @@ -1698,11 +1689,9 @@ def nonspecial_divisors(self, verbose=True): INPUT: - - ``verbose`` -- (default: ``True``) boolean - - OUTPUT: + - ``verbose`` -- boolean (default: ``True``) - list (of divisors) + OUTPUT: list (of divisors) EXAMPLES:: @@ -1766,7 +1755,7 @@ def canonical_divisor(self): def _set_invariant_factors(self): r""" - Computes the variable holding the elementary divisors of the sandpile + Compute the variable holding the elementary divisors of the sandpile group when ``invariant_factors()`` is first called by the user. EXAMPLES:: @@ -1797,7 +1786,7 @@ def invariant_factors(self): def _set_hilbert_function(self): """ - Computes the variables holding the Hilbert function of the homogeneous + Compute the variables holding the Hilbert function of the homogeneous homogeneous toppling ideal, the first differences of the Hilbert function, and the postulation number for the zero-set of the sandpile ideal when any one of these is called by the user. @@ -1985,11 +1974,9 @@ def jacobian_representatives(self, verbose=True): INPUT: - - ``verbose`` -- (default: ``True``) boolean + - ``verbose`` -- boolean (default: ``True``) - OUTPUT: - - list of SandpileDivisor (or of lists representing divisors) + OUTPUT: list of SandpileDivisor (or of lists representing divisors) EXAMPLES: @@ -2041,11 +2028,9 @@ def picard_representatives(self, d, verbose=True): - ``d`` -- integer - - ``verbose`` -- (default: ``True``) boolean + - ``verbose`` -- boolean (default: ``True``) - OUTPUT: - - list of SandpileDivisors (or lists representing divisors) + OUTPUT: slist of SandpileDivisors (or lists representing divisors) EXAMPLES:: @@ -2076,7 +2061,6 @@ def stable_configs(self, smax=None): - ``smax`` -- (optional) SandpileConfig or list representing a SandpileConfig - OUTPUT: generator for all stable configurations EXAMPLES:: @@ -2109,13 +2093,13 @@ def markov_chain(self, state, distrib=None): INPUT: - - ``state`` -- SandpileConfig, SandpileDivisor, or list representing one of these + - ``state`` -- SandpileConfig, SandpileDivisor, or list representing + one of these - - ``distrib`` -- (optional) list of nonnegative numbers summing to 1 (representing a prob. dist.) - - OUTPUT: + - ``distrib`` -- (optional) list of nonnegative numbers summing to 1 + (representing a prob. dist.) - generator for Markov chain (see NOTE) + OUTPUT: generator for Markov chain (see NOTE) EXAMPLES:: @@ -2342,10 +2326,7 @@ def betti_complexes(self): r""" The support-complexes with non-trivial homology. (See NOTE.) - OUTPUT: - - list (of pairs [divisors, corresponding simplicial complex]) - + OUTPUT: list (of pairs [divisors, corresponding simplicial complex]) EXAMPLES:: @@ -2466,7 +2447,7 @@ def ideal(self, gens=False): INPUT: - - ``gens`` -- (default: ``False``) boolean + - ``gens`` -- boolean (default: ``False``) OUTPUT: ideal or, optionally, the generators of an ideal @@ -2554,7 +2535,7 @@ def resolution(self, verbose=False): INPUT: - - ``verbose`` -- (default: ``False``) boolean + - ``verbose`` -- boolean (default: ``False``) OUTPUT: free resolution of the toppling ideal @@ -2592,7 +2573,7 @@ def resolution(self, verbose=False): def _set_groebner(self): r""" - Computes a Groebner basis for the homogeneous toppling ideal with + Compute a Groebner basis for the homogeneous toppling ideal with respect to the standard sandpile ordering (see ``ring``). EXAMPLES:: @@ -2628,11 +2609,10 @@ def betti(self, verbose=True): INPUT: - - ``verbose`` -- (default: ``True``) boolean + - ``verbose`` -- boolean (default: ``True``) OUTPUT: Betti numbers for the sandpile - EXAMPLES:: sage: S = sandpiles.Diamond() @@ -2808,7 +2788,7 @@ def help(verbose=True): INPUT: - - ``verbose`` -- (default: ``True``) boolean + - ``verbose`` -- boolean (default: ``True``) OUTPUT: printed string @@ -2867,7 +2847,7 @@ def __init__(self, S, c): - ``S`` -- Sandpile - - ``c`` -- dict or list representing a configuration + - ``c`` -- dictionary or list representing a configuration OUTPUT: SandpileConfig @@ -2925,7 +2905,7 @@ def __setitem__(self, key, item): INPUT: - ``key``, ``item`` -- objects + - ``key``, ``item`` -- objects EXAMPLES:: @@ -3152,7 +3132,7 @@ def __rmul__(self, other): INPUT: - - ``other`` -- Integer + - ``other`` -- integer OUTPUT: SandpileConfig @@ -3503,7 +3483,7 @@ def fire_unstable(self): def _set_stabilize(self): r""" - Computes the stabilized configuration and its firing vector. + Compute the stabilized configuration and its firing vector. EXAMPLES:: @@ -3535,7 +3515,7 @@ def stabilize(self, with_firing_vector=False): INPUT: - - ``with_firing_vector`` -- (default: ``False``) boolean + - ``with_firing_vector`` -- boolean (default: ``False``) OUTPUT: ``SandpileConfig`` or ``[SandpileConfig, firing_vector]`` @@ -3581,9 +3561,7 @@ def support(self): r""" The vertices containing sand. - OUTPUT: - - list - support of the configuration + OUTPUT: list - support of the configuration EXAMPLES:: @@ -3703,7 +3681,7 @@ def order(self): def is_stable(self): r""" - Is the configuration stable? + Return whether this configuration is stable. OUTPUT: boolean @@ -3724,7 +3702,7 @@ def is_stable(self): def _set_equivalent_recurrent(self): r""" - Sets the equivalent recurrent configuration and the corresponding + Set the equivalent recurrent configuration and the corresponding firing vector. EXAMPLES:: @@ -3757,11 +3735,10 @@ def equivalent_recurrent(self, with_firing_vector=False): INPUT: - - ``with_firing_vector`` -- (default: ``False``) boolean + - ``with_firing_vector`` -- boolean (default: ``False``) OUTPUT: SandpileConfig or [SandpileConfig, firing_vector] - EXAMPLES:: sage: S = sandpiles.Diamond() @@ -3788,7 +3765,7 @@ def equivalent_recurrent(self, with_firing_vector=False): def _set_is_recurrent(self): r""" - Computes and stores whether the configuration is recurrent. + Compute and store whether the configuration is recurrent. EXAMPLES:: @@ -3810,7 +3787,7 @@ def _set_is_recurrent(self): def is_recurrent(self): r""" - Is the configuration recurrent? + Return whether the configuration is recurrent. OUTPUT: boolean @@ -3826,12 +3803,11 @@ def is_recurrent(self): def _set_equivalent_superstable(self): r""" - Sets the superstable configuration equivalent to the given + Set the superstable configuration equivalent to the given configuration and its corresponding firing vector. OUTPUT: [configuration, firing_vector] - EXAMPLES:: sage: S = sandpiles.Diamond() @@ -3850,11 +3826,10 @@ def equivalent_superstable(self, with_firing_vector=False): INPUT: - - ``with_firing_vector`` -- (default: ``False``) boolean + - ``with_firing_vector`` -- boolean (default: ``False``) OUTPUT: SandpileConfig or [SandpileConfig, firing_vector] - EXAMPLES:: sage: S = sandpiles.Diamond() @@ -3881,7 +3856,7 @@ def equivalent_superstable(self, with_firing_vector=False): def _set_is_superstable(self): r""" - Computes and stores whether ``config`` is superstable. + Compute and store whether ``config`` is superstable. OUTPUT: boolean @@ -3902,7 +3877,7 @@ def _set_is_superstable(self): def is_superstable(self): r""" - Is the configuration superstable? + Return whether the configuration is superstable. OUTPUT: boolean @@ -3922,7 +3897,7 @@ def is_symmetric(self, orbits) -> bool: INPUT: - - ``orbits`` -- list of lists of vertices + - ``orbits`` -- list of lists of vertices OUTPUT: boolean @@ -3982,11 +3957,13 @@ def show(self, sink=True, colors=True, heights=False, directed=None, **kwds): INPUT: - - ``sink`` -- (default: ``True``) whether to show the sink + - ``sink`` -- boolean (default: ``True``); whether to show the sink - - ``colors`` -- (default: ``True``) whether to color-code the amount of sand on each vertex + - ``colors`` -- boolean (default: ``True``); whether to color-code the + amount of sand on each vertex - - ``heights`` -- (default: ``False``) whether to label each vertex with the amount of sand + - ``heights`` -- boolean (default: ``False``); whether to label each + vertex with the amount of sand - ``directed`` -- (optional) whether to draw directed edges @@ -4059,7 +4036,7 @@ def help(verbose=True): INPUT: - - ``verbose`` -- (default: ``True``) boolean + - ``verbose`` -- boolean (default: ``True``) OUTPUT: printed string @@ -4113,7 +4090,7 @@ def __init__(self, S, D): - ``S`` -- Sandpile - - ``D`` -- dict or list representing a divisor + - ``D`` -- dictionary or list representing a divisor OUTPUT: SandpileDivisor @@ -4166,7 +4143,7 @@ def __setitem__(self, key, item): INPUT: - ``key``, ``item`` -- objects + - ``key``, ``item`` -- objects EXAMPLES:: @@ -4336,7 +4313,7 @@ def __rmul__(self, other): INPUT: - - ``other`` -- Integer + - ``other`` -- integer OUTPUT: SandpileDivisor @@ -4723,7 +4700,7 @@ def q_reduced(self, verbose=True): INPUT: - - ``verbose`` -- (default: ``True``) boolean + - ``verbose`` -- boolean (default: ``True``) OUTPUT: SandpileDivisor or list representing SandpileDivisor @@ -4793,7 +4770,7 @@ def is_linearly_equivalent(self, D, with_firing_vector=False): - ``D`` -- SandpileDivisor or list, tuple, etc. representing a divisor - - ``with_firing_vector`` -- (default: ``False``) boolean + - ``with_firing_vector`` -- boolean (default: ``False``) OUTPUT: boolean or integer vector @@ -4893,11 +4870,11 @@ def simulate_threshold(self, distrib=None): def _set_linear_system(self): r""" - Computes and stores the complete linear system of a divisor. + Compute and store the complete linear system of a divisor. OUTPUT: - dict - ``{num_homog: int, homog:list, num_inhomog:int, inhomog:list}`` + dictionary; ``{num_homog: int, homog:list, num_inhomog:int, inhomog:list}`` EXAMPLES:: @@ -5103,13 +5080,11 @@ def effective_div(self, verbose=True, with_firing_vectors=False): INPUT: - - ``verbose`` -- (default: ``True``) boolean + - ``verbose`` -- boolean (default: ``True``) - - ``with_firing_vectors`` -- (default: ``False``) boolean + - ``with_firing_vectors`` -- boolean (default: ``False``) - OUTPUT: - - list (of divisors) + OUTPUT: list (of divisors) EXAMPLES:: @@ -5176,7 +5151,7 @@ def _set_rank(self, set_witness=False): INPUT: - - ``verbose`` -- (default: ``False``) boolean + - ``verbose`` -- boolean (default: ``False``) EXAMPLES:: @@ -5247,11 +5222,9 @@ def rank(self, with_witness=False): INPUT: - - ``with_witness`` -- (default: ``False``) boolean + - ``with_witness`` -- boolean (default: ``False``) - OUTPUT: - - integer or (integer, SandpileDivisor) + OUTPUT: integer or (integer, SandpileDivisor) EXAMPLES:: @@ -5307,12 +5280,12 @@ def rank(self, with_witness=False): def _set_r_of_D(self, verbose=False): r""" - Computes `r(D)` and an effective divisor `F` such that `|D - F|` is + Compute `r(D)` and an effective divisor `F` such that `|D - F|` is empty. INPUT: - - ``verbose`` -- (default: ``False``) boolean + - ``verbose`` -- boolean (default: ``False``) EXAMPLES:: @@ -5401,11 +5374,9 @@ def weierstrass_gap_seq(self, v='sink', weight=True): - ``v`` -- (default: ``sink``) vertex - - ``weight`` -- (default: ``True``) boolean - - OUTPUT: + - ``weight`` -- boolean (default: ``True``) - list or (list of list) of integers + OUTPUT: list or (list of list) of integers EXAMPLES:: @@ -5440,7 +5411,7 @@ def weierstrass_gap_seq(self, v='sink', weight=True): def is_weierstrass_pt(self, v='sink'): r""" - Is the given vertex a Weierstrass point? + Return whether the given vertex is a Weierstrass point. INPUT: @@ -5487,15 +5458,14 @@ def _set_weierstrass_pts(self): def weierstrass_pts(self, with_rank_seq=False): r""" - The Weierstrass points (vertices). Optionally, return the corresponding rank sequences. + The Weierstrass points (vertices). Optionally, return the corresponding + rank sequences. INPUT: - - ``with_rank_seq`` -- (default: ``False``) boolean - - OUTPUT: + - ``with_rank_seq`` -- boolean (default: ``False``) - tuple of vertices or list of (vertex, rank sequence) + OUTPUT: tuple of vertices or list of (vertex, rank sequence) EXAMPLES:: @@ -5525,7 +5495,7 @@ def weierstrass_div(self, verbose=True): INPUT: - - ``verbose`` -- (default: ``True``) boolean + - ``verbose`` -- boolean (default: ``True``) OUTPUT: SandpileDivisor @@ -5572,7 +5542,7 @@ def support(self): def _set_Dcomplex(self): r""" - Computes the simplicial complex determined by the supports of the + Compute the simplicial complex determined by the supports of the linearly equivalent effective divisors. EXAMPLES:: @@ -5748,7 +5718,7 @@ def is_alive(self, cycle=False): INPUT: - - ``cycle`` -- (default: ``False``) boolean + - ``cycle`` -- boolean (default: ``False``) OUTPUT: boolean or optionally, a list of SandpileDivisors @@ -5794,7 +5764,7 @@ def stabilize(self, with_firing_vector=False): INPUT: - - ``with_firing_vector`` -- (default: ``False``) boolean + - ``with_firing_vector`` -- boolean (default: ``False``) EXAMPLES:: @@ -5815,7 +5785,8 @@ def show(self, heights=True, directed=None, **kwds): INPUT: - - ``heights`` -- (default: ``True``) whether to label each vertex with the amount of sand + - ``heights`` -- boolean (default: ``True``); whether to label each + vertex with the amount of sand - ``directed`` -- (optional) whether to draw directed edges @@ -5852,14 +5823,14 @@ def show(self, heights=True, directed=None, **kwds): def sandlib(selector=None): r""" - Returns the sandpile identified by ``selector``. If no argument is + Return the sandpile identified by ``selector``. If no argument is given, a description of the sandpiles in the sandlib is printed. INPUT: - ``selector`` -- (optional) identifier or None - OUTPUT: sandpile or description + OUTPUT: Sandpile or description EXAMPLES:: @@ -6034,13 +6005,12 @@ def glue_graphs(g, h, glue_g, glue_h): INPUT: - - ``g``, ``h`` -- dictionaries for directed multigraphs + - ``g``, ``h`` -- dictionaries for directed multigraphs - - ``glue_h``, ``glue_g`` -- dictionaries for a vertex + - ``glue_h``, ``glue_g`` -- dictionaries for a vertex OUTPUT: dictionary for a directed multigraph - EXAMPLES:: sage: from sage.sandpiles.sandpile import glue_graphs @@ -6115,7 +6085,7 @@ def glue_graphs(g, h, glue_g, glue_h): def firing_graph(S, eff): r""" - Creates a digraph with divisors as vertices and edges between two divisors + Create a digraph with divisors as vertices and edges between two divisors `D` and `E` if firing a single vertex in `D` gives `E`. INPUT: @@ -6150,7 +6120,7 @@ def firing_graph(S, eff): def parallel_firing_graph(S, eff): r""" - Creates a digraph with divisors as vertices and edges between two divisors + Create a digraph with divisors as vertices and edges between two divisors `D` and `E` if firing all unstable vertices in `D` gives `E`. INPUT: @@ -6308,16 +6278,14 @@ def min_cycles(G, v): def wilmes_algorithm(M): r""" - Computes an integer matrix `L` with the same integer row span as `M` and + Compute an integer matrix `L` with the same integer row span as `M` and such that `L` is the reduced Laplacian of a directed multigraph. INPUT: - ``M`` -- square integer matrix of full rank - OUTPUT: - - integer matrix (``L``) + OUTPUT: integer matrix (``L``) EXAMPLES:: diff --git a/src/sage/sat/boolean_polynomials.py b/src/sage/sat/boolean_polynomials.py index 0d1bbe4c7cd..c278fe640a3 100644 --- a/src/sage/sat/boolean_polynomials.py +++ b/src/sage/sat/boolean_polynomials.py @@ -50,7 +50,7 @@ def solve(F, converter=None, solver=None, n=1, target_variables=None, **kwds): ``None`` then :class:`sage.sat.solvers.cryptominisat.CryptoMiniSat` is used to construct a new converter. (default: ``None``) - - ``target_variables`` -- a list of variables. The elements of the list are + - ``target_variables`` -- list of variables. The elements of the list are used to exclude a particular combination of variable assignments of a solution from any further solution. Furthermore ``target_variables`` denotes which variable-value pairs appear in the solutions. If @@ -59,7 +59,7 @@ def solve(F, converter=None, solver=None, n=1, target_variables=None, **kwds): (default: ``None``) - ``**kwds`` -- parameters can be passed to the converter and the - solver by prefixing them with ``c_`` and ``s_`` respectively. For + solver by prefixing them with ``c_`` and ``s_`` respectively. For example, to increase CryptoMiniSat's verbosity level, pass ``s_verbosity=1``. diff --git a/src/sage/sat/converters/polybori.py b/src/sage/sat/converters/polybori.py index f9d63fc7baf..245ab2e8539 100644 --- a/src/sage/sat/converters/polybori.py +++ b/src/sage/sat/converters/polybori.py @@ -257,7 +257,6 @@ def clauses_sparse(self, f): - ``f`` -- a :class:`sage.rings.polynomial.pbori.BooleanPolynomial` - EXAMPLES:: sage: B. = BooleanPolynomialRing() @@ -347,11 +346,11 @@ def clauses_dense(self, f): @cached_method def monomial(self, m): """ - Return SAT variable for ``m`` + Return SAT variable for ``m``. INPUT: - - ``m`` -- a monomial. + - ``m`` -- a monomial OUTPUT: an index for a SAT variable corresponding to ``m`` @@ -443,7 +442,7 @@ def split_xor(self, monomial_list, equal_zero): INPUT: - - ``monomial_list`` -- a list of monomials + - ``monomial_list`` -- list of monomials - ``equal_zero`` -- is the constant coefficient zero? EXAMPLES:: @@ -545,7 +544,6 @@ def __call__(self, F): OUTPUT: an inverse map int -> variable - EXAMPLES:: sage: B. = BooleanPolynomialRing() @@ -582,7 +580,7 @@ def __call__(self, F): def to_polynomial(self, c): """ - Convert clause to :class:`sage.rings.polynomial.pbori.BooleanPolynomial` + Convert clause to :class:`sage.rings.polynomial.pbori.BooleanPolynomial`. INPUT: diff --git a/src/sage/sat/solvers/cryptominisat.py b/src/sage/sat/solvers/cryptominisat.py index 27955c43eef..ec535138486 100644 --- a/src/sage/sat/solvers/cryptominisat.py +++ b/src/sage/sat/solvers/cryptominisat.py @@ -33,12 +33,12 @@ class CryptoMiniSat(SatSolver): INPUT: - - ``verbosity`` -- an integer between 0 and 15 (default: 0). Verbosity. + - ``verbosity`` -- integer between 0 and 15 (default: 0); verbosity - - ``confl_limit`` -- an integer (default: ``None``). Abort after this many + - ``confl_limit`` -- integer (default: ``None``); abort after this many conflicts. If set to ``None``, never aborts. - - ``threads`` -- an integer (default: None). The number of thread to + - ``threads`` -- integer (default: ``None``); the number of thread to use. If set to ``None``, the number of threads used corresponds to the number of cpus. @@ -74,7 +74,7 @@ def var(self, decision=None): INPUT: - - ``decision`` -- accepted for compatibility with other solvers, ignored. + - ``decision`` -- accepted for compatibility with other solvers; ignored EXAMPLES:: @@ -119,7 +119,7 @@ def add_clause(self, lits): INPUT: - - ``lits`` -- a tuple of nonzero integers. + - ``lits`` -- tuple of nonzero integers .. note:: @@ -147,10 +147,10 @@ def add_xor_clause(self, lits, rhs=True): INPUT: - - ``lits`` -- a tuple of positive integers. + - ``lits`` -- tuple of positive integers - - ``rhs`` -- boolean (default: ``True``). Whether this XOR clause should - be evaluated to ``True`` or ``False``. + - ``rhs`` -- boolean (default: ``True``); whether this XOR clause should + be evaluated to ``True`` or ``False`` EXAMPLES:: diff --git a/src/sage/sat/solvers/dimacs.py b/src/sage/sat/solvers/dimacs.py index aafccfab48b..288451fb5e8 100644 --- a/src/sage/sat/solvers/dimacs.py +++ b/src/sage/sat/solvers/dimacs.py @@ -73,8 +73,7 @@ def __init__(self, command=None, filename=None, verbosity=0, **kwds): - ``verbosity`` -- a verbosity level, where zero means silent and anything else means verbose output. (default: ``0``) - - ``**kwds`` -- accepted for compatibility with other solves, - ignored. + - ``**kwds`` -- accepted for compatibility with other solvers; ignored TESTS:: @@ -126,7 +125,7 @@ def var(self, decision=None): INPUT: - - ``decision`` -- accepted for compatibility with other solvers, ignored. + - ``decision`` -- accepted for compatibility with other solvers; ignored EXAMPLES:: @@ -161,7 +160,7 @@ def add_clause(self, lits): INPUT: - - ``lits`` -- a tuple of integers != 0 + - ``lits`` -- tuple of integers (``!= 0``) .. note:: @@ -304,7 +303,7 @@ def render_dimacs(clauses, filename, nlits): INPUT: - - ``clauses`` -- a list of clauses, either in simple format as a list of + - ``clauses`` -- list of clauses, either in simple format as a list of literals or in extended format for CryptoMiniSat: a tuple of literals, ``is_xor`` and ``rhs``. @@ -498,7 +497,6 @@ def __call__(self, assumptions=None): ....: except ZeroDivisionError: ....: pass sage: solve_sat(F, solver=sage.sat.solvers.RSat) # optional - rsat, needs sage.rings.finite_rings sage.rings.polynomial.pbori - """ if assumptions is not None: raise NotImplementedError("Assumptions are not supported for DIMACS based solvers.") @@ -554,7 +552,6 @@ class RSat(DIMACS): sage: solver.add_clause((-1,-2)) sage: solver() # optional - rsat False - """ command = "rsat {input} -v -s" @@ -620,7 +617,6 @@ class Glucose(DIMACS): c... s SATISFIABLE v -1 -2 ... 100 0 - """ command = "glucose -verb=0 -model {input}" @@ -684,13 +680,12 @@ class GlucoseSyrup(DIMACS): c... s SATISFIABLE v -1 -2 ... 100 0 - """ command = "glucose-syrup -model -verb=0 {input}" class Kissat(DIMACS): """ - An instance of the Kissat SAT solver + An instance of the Kissat SAT solver. For information on Kissat see: http://fmv.jku.at/kissat/ @@ -748,7 +743,6 @@ class Kissat(DIMACS): v ... v ... v ... 100 0 - """ command = "kissat -q {input}" diff --git a/src/sage/sat/solvers/picosat.py b/src/sage/sat/solvers/picosat.py index a88f69da883..598fc00f4fc 100644 --- a/src/sage/sat/solvers/picosat.py +++ b/src/sage/sat/solvers/picosat.py @@ -32,9 +32,9 @@ class PicoSAT(SatSolver): INPUT: - - ``verbosity`` -- an integer between 0 and 2 (default: 0); verbosity + - ``verbosity`` -- integer between 0 and 2 (default: 0); verbosity - - ``prop_limit`` -- an integer (default: 0); the propagation limit + - ``prop_limit`` -- integer (default: 0); the propagation limit EXAMPLES:: @@ -112,7 +112,7 @@ def add_clause(self, lits): INPUT: - - ``lits`` -- a tuple of nonzero integers + - ``lits`` -- tuple of nonzero integers .. NOTE:: diff --git a/src/sage/sat/solvers/sat_lp.py b/src/sage/sat/solvers/sat_lp.py index de9f8b082c7..059eba3f5af 100644 --- a/src/sage/sat/solvers/sat_lp.py +++ b/src/sage/sat/solvers/sat_lp.py @@ -13,11 +13,11 @@ class SatLP(SatSolver): def __init__(self, solver=None, verbose=0, *, integrality_tolerance=1e-3): r""" - Initializes the instance + Initialize the instance. INPUT: - - ``solver`` -- (default: ``None``) Specify a Mixed Integer Linear Programming + - ``solver`` -- (default: ``None``) specify a Mixed Integer Linear Programming (MILP) solver to be used. If set to ``None``, the default one is used. For more information on MILP solvers and which default solver is used, see the method @@ -25,15 +25,15 @@ def __init__(self, solver=None, verbose=0, *, integrality_tolerance=1e-3): of the class :class:`MixedIntegerLinearProgram `. - - ``verbose`` -- integer (default: ``0``). Sets the level of verbosity + - ``verbose`` -- integer (default: 0); sets the level of verbosity of the LP solver. Set to 0 by default, which means quiet. - ``integrality_tolerance`` -- parameter for use with MILP solvers over an - inexact base ring; see :meth:`MixedIntegerLinearProgram.get_values`. + inexact base ring; see :meth:`MixedIntegerLinearProgram.get_values` EXAMPLES:: - sage: S=SAT(solver="LP"); S + sage: S=SAT(solver='LP'); S an ILP-based SAT Solver """ SatSolver.__init__(self) @@ -48,7 +48,7 @@ def var(self): EXAMPLES:: - sage: S=SAT(solver="LP"); S + sage: S=SAT(solver='LP'); S an ILP-based SAT Solver sage: S.var() 1 @@ -65,7 +65,7 @@ def nvars(self): EXAMPLES:: - sage: S=SAT(solver="LP"); S + sage: S=SAT(solver='LP'); S an ILP-based SAT Solver sage: S.var() 1 @@ -82,7 +82,7 @@ def add_clause(self, lits): INPUT: - - ``lits`` -- a tuple of integers != 0 + - ``lits`` -- tuple of integers (``!= 0``) .. note:: @@ -92,7 +92,7 @@ def add_clause(self, lits): EXAMPLES:: - sage: S=SAT(solver="LP"); S + sage: S=SAT(solver='LP'); S an ILP-based SAT Solver sage: for u,v in graphs.CycleGraph(6).edges(sort=False, labels=False): ....: u,v = u+1,v+1 @@ -120,7 +120,7 @@ def __call__(self): EXAMPLES:: sage: def is_bipartite_SAT(G): - ....: S=SAT(solver="LP"); S + ....: S=SAT(solver='LP'); S ....: for u,v in G.edges(sort=False, labels=False): ....: u,v = u+1,v+1 ....: S.add_clause((u,v)) @@ -148,7 +148,7 @@ def __repr__(self): """ TESTS:: - sage: S=SAT(solver="LP"); S + sage: S=SAT(solver='LP'); S an ILP-based SAT Solver """ return "an ILP-based SAT Solver" diff --git a/src/sage/sat/solvers/satsolver.pyx b/src/sage/sat/solvers/satsolver.pyx index 7b63a1ee87d..0c6d23474a4 100644 --- a/src/sage/sat/solvers/satsolver.pyx +++ b/src/sage/sat/solvers/satsolver.pyx @@ -67,7 +67,7 @@ cdef class SatSolver: INPUT: - - ``lits`` -- a tuple of integers != 0 + - ``lits`` -- tuple of integers (``!= 0``) .. NOTE:: @@ -111,7 +111,7 @@ cdef class SatSolver: INPUT: - - ``filename`` -- The name of a file as a string or a file object + - ``filename`` -- the name of a file as a string or a file object EXAMPLES:: @@ -269,7 +269,6 @@ cdef class SatSolver: If ``filename`` points to a writable file, then the list of original clauses is written to that file in DIMACS format. - EXAMPLES:: sage: from sage.sat.solvers.satsolver import SatSolver @@ -320,58 +319,58 @@ def SAT(solver=None, *args, **kwds): INPUT: - - ``solver`` (string) -- select a solver. Admissible values are: + - ``solver`` -- string; select a solver. Admissible values are: - - ``"cryptominisat"`` -- note that the pycryptosat package must be - installed. + - ``'cryptominisat'`` -- note that the pycryptosat package must be + installed - - ``"picosat"`` -- note that the pycosat package must be installed. + - ``'picosat'`` -- note that the pycosat package must be installed - - ``"glucose"`` -- note that the glucose package must be installed. + - ``'glucose'`` -- note that the glucose package must be installed - - ``"glucose-syrup"`` -- note that the glucose package must be installed. + - ``'glucose-syrup'`` -- note that the glucose package must be installed - - ``"LP"`` -- use :class:`~sage.sat.solvers.sat_lp.SatLP` to solve the - SAT instance. + - ``'LP'`` -- use :class:`~sage.sat.solvers.sat_lp.SatLP` to solve the + SAT instance - - ``None`` (default) -- use CryptoMiniSat if available, else PicoSAT if - available, and a LP solver otherwise. + - ``None`` -- default; use CryptoMiniSat if available, else PicoSAT if + available, and a LP solver otherwise EXAMPLES:: - sage: SAT(solver="LP") # needs sage.numerical.mip + sage: SAT(solver='LP') # needs sage.numerical.mip an ILP-based SAT Solver TESTS:: - sage: SAT(solver="Wouhouuuuuu") + sage: SAT(solver='Wouhouuuuuu') Traceback (most recent call last): ... ValueError: Solver 'Wouhouuuuuu' is not available Forcing CryptoMiniSat:: - sage: SAT(solver="cryptominisat") # optional - pycryptosat + sage: SAT(solver='cryptominisat') # optional - pycryptosat CryptoMiniSat solver: 0 variables, 0 clauses. Forcing PicoSat:: - sage: SAT(solver="picosat") # optional - pycosat + sage: SAT(solver='picosat') # optional - pycosat PicoSAT solver: 0 variables, 0 clauses. Forcing Glucose:: - sage: SAT(solver="glucose") + sage: SAT(solver='glucose') DIMACS Solver: 'glucose -verb=0 -model {input}' Forcing Glucose Syrup:: - sage: SAT(solver="glucose-syrup") + sage: SAT(solver='glucose-syrup') DIMACS Solver: 'glucose-syrup -model -verb=0 {input}' Forcing Kissat:: - sage: SAT(solver="kissat") + sage: SAT(solver='kissat') DIMACS Solver: 'kissat -q {input}' """ if solver is None: diff --git a/src/sage/stats/basic_stats.py b/src/sage/stats/basic_stats.py index b2e6b301bf7..2e161e8578d 100644 --- a/src/sage/stats/basic_stats.py +++ b/src/sage/stats/basic_stats.py @@ -60,11 +60,9 @@ def mean(v): INPUT: - - ``v`` -- a list of numbers + - ``v`` -- list of numbers - OUTPUT: - - - a number + OUTPUT: a number EXAMPLES:: @@ -116,11 +114,9 @@ def mode(v): INPUT: - - ``v`` -- a list - - OUTPUT: + - ``v`` -- list - - a list (sorted if possible) + OUTPUT: list (sorted if possible) EXAMPLES:: @@ -186,15 +182,13 @@ def std(v, bias=False): INPUT: - - ``v`` -- a list of numbers + - ``v`` -- list of numbers - - ``bias`` -- bool (default: ``False``); if ``False``, divide by + - ``bias`` -- boolean (default: ``False``); if ``False``, divide by ``len(v) - 1`` instead of ``len(v)`` to give a less biased estimator (sample) for the standard deviation. - OUTPUT: - - - a number + OUTPUT: a number EXAMPLES:: @@ -274,15 +268,13 @@ def variance(v, bias=False): INPUT: - - ``v`` -- a list of numbers + - ``v`` -- list of numbers - - ``bias`` -- bool (default: ``False``); if ``False``, divide by + - ``bias`` -- boolean (default: ``False``); if ``False``, divide by ``len(v) - 1`` instead of ``len(v)`` to give a less biased estimator (sample) for the standard deviation. - OUTPUT: - - - a number + OUTPUT: a number EXAMPLES:: @@ -372,7 +364,7 @@ def variance(v, bias=False): def median(v): """ - Return the median (middle value) of the elements of `v` + Return the median (middle value) of the elements of `v`. If `v` is empty, we define the median to be NaN, which is consistent with NumPy (note that R returns NULL). @@ -384,11 +376,9 @@ def median(v): INPUT: - - ``v`` -- a list + - ``v`` -- list - OUTPUT: - - - median element of `v` + OUTPUT: median element of `v` EXAMPLES:: @@ -439,13 +429,11 @@ def moving_average(v, n): INPUT: - - ``v`` -- a list - - - ``n`` -- the number of values used in computing each average. + - ``v`` -- list - OUTPUT: + - ``n`` -- the number of values used in computing each average - - a list of length ``len(v)-n+1``, since we do not fabric any values + OUTPUT: list of length ``len(v)-n+1``, since we do not fabric any values EXAMPLES:: @@ -473,7 +461,6 @@ def moving_average(v, n): [2.0000, 3.0000, 4.0000, 5.0000, 6.0000, 7.0000, 8.0000, 9.0000] sage: stats.moving_average(list(a), 3) # needs numpy [2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0] - """ deprecation(29662, 'sage.stats.basic_stats.moving_average is deprecated; use pandas.Series.rolling instead') diff --git a/src/sage/stats/distributions/dgs_gauss.h b/src/sage/stats/distributions/dgs_gauss.h index 6353d5f52eb..f93bdf3bee1 100644 --- a/src/sage/stats/distributions/dgs_gauss.h +++ b/src/sage/stats/distributions/dgs_gauss.h @@ -36,7 +36,7 @@ - ``mp`` -- multi-precision using MPFR, cf. ``dgs_gauss_mp.c`` - - ``dp`` -- double precision using machine doubles, cf. ``dgs_gauss_dp.c``. + - ``dp`` -- double precision using machine doubles, cf. ``dgs_gauss_dp.c`` For readers unfamiliar with the implemented algorithms it makes sense to start with ``dgs_gauss_dp.c`` which implements the same algorithms as diff --git a/src/sage/stats/distributions/discrete_gaussian_integer.pyx b/src/sage/stats/distributions/discrete_gaussian_integer.pyx index e74b3e8e741..4fd8d24b1f4 100644 --- a/src/sage/stats/distributions/discrete_gaussian_integer.pyx +++ b/src/sage/stats/distributions/discrete_gaussian_integer.pyx @@ -162,7 +162,7 @@ cdef class DiscreteGaussianDistributionIntegerSampler(SageObject): # We use tables for σt ≤ table_cutoff table_cutoff = 10**6 - def __init__(self, sigma, c=0, tau=6, algorithm=None, precision="mp"): + def __init__(self, sigma, c=0, tau=6, algorithm=None, precision='mp'): r""" Construct a new sampler for a discrete Gaussian distribution. @@ -179,34 +179,34 @@ cdef class DiscreteGaussianDistributionIntegerSampler(SageObject): considered to have probability zero. This bound applies to algorithms which sample from the uniform distribution (default: ``6``) - - ``algorithm`` -- see list below (default: ``"uniform+table"`` for + - ``algorithm`` -- see list below (default: ``'uniform+table'`` for `σt` bounded by ``DiscreteGaussianDistributionIntegerSampler.table_cutoff`` and - ``"uniform+online"`` for bigger `στ`) + ``'uniform+online'`` for bigger `στ`) - - ``precision`` -- either ``"mp"`` for multi-precision where the actual - precision used is taken from sigma or ``"dp"`` for double precision. In - the latter case results are not reproducible. (default: ``"mp"``) + - ``precision`` -- either ``'mp'`` for multi-precision where the actual + precision used is taken from sigma or ``'dp'`` for double precision. In + the latter case results are not reproducible. (default: ``'mp'``) ALGORITHMS: - - ``"uniform+table"`` -- classical rejection sampling, sampling from the + - ``'uniform+table'`` -- classical rejection sampling, sampling from the uniform distribution and accepted with probability proportional to `\exp(-(x-c)²/(2σ²))` where `\exp(-(x-c)²/(2σ²))` is precomputed and stored in a table. Any real-valued `c` is supported. - - ``"uniform+logtable"`` -- samples are drawn from a uniform distribution and + - ``'uniform+logtable'`` -- samples are drawn from a uniform distribution and accepted with probability proportional to `\exp(-(x-c)²/(2σ²))` where `\exp(-(x-c)²/(2σ²))` is computed using logarithmically many calls to Bernoulli distributions. See [DDLL2013]_ for details. Only integer-valued `c` are supported. - - ``"uniform+online"`` -- samples are drawn from a uniform distribution and + - ``'uniform+online'`` -- samples are drawn from a uniform distribution and accepted with probability proportional to `\exp(-(x-c)²/(2σ²))` where `\exp(-(x-c)²/(2σ²))` is computed in each invocation. Typically this is very slow. See [DDLL2013]_ for details. Any real-valued `c` is accepted. - - ``"sigma2+logtable"`` -- samples are drawn from an easily samplable + - ``'sigma2+logtable'`` -- samples are drawn from an easily samplable distribution with `σ = k·σ_2` with `σ_2 = \sqrt{1/(2\log 2)}` and accepted with probability proportional to `\exp(-(x-c)²/(2σ²))` where `\exp(-(x-c)²/(2σ²))` is computed using logarithmically many calls to Bernoulli @@ -217,16 +217,16 @@ cdef class DiscreteGaussianDistributionIntegerSampler(SageObject): EXAMPLES:: sage: from sage.stats.distributions.discrete_gaussian_integer import DiscreteGaussianDistributionIntegerSampler - sage: DiscreteGaussianDistributionIntegerSampler(3.0, algorithm="uniform+online") + sage: DiscreteGaussianDistributionIntegerSampler(3.0, algorithm='uniform+online') Discrete Gaussian sampler over the Integers with sigma = 3.000000 and c = 0.000000 - sage: DiscreteGaussianDistributionIntegerSampler(3.0, algorithm="uniform+table") + sage: DiscreteGaussianDistributionIntegerSampler(3.0, algorithm='uniform+table') Discrete Gaussian sampler over the Integers with sigma = 3.000000 and c = 0.000000 - sage: DiscreteGaussianDistributionIntegerSampler(3.0, algorithm="uniform+logtable") + sage: DiscreteGaussianDistributionIntegerSampler(3.0, algorithm='uniform+logtable') Discrete Gaussian sampler over the Integers with sigma = 3.000000 and c = 0.000000 - Note that ``"sigma2+logtable"`` adjusts `σ`:: + Note that ``'sigma2+logtable'`` adjusts `σ`:: - sage: DiscreteGaussianDistributionIntegerSampler(3.0, algorithm="sigma2+logtable") + sage: DiscreteGaussianDistributionIntegerSampler(3.0, algorithm='sigma2+logtable') Discrete Gaussian sampler over the Integers with sigma = 3.397287 and c = 0.000000 TESTS: @@ -244,12 +244,12 @@ cdef class DiscreteGaussianDistributionIntegerSampler(SageObject): ... ValueError: tau must be >= 1 but got -1 - sage: DiscreteGaussianDistributionIntegerSampler(3.0, tau=2, algorithm="superfastalgorithmyouneverheardof") + sage: DiscreteGaussianDistributionIntegerSampler(3.0, tau=2, algorithm='superfastalgorithmyouneverheardof') Traceback (most recent call last): ... ValueError: Algorithm 'superfastalgorithmyouneverheardof' not supported by class 'DiscreteGaussianDistributionIntegerSampler' - sage: DiscreteGaussianDistributionIntegerSampler(3.0, c=1.5, algorithm="sigma2+logtable") + sage: DiscreteGaussianDistributionIntegerSampler(3.0, c=1.5, algorithm='sigma2+logtable') Traceback (most recent call last): ... ValueError: algorithm 'uniform+logtable' requires c%1 == 0 @@ -296,19 +296,19 @@ cdef class DiscreteGaussianDistributionIntegerSampler(SageObject): ....: n += 1 sage: from sage.stats.distributions.discrete_gaussian_integer import DiscreteGaussianDistributionIntegerSampler - sage: D = DiscreteGaussianDistributionIntegerSampler(1.0, c=0, tau=2, precision="dp") + sage: D = DiscreteGaussianDistributionIntegerSampler(1.0, c=0, tau=2, precision='dp') sage: mini = 1000; maxi = -1000; s = 0; n = 0 sage: add_samples(2^16) sage: while mini != 0 - 2*1.0 or maxi != 0 + 2*1.0 or abs(float(s)/n) >= 0.05: ....: add_samples(2^16) - sage: D = DiscreteGaussianDistributionIntegerSampler(1.0, c=2.5, tau=2, precision="dp") + sage: D = DiscreteGaussianDistributionIntegerSampler(1.0, c=2.5, tau=2, precision='dp') sage: mini = 1000; maxi = -1000; s = 0; n = 0 sage: add_samples(2^16) sage: while mini != 2 - 2*1.0 or maxi != 2 + 2*1.0 or abs(float(s)/n - 2.45) >= 0.01: ....: add_samples(2^16) - sage: D = DiscreteGaussianDistributionIntegerSampler(1.0, c=2.5, tau=6, precision="dp") + sage: D = DiscreteGaussianDistributionIntegerSampler(1.0, c=2.5, tau=6, precision='dp') sage: mini = 1000; maxi = -1000; s = 0; n = 0 sage: add_samples(2^16) sage: while mini > -1 or maxi < 6 or abs(float(s)/n - 2.5) >= 0.1: @@ -443,7 +443,7 @@ cdef class DiscreteGaussianDistributionIntegerSampler(SageObject): TESTS:: sage: from sage.stats.distributions.discrete_gaussian_integer import DiscreteGaussianDistributionIntegerSampler - sage: D = DiscreteGaussianDistributionIntegerSampler(3.0, algorithm="uniform+online") + sage: D = DiscreteGaussianDistributionIntegerSampler(3.0, algorithm='uniform+online') sage: del D """ if self._gen_mp: @@ -458,15 +458,15 @@ cdef class DiscreteGaussianDistributionIntegerSampler(SageObject): EXAMPLES:: sage: from sage.stats.distributions.discrete_gaussian_integer import DiscreteGaussianDistributionIntegerSampler - sage: DiscreteGaussianDistributionIntegerSampler(3.0, algorithm="uniform+online")() # random + sage: DiscreteGaussianDistributionIntegerSampler(3.0, algorithm='uniform+online')() # random -3 - sage: DiscreteGaussianDistributionIntegerSampler(3.0, algorithm="uniform+table")() # random + sage: DiscreteGaussianDistributionIntegerSampler(3.0, algorithm='uniform+table')() # random 3 TESTS:: sage: from sage.stats.distributions.discrete_gaussian_integer import DiscreteGaussianDistributionIntegerSampler - sage: DiscreteGaussianDistributionIntegerSampler(3.0, algorithm="uniform+logtable", precision="dp")() # random output + sage: DiscreteGaussianDistributionIntegerSampler(3.0, algorithm='uniform+logtable', precision='dp')() # random output 13 """ cdef randstate rstate diff --git a/src/sage/stats/distributions/discrete_gaussian_lattice.py b/src/sage/stats/distributions/discrete_gaussian_lattice.py index 428ca30855b..5f734677609 100644 --- a/src/sage/stats/distributions/discrete_gaussian_lattice.py +++ b/src/sage/stats/distributions/discrete_gaussian_lattice.py @@ -82,17 +82,16 @@ def _iter_vectors(n, lower, upper, step=None): INPUT: - - ``n`` -- length, integer ``>0``, - - ``lower`` -- lower bound (inclusive), integer ``< upper``. - - ``upper`` -- upper bound (exclusive), integer ``> lower``. - - ``step`` -- used for recursion, ignore. + - ``n`` -- integer ``>0``; length + - ``lower`` -- integer ``< upper``; lower bound (inclusive) + - ``upper`` -- integer ``> lower``; upper bound (exclusive) + - ``step`` -- used for recursion, ignore EXAMPLES:: sage: from sage.stats.distributions.discrete_gaussian_lattice import _iter_vectors sage: list(_iter_vectors(2, -1, 2)) [(-1, -1), (0, -1), (1, -1), (-1, 0), (0, 0), (1, 0), (-1, 1), (0, 1), (1, 1)] - """ if step is None: if ZZ(lower) >= ZZ(upper): @@ -160,9 +159,9 @@ def compute_precision(precision, sigma): INPUT: - - ``precision`` -- an integer `>= 53` nor ``None``. + - ``precision`` -- integer `>= 53` nor ``None`` - ``sigma`` -- if ``precision`` is ``None`` then the precision of - ``sigma`` is used. + ``sigma`` is used EXAMPLES:: @@ -179,7 +178,6 @@ def compute_precision(precision, sigma): 200 sage: DGL.compute_precision(None, 3) 53 - """ if precision is None: try: @@ -434,8 +432,8 @@ def __init__(self, B, sigma=1, c=0, r=None, precision=None, sigma_basis=False): [Pei2010]_; ignored for spherical Gaussian parameter; if not provided, set to be the maximal possible such that `\Sigma - rBB^T` is positive definite - - ``precision`` -- bit precision `\geq 53`. - - ``sigma_basis`` -- (default: ``False``) When set, ``sigma`` is treated as + - ``precision`` -- bit precision `\geq 53` + - ``sigma_basis`` -- boolean (default: ``False``); when set, ``sigma`` is treated as a (row) basis, i.e. the covariance matrix is computed by `\Sigma = SS^T` .. TODO:: @@ -856,7 +854,7 @@ def _call(self): c_ = c.dot_product(b_) / b_.dot_product(b_) sigma_ = sigma / b_.norm() assert sigma_ > 0 - z = DiscreteGaussianDistributionIntegerSampler(sigma=sigma_, c=c_, algorithm="uniform+online")() + z = DiscreteGaussianDistributionIntegerSampler(sigma=sigma_, c=c_, algorithm='uniform+online')() c = c - z * B[i] v = v + z * B[i] return v diff --git a/src/sage/stats/hmm/chmm.pyx b/src/sage/stats/hmm/chmm.pyx index d9c1d35d1c0..540f91356d0 100644 --- a/src/sage/stats/hmm/chmm.pyx +++ b/src/sage/stats/hmm/chmm.pyx @@ -76,7 +76,7 @@ cdef class GaussianHiddenMarkovModel(HiddenMarkovModel): - ``A`` -- matrix; the `N \times N` transition matrix - ``B`` -- list of pairs ``(mu, sigma)`` that define the distributions - ``pi`` -- initial state probabilities - - ``normalize`` -- bool (default: ``True``) + - ``normalize`` -- boolean (default: ``True``) EXAMPLES: @@ -164,11 +164,11 @@ cdef class GaussianHiddenMarkovModel(HiddenMarkovModel): INPUT: - - ``A`` -- a list of lists or a square `N \times N` matrix, whose + - ``A`` -- list of lists or a square `N \times N` matrix, whose `(i,j)` entry gives the probability of transitioning from state `i` to state `j`. - - ``B`` -- a list of `N` pairs ``(mu, std)``, where if ``B[i]=(mu,std)``, + - ``B`` -- list of `N` pairs ``(mu, std)``, where if ``B[i]=(mu,std)``, then the probability distribution associated with state `i` normal with mean ``mu`` and standard deviation ``std``. @@ -176,7 +176,7 @@ cdef class GaussianHiddenMarkovModel(HiddenMarkovModel): state, i.e., ``pi[i]`` is the probability of starting in state `i`. - - ``normalize`` -- bool (default: ``True``); if given, input is + - ``normalize`` -- boolean (default: ``True``); if given, input is normalized to define valid probability distributions, e.g., the entries of `A` are made nonnegative and the rows sum to 1. @@ -343,8 +343,8 @@ cdef class GaussianHiddenMarkovModel(HiddenMarkovModel): INPUT: - ``length`` -- positive integer - - ``starting_state`` -- int (or ``None``); if specified then generate - a sequence using this model starting with the given state + - ``starting_state`` -- integer (or ``None``); if specified then + generate a sequence using this model starting with the given state instead of the initial probabilities to determine the starting state. @@ -559,7 +559,7 @@ cdef class GaussianHiddenMarkovModel(HiddenMarkovModel): INPUT: - - ``obs`` -- an integer list of observation states. + - ``obs`` -- integer list of observation states OUTPUT: @@ -622,11 +622,11 @@ cdef class GaussianHiddenMarkovModel(HiddenMarkovModel): OUTPUT: - - list -- "the" most probable sequence of hidden states, i.e., - the Viterbi path. + - ``list`` -- "the" most probable sequence of hidden states, i.e., + the Viterbi path - - float -- log of probability that the observed sequence - was produced by the Viterbi sequence of states. + - ``float`` -- log of probability that the observed sequence + was produced by the Viterbi sequence of states EXAMPLES: @@ -770,8 +770,8 @@ cdef class GaussianHiddenMarkovModel(HiddenMarkovModel): - TimeSeries alpha with alpha_t(i) = alpha[t*N + i] - TimeSeries scale with scale[t] the scaling at step t - - float -- log_probability of the observation sequence - being produced by the model. + - ``float`` -- log_probability of the observation sequence + being produced by the model """ cdef Py_ssize_t i, j, t, T = len(obs) cdef int N = self.N @@ -859,7 +859,7 @@ cdef class GaussianHiddenMarkovModel(HiddenMarkovModel): - ``obs`` -- a time series of emissions - - ``max_iter`` -- integer (default: 500) maximum number + - ``max_iter`` -- integer (default: 500); maximum number of Baum-Welch steps to take - ``log_likelihood_cutoff`` -- positive float (default: 1e-4); @@ -871,7 +871,7 @@ cdef class GaussianHiddenMarkovModel(HiddenMarkovModel): reestimating, the standard deviation of emissions is not allowed to be less than ``min_sd``. - - ``fix_emissions`` -- bool (default: ``False``); if ``True``, do not + - ``fix_emissions`` -- boolean (default: ``False``); if ``True``, do not change emissions when updating OUTPUT: @@ -1047,7 +1047,7 @@ cdef class GaussianMixtureHiddenMarkovModel(GaussianHiddenMarkovModel): INPUT: - - ``A`` -- matrix; the `N \times N` transition matrix + - ``A`` -- matrix; the `N \times N` transition matrix - ``B`` -- list of mixture definitions for each state. Each state may have a varying number of gaussians with selection @@ -1055,7 +1055,7 @@ cdef class GaussianMixtureHiddenMarkovModel(GaussianHiddenMarkovModel): - ``pi`` -- initial state probabilities - - ``normalize`` -- bool (default: ``True``); if given, input is + - ``normalize`` -- boolean (default: ``True``); if given, input is normalized to define valid probability distributions, e.g., the entries of `A` are made nonnegative and the rows sum to 1, and the probabilities in ``pi`` are normalized. @@ -1164,7 +1164,8 @@ cdef class GaussianMixtureHiddenMarkovModel(GaussianHiddenMarkovModel): def __richcmp__(self, other, op): r""" - Compare self and other, which must both be GaussianMixtureHiddenMarkovModel's. + Compare ``self`` and ``other``, which must both be + ``GaussianMixtureHiddenMarkovModel``s. EXAMPLES:: @@ -1227,7 +1228,7 @@ cdef class GaussianMixtureHiddenMarkovModel(GaussianHiddenMarkovModel): def emission_parameters(self): r""" - Returns a list of all the emission distributions. + Return a list of all the emission distributions. OUTPUT: list of Gaussian mixtures @@ -1297,7 +1298,7 @@ cdef class GaussianMixtureHiddenMarkovModel(GaussianHiddenMarkovModel): - ``alpha`` -- TimeSeries - ``beta`` -- TimeSeries - ``obs`` -- TimeSeries - - ``j`` -- int + - ``j`` -- integer OUTPUT: @@ -1345,7 +1346,7 @@ cdef class GaussianMixtureHiddenMarkovModel(GaussianHiddenMarkovModel): INPUT: - ``obs`` -- a time series of emissions - - ``max_iter`` -- integer (default: 1000) maximum number + - ``max_iter`` -- integer (default: 1000); maximum number of Baum-Welch steps to take - ``log_likelihood_cutoff`` -- positive float (default: 1e-12); the minimal improvement in likelihood with respect to @@ -1354,7 +1355,7 @@ cdef class GaussianMixtureHiddenMarkovModel(GaussianHiddenMarkovModel): - ``min_sd`` -- positive float (default: 0.01); when reestimating, the standard deviation of emissions is not allowed to be less than ``min_sd``. - - ``fix_emissions`` -- bool (default: ``False``); if ``True``, do not + - ``fix_emissions`` -- boolean (default: ``False``); if ``True``, do not change emissions when updating OUTPUT: diff --git a/src/sage/stats/hmm/distributions.pyx b/src/sage/stats/hmm/distributions.pyx index 1b04dff21cb..ed79d289ed6 100644 --- a/src/sage/stats/hmm/distributions.pyx +++ b/src/sage/stats/hmm/distributions.pyx @@ -78,9 +78,7 @@ cdef class Distribution: - ``n`` -- ``None`` or a positive integer - OUTPUT: - - - a single sample if `n` is 1; otherwise many samples + OUTPUT: a single sample if `n` is 1; otherwise many samples EXAMPLES: @@ -102,9 +100,7 @@ cdef class Distribution: - ``x`` -- object - OUTPUT: - - - float + OUTPUT: float EXAMPLES: @@ -126,9 +122,7 @@ cdef class Distribution: - ``args`` and ``kwds``, passed to the Sage :func:`plot` function - OUTPUT: - - - a :class:`Graphics` object + OUTPUT: a :class:`Graphics` object EXAMPLES:: @@ -165,12 +159,12 @@ cdef class GaussianMixtureDistribution(Distribution): r""" INPUT: - - ``B`` -- a list of triples ``(c_i, mean_i, std_i)``, where + - ``B`` -- list of triples ``(c_i, mean_i, std_i)``, where the ``c_i`` and ``std_i`` are positive and the sum of the - ``c_i`` is `1`. + ``c_i`` is `1` - ``eps`` -- positive real number; any standard deviation in B - less than eps is replaced by eps. + less than eps is replaced by eps - ``normalize`` -- if ``True``, ensure that the ``c_i`` are nonnegative @@ -209,9 +203,7 @@ cdef class GaussianMixtureDistribution(Distribution): - ``i`` -- integer - OUTPUT: - - - triple of floats + OUTPUT: triple of floats EXAMPLES:: @@ -361,7 +353,6 @@ cdef class GaussianMixtureDistribution(Distribution): True sage: P.unfix(); P.is_fixed() False - """ cdef int j if i is None: @@ -469,9 +460,7 @@ cdef class GaussianMixtureDistribution(Distribution): - ``x`` -- float - OUTPUT: - - - float + OUTPUT: float EXAMPLES:: @@ -503,9 +492,7 @@ cdef class GaussianMixtureDistribution(Distribution): - ``x`` -- float - ``m`` -- integer - OUTPUT: - - - float + OUTPUT: float EXAMPLES:: diff --git a/src/sage/stats/hmm/hmm.pyx b/src/sage/stats/hmm/hmm.pyx index 5a345fe979a..e471a42d97f 100644 --- a/src/sage/stats/hmm/hmm.pyx +++ b/src/sage/stats/hmm/hmm.pyx @@ -171,11 +171,11 @@ cdef class HiddenMarkovModel: INPUT: - ``length`` -- positive integer - - ``number`` -- (default: ``None``) if given, compute list of this many sample sequences - - ``starting_state`` -- int (or ``None``); if specified, generate - a sequence using this model starting with the given state - instead of the initial probabilities to determine the - starting state. + - ``number`` -- (default: ``None``) if given, compute list of this many + sample sequences + - ``starting_state`` -- integer (or ``None``); if specified, generate a + sequence using this model starting with the given state instead of + the initial probabilities to determine the starting state OUTPUT: @@ -261,11 +261,11 @@ cdef class DiscreteHiddenMarkovModel(HiddenMarkovModel): INPUT: - - ``A`` -- a list of lists or a square `N \times N` matrix, whose + - ``A`` -- list of lists or a square `N \times N` matrix, whose `(i,j)` entry gives the probability of transitioning from state `i` to state `j`. - - ``B`` -- a list of `N` lists or a matrix with `N` rows, such that + - ``B`` -- list of `N` lists or a matrix with `N` rows, such that `B[i,k]` gives the probability of emitting symbol `k` while in state `i`. @@ -278,7 +278,7 @@ cdef class DiscreteHiddenMarkovModel(HiddenMarkovModel): is the number of states. Otherwise, they are the entries of the list ``emissions_symbols``, which must all be hashable. - - ``normalize`` -- bool (default: ``True``); if given, input is + - ``normalize`` -- boolean (default: ``True``); if given, input is normalized to define valid probability distributions, e.g., the entries of `A` are made nonnegative and the rows sum to 1, and the probabilities in ``pi`` are normalized. @@ -347,7 +347,6 @@ cdef class DiscreteHiddenMarkovModel(HiddenMarkovModel): sage: hmm.DiscreteHiddenMarkovModel([1,2,.1,1.2], [[1],[1]],[.5,.5]).transition_matrix() [ 0.3333333333333333 0.6666666666666666] [0.07692307692307693 0.923076923076923] - """ self.pi = util.initial_probs_to_TimeSeries(pi, normalize) self.N = len(self.pi) @@ -459,7 +458,7 @@ cdef class DiscreteHiddenMarkovModel(HiddenMarkovModel): INPUT: - - ``obs`` -- a list of objects + - ``obs`` -- list of objects OUTPUT: an IntList @@ -478,7 +477,7 @@ cdef class DiscreteHiddenMarkovModel(HiddenMarkovModel): INPUT: - - ``obs`` -- a list of objects + - ``obs`` -- list of objects OUTPUT: an IntList @@ -494,7 +493,7 @@ cdef class DiscreteHiddenMarkovModel(HiddenMarkovModel): def log_likelihood(self, obs, bint scale=True): r""" Return the logarithm of the probability that this model produced the given - observation sequence. Thus the output is a non-positive number. + observation sequence. Thus the output is a nonpositive number. INPUT: @@ -548,15 +547,15 @@ cdef class DiscreteHiddenMarkovModel(HiddenMarkovModel): def _forward(self, IntList obs): r""" - Memory-efficient implementation of the forward algorithm, without scaling. + Memory-efficient implementation of the forward algorithm, without + scaling. INPUT: - - ``obs`` -- an integer list of observation states. - - OUTPUT: + - ``obs`` -- integer list of observation states - ``float`` -- the log of the probability that the model produced this sequence + OUTPUT: ``float`` -- the log of the probability that the model produced + this sequence EXAMPLES:: @@ -607,11 +606,10 @@ cdef class DiscreteHiddenMarkovModel(HiddenMarkovModel): INPUT: - - ``obs`` -- an integer list of observation states. - - OUTPUT: + - ``obs`` -- integer list of observation states - ``float`` -- the log of the probability that the model produced this sequence + OUTPUT: ``float`` -- the log of the probability that the model produced + this sequence EXAMPLES:: @@ -697,10 +695,9 @@ cdef class DiscreteHiddenMarkovModel(HiddenMarkovModel): INPUT: - ``length`` -- positive integer - - ``starting_state`` -- int (or ``None``); if specified, generate - a sequence using this model starting with the given state - instead of the initial probabilities to determine the - starting state. + - ``starting_state`` -- integer (or ``None``); if specified, generate a + sequence using this model starting with the given state instead of + the initial probabilities to determine the starting state OUTPUT: @@ -815,7 +812,7 @@ cdef class DiscreteHiddenMarkovModel(HiddenMarkovModel): INPUT: - - ``q`` -- a nonnegative integer, which specifies a state + - ``q`` -- nonnegative integer, which specifies a state - ``r`` -- a real number between 0 and 1 OUTPUT: a nonnegative int @@ -853,16 +850,16 @@ cdef class DiscreteHiddenMarkovModel(HiddenMarkovModel): - ``seq`` -- sequence of emitted ints or symbols - - ``log_scale`` -- bool (default: ``True``) whether to scale the - sequence in order to avoid numerical overflow. + - ``log_scale`` -- boolean (default: ``True``); whether to scale the + sequence in order to avoid numerical overflow OUTPUT: - ``list`` -- "the" most probable sequence of hidden states, i.e., - the Viterbi path. + the Viterbi path - ``float`` -- log of probability that the observed sequence - was produced by the Viterbi sequence of states. + was produced by the Viterbi sequence of states EXAMPLES:: @@ -1116,8 +1113,8 @@ cdef class DiscreteHiddenMarkovModel(HiddenMarkovModel): - TimeSeries alpha with alpha_t(i) = alpha[t*N + i] - TimeSeries scale with scale[t] the scaling at step t - - float -- log_probability of the observation sequence - being produced by the model. + - ``float`` -- log_probability of the observation sequence + being produced by the model """ cdef Py_ssize_t i, j, t, T = len(obs) cdef int N = self.N @@ -1206,7 +1203,7 @@ cdef class DiscreteHiddenMarkovModel(HiddenMarkovModel): - ``obs`` -- list of emissions - - ``max_iter`` -- integer (default: 100) maximum number + - ``max_iter`` -- integer (default: 100); maximum number of Baum-Welch steps to take - ``log_likelihood_cutoff`` -- positive float (default: 1e-4); @@ -1214,8 +1211,8 @@ cdef class DiscreteHiddenMarkovModel(HiddenMarkovModel): the last iteration required to continue. Relative value to log likelihood. - - ``fix_emissions`` -- bool (default: ``False``); if ``True``, do not - change emissions when updating + - ``fix_emissions`` -- boolean (default: ``False``); if ``True``, do + not change emissions when updating OUTPUT: diff --git a/src/sage/stats/hmm/util.pyx b/src/sage/stats/hmm/util.pyx index a2d34d55e1d..c43abc73f75 100644 --- a/src/sage/stats/hmm/util.pyx +++ b/src/sage/stats/hmm/util.pyx @@ -38,9 +38,7 @@ cdef class HMM_Util: - ``i`` -- nonnegative integer - ``j`` -- nonnegative integer - OUTPUT: - - - ``T`` is modified + OUTPUT: ``T`` is modified EXAMPLES:: @@ -97,9 +95,7 @@ cdef class HMM_Util: equal to 1. If the sum of the entries in a row is 0, replace them all by `1/N`. - OUTPUT: - - - a :class:`TimeSeries` of length `N` + OUTPUT: a :class:`TimeSeries` of length `N` EXAMPLES:: @@ -137,9 +133,7 @@ cdef class HMM_Util: equal to 1. If the sum of the entries in a row is 0, replace them all by `1/N`. - OUTPUT: - - - a :class:`TimeSeries` + OUTPUT: a :class:`TimeSeries` EXAMPLES:: diff --git a/src/sage/stats/intlist.pyx b/src/sage/stats/intlist.pyx index 009f706330f..88a0ee9ff14 100644 --- a/src/sage/stats/intlist.pyx +++ b/src/sage/stats/intlist.pyx @@ -52,7 +52,6 @@ cdef class IntList: sage: stats.IntList(5) # indirect test [0, 0, 0, 0, 0] - """ self._values = NULL @@ -62,7 +61,7 @@ cdef class IntList: INPUT: - - values -- int, long, Integer, list of integers, or a TimeSeries + - ``values`` -- int, long, Integer, list of integers, or a TimeSeries If the input is a time series or list of floats, then the integer parts of the entries are taken (not the floor). @@ -121,7 +120,7 @@ cdef class IntList: def __richcmp__(IntList self, other, int op): """ - Compare self and other. This has the same semantics + Compare ``self`` and ``other``. This has the same semantics as list comparison. EXAMPLES:: @@ -188,7 +187,7 @@ cdef class IntList: INPUT: - - i -- integer or slice + - ``i`` -- integer or slice EXAMPLES:: @@ -252,8 +251,8 @@ cdef class IntList: INPUT: - - i -- an integer - - x -- an int + - ``i`` -- integer + - ``x`` -- integer EXAMPLES:: @@ -295,8 +294,8 @@ cdef class IntList: sage: loads(dumps(v)) == v True - Note that dumping and loading with compress False is much faster, though - dumping with compress True can save a lot of space:: + Note that dumping and loading with compress ``False`` is much faster, + though dumping with compress ``True`` can save a lot of space:: sage: v = stats.IntList([1..10^5]) sage: loads(dumps(v, compress=False),compress=False) == v @@ -394,7 +393,7 @@ cdef class IntList: def __add__(left, right): """ - Concatenate the integer lists self and right. + Concatenate the integer lists ``self`` and ``right``. EXAMPLES:: @@ -419,13 +418,13 @@ cdef class IntList: INPUT: - - ``index`` -- bool (default: ``False``); if ``True``, also return - index of minimal entry. + - ``index`` -- boolean (default: ``False``); if ``True``, also return + index of minimal entry OUTPUT: - - float -- smallest value - - integer -- index of smallest value; only returned if + - ``float`` -- smallest value + - ``integer`` -- index of smallest value; only returned if ``index=True`` EXAMPLES:: @@ -457,13 +456,13 @@ cdef class IntList: INPUT: - - ``index`` -- bool (default: ``False``); if ``True``, also return - index of maximum entry. + - ``index`` -- boolean (default: ``False``); if ``True``, also return + index of maximum entry OUTPUT: - - int -- largest value - - int -- index of largest value; only returned if ``index=True`` + - integer -- largest value + - integer -- index of largest value; only returned if ``index=True`` EXAMPLES:: @@ -549,11 +548,9 @@ cdef IntList new_int_list(Py_ssize_t length): INPUT: - - length -- a nonnegative integer - - OUTPUT: + - ``length`` -- nonnegative integer - - an IntList. + OUTPUT: an IntList """ if length < 0: raise ValueError("length must be nonnegative") diff --git a/src/sage/stats/r.py b/src/sage/stats/r.py index 47f492eff61..63398fb1a44 100644 --- a/src/sage/stats/r.py +++ b/src/sage/stats/r.py @@ -24,12 +24,12 @@ def ttest(x, y, conf_level=0.95, **kw): """ - T-Test using R + T-Test using R. INPUT: - ``x``, ``y`` -- vectors of same length - - conf_level -- confidence level of the interval, [0,1) in percent + - ``conf_level`` -- confidence level of the interval, [0,1) in percent OUTPUT: diff --git a/src/sage/stats/time_series.pyx b/src/sage/stats/time_series.pyx index e2bdb4a9e35..d8fa061b817 100644 --- a/src/sage/stats/time_series.pyx +++ b/src/sage/stats/time_series.pyx @@ -86,9 +86,9 @@ cdef class TimeSeries: INPUT: - ``values`` -- integer (number of values) or an iterable of - floats. + floats - - ``initialize`` -- bool (default: ``True``); if ``False``, do not + - ``initialize`` -- boolean (default: ``True``); if ``False``, do not bother to zero out the entries of the new time series. For large series that you are going to just fill in, this can be way faster. @@ -316,7 +316,7 @@ cdef class TimeSeries: r""" Return the number of entries in this time series. - OUTPUT: python integer + OUTPUT: Python integer EXAMPLES:: @@ -420,9 +420,9 @@ cdef class TimeSeries: INPUT: - - ``i`` -- a nonnegative integer. + - ``i`` -- nonnegative integer - - ``x`` -- a float. + - ``x`` -- a float EXAMPLES:: @@ -480,7 +480,7 @@ cdef class TimeSeries: INPUT: - - ``right`` -- a time series. + - ``right`` -- a time series OUTPUT: a time series @@ -526,7 +526,7 @@ cdef class TimeSeries: INPUT: - - ``left``, ``right`` -- an integer and a time series. + - ``left``, ``right`` -- integer and a time series OUTPUT: a time series @@ -579,11 +579,9 @@ cdef class TimeSeries: INPUT: - - ``M`` -- an integer. + - ``M`` -- integer - OUTPUT: - - A time series -- the coefficients of the autoregressive process. + OUTPUT: a time series -- the coefficients of the autoregressive process EXAMPLES:: @@ -622,7 +620,7 @@ cdef class TimeSeries: INPUT: - ``filter`` -- a time series outputted by the ``autoregressive_fit`` - command. + command EXAMPLES:: @@ -674,7 +672,7 @@ cdef class TimeSeries: INPUT: - - ``right`` -- iterable that can be converted to a time series. + - ``right`` -- iterable that can be converted to a time series EXAMPLES:: @@ -822,7 +820,7 @@ cdef class TimeSeries: INPUT: - - ``k`` -- a positive integer. + - ``k`` -- positive integer OUTPUT: a new time series @@ -875,7 +873,7 @@ cdef class TimeSeries: INPUT: - - ``s`` -- a float. + - ``s`` -- a float EXAMPLES:: @@ -895,7 +893,7 @@ cdef class TimeSeries: INPUT: - - ``s`` -- a float. + - ``s`` -- a float OUTPUT: a new time series with all values multiplied by ``s`` @@ -922,7 +920,7 @@ cdef class TimeSeries: INPUT: - - ``s`` -- a float. + - ``s`` -- a float OUTPUT: a new time series with ``s`` added to all values @@ -951,7 +949,7 @@ cdef class TimeSeries: INPUT: - - ``t`` -- a time series. + - ``t`` -- a time series OUTPUT: @@ -1024,10 +1022,10 @@ cdef class TimeSeries: plot the given number of equally spaced points in the time series. If 0, plot all points. - - ``points`` -- bool (default: ``False``). If ``True``, return just - the points of the time series. + - ``points`` -- boolean (default: ``False``); if ``True``, return just + the points of the time series - - ``**kwds`` -- passed to the line or point command. + - ``**kwds`` -- passed to the line or point command EXAMPLES:: @@ -1076,7 +1074,7 @@ cdef class TimeSeries: INPUT: - - ``k`` -- positive integer. + - ``k`` -- positive integer OUTPUT: a time series with the same number of steps as ``self`` @@ -1128,7 +1126,7 @@ cdef class TimeSeries: INPUT: - - ``alpha`` -- float; a smoothing factor with ``0 <= alpha <= 1``. + - ``alpha`` -- float; a smoothing factor with ``0 <= alpha <= 1`` OUTPUT: a time series with the same number of steps as ``self`` @@ -1172,7 +1170,7 @@ cdef class TimeSeries: INPUT: - - ``s`` -- starting value for partial sums. + - ``s`` -- starting value for partial sums OUTPUT: a time series @@ -1254,7 +1252,7 @@ cdef class TimeSeries: INPUT: - - ``k`` -- a float. + - ``k`` -- a float OUTPUT: a time series @@ -1278,7 +1276,7 @@ cdef class TimeSeries: INPUT: - - ``k`` -- a positive integer. + - ``k`` -- positive integer OUTPUT: double @@ -1309,7 +1307,7 @@ cdef class TimeSeries: INPUT: - - ``k`` -- a positive integer. + - ``k`` -- positive integer OUTPUT: double @@ -1345,7 +1343,7 @@ cdef class TimeSeries: INPUT: - - ``self``, ``other`` -- time series. + - ``self``, ``other`` -- time series Whichever time series has more terms is truncated. @@ -1386,7 +1384,7 @@ cdef class TimeSeries: INPUT: - - ``k`` -- a nonnegative integer (default: 0) + - ``k`` -- nonnegative integer (default: 0) OUTPUT: float @@ -1440,7 +1438,7 @@ cdef class TimeSeries: INPUT: - - ``self``, ``other`` -- time series. + - ``self``, ``other`` -- time series Whichever time series has more terms is truncated. @@ -1472,7 +1470,7 @@ cdef class TimeSeries: INPUT: - - ``k`` -- a nonnegative integer (default: 1) + - ``k`` -- nonnegative integer (default: 1) OUTPUT: a time series @@ -1502,7 +1500,7 @@ cdef class TimeSeries: INPUT: - - ``bias`` -- bool (default: ``False``); if ``False``, divide by + - ``bias`` -- boolean (default: ``False``); if ``False``, divide by ``self.length() - 1`` instead of ``self.length()`` to give a less biased estimator for the variance. @@ -1544,7 +1542,7 @@ cdef class TimeSeries: INPUT: - - ``bias`` -- bool (default: ``False``); if ``False``, divide by + - ``bias`` -- boolean (default: ``False``); if ``False``, divide by ``self.length() - 1`` instead of ``self.length()`` to give a less biased estimator for the variance. @@ -1590,7 +1588,7 @@ cdef class TimeSeries: INPUT: - - ``self`` -- a time series (*not* the series of differences). + - ``self`` -- a time series (*not* the series of differences) - ``b`` -- integer (default: ``None``); if given instead divide the input time series up into ``j = floor(n/b)`` disjoint @@ -1675,14 +1673,14 @@ cdef class TimeSeries: INPUT: - - ``index`` -- bool (default: ``False``); if ``True``, also return - index of minimal entry. + - ``index`` -- boolean (default: ``False``); if ``True``, also return + index of minimal entry OUTPUT: - - float -- smallest value. + - float; smallest value - - integer -- index of smallest value; only returned if ``index=True``. + - integer; index of smallest value (only returned if ``index=True``) EXAMPLES:: @@ -1713,14 +1711,14 @@ cdef class TimeSeries: INPUT: - - ``index`` -- bool (default: ``False``); if ``True``, also return - index of maximum entry. + - ``index`` -- boolean (default: ``False``); if ``True``, also return + index of maximum entry OUTPUT: - - float -- largest value. + - float; largest value - - integer -- index of largest value; only returned if ``index=True``. + - integer; index of largest value (only returned if ``index=True``) EXAMPLES:: @@ -1751,9 +1749,9 @@ cdef class TimeSeries: INPUT: - - ``min`` -- (default: ``None``) ``None`` or double. + - ``min`` -- (default: ``None``) ``None`` or double - - ``max`` -- (default: ``None``) ``None`` or double. + - ``max`` -- (default: ``None``) ``None`` or double OUTPUT: a time series @@ -1827,18 +1825,16 @@ cdef class TimeSeries: INPUT: - - ``bins`` -- a positive integer (default: 50) + - ``bins`` -- positive integer (default: 50) - - ``normalize`` -- (default: ``False``) whether to normalize so the - total area in the bars of the histogram is 1. + - ``normalize`` -- boolean (default: ``False``); whether to normalize so the + total area in the bars of the histogram is 1 OUTPUT: - - counts -- list of counts of numbers of elements in - each bin. + - counts -- list of counts of numbers of elements in each bin - - endpoints -- list of 2-tuples (a,b) that give the - endpoints of the bins. + - endpoints -- list of 2-tuples (a,b) that give the endpoints of the bins EXAMPLES:: @@ -1896,8 +1892,8 @@ cdef class TimeSeries: - ``bins`` -- positive integer (default: 50) - - ``normalize`` -- (default: ``True``) whether to normalize so the - total area in the bars of the histogram is 1. + - ``normalize`` -- boolean (default: ``True``); whether to normalize so the + total area in the bars of the histogram is 1 OUTPUT: a histogram plot @@ -1936,8 +1932,8 @@ cdef class TimeSeries: INPUT: - - ``bins`` -- positive integer (default: 30), the number of bins - or candles. + - ``bins`` -- positive integer (default: 30); the number of bins + or candles OUTPUT: a candlestick plot @@ -1996,11 +1992,9 @@ cdef class TimeSeries: INPUT: - - ``copy`` -- bool (default: ``True``) - - OUTPUT: + - ``copy`` -- boolean (default: ``True``) - A numpy 1-D array. + OUTPUT: a numpy 1-D array EXAMPLES:: @@ -2047,7 +2041,7 @@ cdef class TimeSeries: INPUT: - - ``distribution`` -- (default: ``"uniform"``); supported values are: + - ``distribution`` -- (default: ``'uniform'``) supported values are: - ``'uniform'`` -- from ``loc`` to ``loc + scale`` @@ -2147,9 +2141,9 @@ cdef class TimeSeries: INPUT: - - ``left`` -- left bound on random distribution. + - ``left`` -- left bound on random distribution - - ``right`` -- right bound on random distribution. + - ``right`` -- right bound on random distribution EXAMPLES: @@ -2241,7 +2235,7 @@ cdef class TimeSeries: INPUT: - - ``center`` -- the center of the semicircle distribution. + - ``center`` -- the center of the semicircle distribution EXAMPLES: diff --git a/src/sage/typeset/ascii_art.py b/src/sage/typeset/ascii_art.py index 4dab691af47..473dd5f644c 100644 --- a/src/sage/typeset/ascii_art.py +++ b/src/sage/typeset/ascii_art.py @@ -196,7 +196,7 @@ class AsciiArt(CharacterArt): def ascii_art(*obj, **kwds): r""" - Return an ASCII art representation + Return an ASCII art representation. INPUT: diff --git a/src/sage/typeset/character_art.py b/src/sage/typeset/character_art.py index e05a1db3e43..e85e1143c7d 100644 --- a/src/sage/typeset/character_art.py +++ b/src/sage/typeset/character_art.py @@ -39,7 +39,7 @@ class CharacterArt(SageObject): def __init__(self, lines=[], breakpoints=[], baseline=None): r""" - Abstract base class for character art + Abstract base class for character art. INPUT: @@ -96,7 +96,7 @@ def __init__(self, lines=[], breakpoints=[], baseline=None): @classmethod def empty(cls): """ - Return the empty character art object + Return the empty character art object. EXAMPLES:: @@ -290,7 +290,7 @@ def _splitting_points(self, size, offset=0): - ``size`` -- the maximum width of each chunk - - ``offset`` -- (default: ``0``); the first chunk has width at most + - ``offset`` -- (default: ``0``) the first chunk has width at most ``size - offset`` TESTS:: diff --git a/src/sage/typeset/character_art_factory.py b/src/sage/typeset/character_art_factory.py index c26e7f35e4e..eb268f3228a 100644 --- a/src/sage/typeset/character_art_factory.py +++ b/src/sage/typeset/character_art_factory.py @@ -26,7 +26,7 @@ def __init__(self, art_type, string_type, magic_method_name, parenthesis, square_bracet, curly_brace): r""" - Abstract base class for character art factory + Abstract base class for character art factory. This class is the common implementation behind :func:`~sage.typeset.ascii_art.ascii_art` and @@ -38,10 +38,10 @@ def __init__(self, :class:`~sage.typeset.character_art.CharacterArt`) - ``string_type`` -- type of strings (the lines in the - character art, e.g. ``str`` or ``unicode``). + character art, e.g. ``str`` or ``unicode``) - ``magic_method_name`` -- name of the Sage magic method (e.g. - ``'_ascii_art_'`` or ``'_unicode_art_'``). + ``'_ascii_art_'`` or ``'_unicode_art_'``) - ``parenthesis`` -- left/right pair of two multi-line symbols. The parenthesis, a.k.a. round brackets (used for printing @@ -134,7 +134,7 @@ def build(self, obj, baseline=None): def build_empty(self): """ - Return the empty character art object + Return the empty character art object. OUTPUT: character art instance @@ -148,7 +148,7 @@ def build_empty(self): def build_from_magic_method(self, obj, baseline=None): """ - Return the character art object created by the object's magic method + Return the character art object created by the object's magic method. OUTPUT: character art instance @@ -408,7 +408,7 @@ def build_tuple(self, t, baseline=0): def concatenate(self, iterable, separator, empty=None, baseline=0, nested=False): r""" - Concatenate multiple character art instances + Concatenate multiple character art instances. The breakpoints are set as the breakpoints of the ``separator`` together with the breakpoints of the objects in ``iterable``. @@ -523,7 +523,7 @@ def parse_keywords(self, kwds): INPUT: - - ``kwds`` -- a dict + - ``kwds`` -- dictionary OUTPUT: diff --git a/src/sage/typeset/symbols.py b/src/sage/typeset/symbols.py index aca09e737ca..6d016d1dbca 100644 --- a/src/sage/typeset/symbols.py +++ b/src/sage/typeset/symbols.py @@ -63,20 +63,20 @@ def __init__(self, character, top, extension, bottom, middle_top=None, middle_bottom=None, top_2=None, bottom_2=None): """ - A multi-character (ascii/unicode art) symbol + A multi-character (ascii/unicode art) symbol. INPUT: - Instead of string, each of these can be unicode in Python 2: + Instead of a string, each of these can be unicode in Python 2: - - ``character`` -- string. The single-line version of the symbol. + - ``character`` -- string; the single-line version of the symbol - - ``top`` -- string. The top line of a multi-line symbol. + - ``top`` -- string; the top line of a multi-line symbol - - ``extension`` -- string. The extension line of a multi-line symbol (will - be repeated). + - ``extension`` -- string; the extension line of a multi-line symbol (will + be repeated) - - ``bottom`` -- string. The bottom line of a multi-line symbol. + - ``bottom`` -- string; the bottom line of a multi-line symbol - ``middle`` -- optional string. The middle part, for example in curly braces. Will be used only once for the symbol, and @@ -90,9 +90,9 @@ def __init__(self, character, top, extension, bottom, 2-line middle part if the height of the symbol is even. Will be used only once for the symbol. - - ``top_2`` -- optional string. The upper half of a 2-line symbol. + - ``top_2`` -- optional string; the upper half of a 2-line symbol - - ``bottom_2`` -- optional string. The lower half of a 2-line symbol. + - ``bottom_2`` -- optional string; the lower half of a 2-line symbol EXAMPLES:: @@ -117,7 +117,7 @@ def __init__(self, character, top, extension, bottom, def _repr_(self): """ - Return string representation + Return string representation. EXAMPLES:: @@ -129,11 +129,11 @@ def _repr_(self): def __call__(self, num_lines): r""" - Return the lines for a multi-line symbol + Return the lines for a multi-line symbol. INPUT: - - ``num_lines`` -- integer. The total number of lines. + - ``num_lines`` -- integer; the total number of lines OUTPUT: list of strings / unicode strings @@ -160,13 +160,13 @@ def __call__(self, num_lines): def print_to_stdout(self, num_lines): """ - Print the multi-line symbol + Print the multi-line symbol. This method is for testing purposes. INPUT: - - ``num_lines`` -- integer. The total number of lines. + - ``num_lines`` -- integer; the total number of lines EXAMPLES:: @@ -193,7 +193,7 @@ class CompoundAsciiSymbol(CompoundSymbol): def character_art(self, num_lines): """ - Return the ASCII art of the symbol + Return the ASCII art of the symbol. EXAMPLES:: @@ -211,7 +211,7 @@ class CompoundUnicodeSymbol(CompoundSymbol): def character_art(self, num_lines): """ - Return the unicode art of the symbol + Return the unicode art of the symbol. EXAMPLES:: diff --git a/src/sage/typeset/unicode_art.py b/src/sage/typeset/unicode_art.py index 7abec3a6130..78e50bcae07 100644 --- a/src/sage/typeset/unicode_art.py +++ b/src/sage/typeset/unicode_art.py @@ -65,11 +65,10 @@ class UnicodeArt(CharacterArt): def unicode_art(*obj, **kwds): r""" - Return an unicode art representation + Return an unicode art representation. INPUT: - - ``*obj`` -- any number of positional arguments, of arbitrary type. The objects whose ascii art representation we want.