diff --git a/src/sage/algebras/hecke_algebras/cubic_hecke_matrix_rep.py b/src/sage/algebras/hecke_algebras/cubic_hecke_matrix_rep.py index be4080e8ea0..9964fa4e287 100644 --- a/src/sage/algebras/hecke_algebras/cubic_hecke_matrix_rep.py +++ b/src/sage/algebras/hecke_algebras/cubic_hecke_matrix_rep.py @@ -551,7 +551,7 @@ def reduce_to_irr_block(self, irr): OUTPUT: - An instance of :class:`Matrix_generic_dense` with exactly one non zero block + An instance of :class:`Matrix_generic_dense` with exactly one nonzero block according to ``irr``. EXAMPLES:: diff --git a/src/sage/categories/finite_dimensional_semisimple_algebras_with_basis.py b/src/sage/categories/finite_dimensional_semisimple_algebras_with_basis.py index 71d8a3cd009..83c0d6d17d8 100644 --- a/src/sage/categories/finite_dimensional_semisimple_algebras_with_basis.py +++ b/src/sage/categories/finite_dimensional_semisimple_algebras_with_basis.py @@ -144,7 +144,7 @@ def _orthogonal_decomposition(self, generators=None): dimension 1 subalgebras. The algorithm is recursive and proceeds as follows: - 0. If `A` is of dimension 1, return a non zero + 0. If `A` is of dimension 1, return a nonzero element. 1. Otherwise: find one of the generators such diff --git a/src/sage/combinat/designs/difference_family.py b/src/sage/combinat/designs/difference_family.py index 69e2f1c8ca0..3983dbac3dc 100644 --- a/src/sage/combinat/designs/difference_family.py +++ b/src/sage/combinat/designs/difference_family.py @@ -3274,7 +3274,7 @@ def complementary_difference_setsIII(n, check=True): Construct complementary difference sets in a group of order `n = 2m + 1`, where `4m + 3` is a prime power. Consider a finite field `G` of order `n` and let `\rho` be a primite element - of this group. Now let `Q` be the set of non zero quadratic residues in `G`, + of this group. Now let `Q` be the set of nonzero quadratic residues in `G`, and let `A = \{ a | \rho^{2a} - 1 \in Q\}`, `B' = \{ b | -(\rho^{2b} + 1) \in Q\}`. Then `A` and `B = Q \setminus B'` are complementary difference sets over the ring of integers modulo `n`. For more details, see [Sz1969]_. diff --git a/src/sage/combinat/enumeration_mod_permgroup.pyx b/src/sage/combinat/enumeration_mod_permgroup.pyx index f74ebeb07f8..b2f713228ed 100644 --- a/src/sage/combinat/enumeration_mod_permgroup.pyx +++ b/src/sage/combinat/enumeration_mod_permgroup.pyx @@ -20,7 +20,7 @@ cpdef list all_children(ClonableIntArray v, int max_part): an integer vector ``v`` whose entries have the sum `n` are all integer vectors of sum `n+1` which follow ``v`` in the lexicographic order. - That means this function adds `1` on the last non zero entries and the + That means this function adds `1` on the last nonzero entries and the following ones. For an integer vector `v` such that .. MATH:: diff --git a/src/sage/data_structures/bitset_base.pxd b/src/sage/data_structures/bitset_base.pxd index 00ccbc9de53..0ffe4ed9af9 100644 --- a/src/sage/data_structures/bitset_base.pxd +++ b/src/sage/data_structures/bitset_base.pxd @@ -274,7 +274,7 @@ cdef inline void bitset_fix(fused_bitset_t bits) noexcept: cdef inline void sparse_bitset_set_non_zero(sparse_bitset_t bits) noexcept nogil: """ - Set the non zero chunks of ``bits``. + Set the nonzero chunks of ``bits``. """ bits.n_non_zero_chunks = _set_non_zero(bits.bits, bits.non_zero_chunks, bits.limbs) bits.non_zero_chunks_are_initialized = True @@ -681,7 +681,7 @@ cdef inline void sparse_bitset_intersection(sparse_bitset_t r, fused_bitset_t a, """ Set r to the intersection of a and b, overwriting r. - Also set the non zero positions of ``r``. + Also set the nonzero positions of ``r``. We assume ``a.limbs >= r.limbs == b.limbs``. """ @@ -713,7 +713,7 @@ cdef inline void sparse_bitset_union(sparse_bitset_t r, fused_bitset_t a, fused_ """ Set r to the union of a and b, overwriting r. - Also set the non zero positions of ``r``. + Also set the nonzero positions of ``r``. We assume ``r.limbs >= a.limbs >= b.limbs`` and either ``r is a`` or ``r.limbs == b.limbs``. @@ -749,7 +749,7 @@ cdef inline void sparse_bitset_difference(sparse_bitset_t r, fused_bitset_t a, f Set r to the difference of a and b (i.e., things in a that are not in b), overwriting r. - Also set the non zero positions of ``r``. + Also set the nonzero positions of ``r``. We assume ``r.limbs >= a.limbs >= b.limbs`` and either ``r is a`` or ``r.limbs == b.limbs``. @@ -772,7 +772,7 @@ cdef inline void sparse_bitset_symmetric_difference(sparse_bitset_t r, fused_bit """ Set r to the symmetric difference of a and b, overwriting r. - Also set the non zero positions of ``r``. + Also set the nonzero positions of ``r``. We assume ``r.limbs >= a.limbs >= b.limbs`` and either ``r is a`` or ``r.limbs == b.limbs``. diff --git a/src/sage/data_structures/blas_dict.pyx b/src/sage/data_structures/blas_dict.pyx index 42f6d144f72..baa27e54c22 100644 --- a/src/sage/data_structures/blas_dict.pyx +++ b/src/sage/data_structures/blas_dict.pyx @@ -19,7 +19,7 @@ meaningful in those cases. We are also assuming that ``-1 * x = -x`` and ``bool(x) == bool(-x)`` for all ``x`` in `K`. Unless stated overwise, all values `v` in the dictionaries should be -non zero (as tested with `bool(v)`). +nonzero (as tested with `bool(v)`). This is mostly used by :class:`CombinatorialFreeModule`. """ diff --git a/src/sage/data_structures/sparse_bitset.pxd b/src/sage/data_structures/sparse_bitset.pxd index 9b95c55675b..e30de80073f 100644 --- a/src/sage/data_structures/sparse_bitset.pxd +++ b/src/sage/data_structures/sparse_bitset.pxd @@ -46,13 +46,13 @@ cdef struct sparse_bitset_s: # Pointer to the memory of ``bits``. void* mem - # Storing the non zero positions can safe time, when performing + # Storing the nonzero positions can safe time, when performing # multiple comparisons. # E.g. one can set them while computing the intersection # and then use those to ``bitset_issubset`` many times in a row. # Any modification, will invalidate the already computed positions. - # It is stored, whether the non zero chunks are correctly initialized + # It is stored, whether the nonzero chunks are correctly initialized # or not. Computations will work correctly either way. bint non_zero_chunks_are_initialized mp_bitcnt_t* non_zero_chunks diff --git a/src/sage/dynamics/arithmetic_dynamics/wehlerK3.py b/src/sage/dynamics/arithmetic_dynamics/wehlerK3.py index 3a4d3f5fc58..31bf2324d8a 100644 --- a/src/sage/dynamics/arithmetic_dynamics/wehlerK3.py +++ b/src/sage/dynamics/arithmetic_dynamics/wehlerK3.py @@ -1174,7 +1174,7 @@ def sigmaX(self, P, **kwds): -phi(self.Hpoly(1, 1, 2))] maxexp = [] - #Find highest exponent that we can divide out by to get a non zero answer + #Find highest exponent that we can divide out by to get a nonzero answer for i in range(2,len(T)): e = 0 while (T[i]/t**e).subs({w1:t1}) == 0: @@ -1419,7 +1419,7 @@ def sigmaY(self,P, **kwds): -phi(self.Hpoly(0, 1, 2))] maxexp = [] - #Find highest exponent that we can divide out by to get a non zero answer + #Find highest exponent that we can divide out by to get a nonzero answer for i in range(2, len(T)): e = 0 while (T[i]/t**e).subs({w1:t1}) == 0: diff --git a/src/sage/geometry/polyhedron/combinatorial_polyhedron/face_data_structure.pxd b/src/sage/geometry/polyhedron/combinatorial_polyhedron/face_data_structure.pxd index 3ed71a664e1..87766041ffb 100644 --- a/src/sage/geometry/polyhedron/combinatorial_polyhedron/face_data_structure.pxd +++ b/src/sage/geometry/polyhedron/combinatorial_polyhedron/face_data_structure.pxd @@ -182,7 +182,7 @@ cdef inline void face_intersection_fused(face_t dest, face_t A, face_t B, algori Set ``dest`` to the intersection of ``A`` and ``B``. """ if algorithm_variant is standard: - # Also setting the non zero positions. + # Also setting the nonzero positions. sparse_bitset_intersection(dest.atoms, A.atoms, B.atoms) else: bitset_intersection(dest.atoms, A.atoms, B.atoms) diff --git a/src/sage/libs/giac/giac.pyx b/src/sage/libs/giac/giac.pyx index 88ab6d80aa0..3042220118c 100644 --- a/src/sage/libs/giac/giac.pyx +++ b/src/sage/libs/giac/giac.pyx @@ -303,7 +303,7 @@ def _giac(s): sage: A = libgiac.table(()); A # create an empty giac table table( ) - sage: A[2,3] = 33; A[0,2] = '2/7' # set non zero entries of the sparse matrix + sage: A[2,3] = 33; A[0,2] = '2/7' # set nonzero entries of the sparse matrix sage: A*A # basic matrix operation are supported with sparse matrices table( (0,3) = 66/7 diff --git a/src/sage/manifolds/differentiable/integrated_curve.py b/src/sage/manifolds/differentiable/integrated_curve.py index 627ae54e0a0..6867448cdce 100644 --- a/src/sage/manifolds/differentiable/integrated_curve.py +++ b/src/sage/manifolds/differentiable/integrated_curve.py @@ -882,7 +882,7 @@ def solve_analytical(self, verbose=False): des[i] = diff(y[i],par) == des[i] for j in range(dim): coord = self._chart[:][j] # important to use '[:]' on - # 'chart' to avoid problems due to non zero starting + # 'chart' to avoid problems due to nonzero starting # index (i0) veloc = self._velocities[j] des[dim+i] = des[dim+i].substitute({coord: y[j]}) @@ -895,7 +895,7 @@ def solve_analytical(self, verbose=False): y_ics_second_half = [] for i in range(dim): coord = self._chart[:][i] # important to use '[:]' - # on 'chart' to avoid problems due to non zero + # on 'chart' to avoid problems due to nonzero # starting index (i0) veloc = self._velocities[i] str_var_coord = "{}_0".format(coord) @@ -1307,7 +1307,7 @@ def jacobian(t,y): for j in range(dim): coord = chart[:][j] # important to use # '[:]' on 'chart' to avoid problems due - # to non zero starting index (i0) + # to nonzero starting index (i0) vel = self._velocities[j] AUX = eqns_num[i].derivative(coord) AUX2 = eqns_num[i].derivative(vel) @@ -1316,7 +1316,7 @@ def jacobian(t,y): for k in range(dim): coordin = chart[:][k] # important to # use '[:]' on 'chart' to avoid - # problems due to non zero starting + # problems due to nonzero starting # index (i0) veloc = self._velocities[k] AUX = AUX.substitute({coordin: y[k]}) @@ -1335,7 +1335,7 @@ def jacobian(t,y): for m in range(dim): coordin = chart[:][m] # important to use # '[:]' on 'chart' to avoid problems due - # to non zero starting index (i0) + # to nonzero starting index (i0) veloc = self._velocities[m] AUX3 = AUX3.substitute({coordin: y[m]}) AUX3 = AUX3.substitute({veloc: y[dim+m]}) @@ -3148,7 +3148,7 @@ class IntegratedAutoparallelCurve(IntegratedCurve): The vectors tangent to such a curve make an angle different from 0 or `\pi/2` with the lines of latitude and longitude. Then, compute a curve such that both components of its initial - tangent vectors are non zero:: + tangent vectors are nonzero:: sage: sol = c.solve(solution_key='sol-angle', ....: parameters_values={tmin:0,tmax:2,th0:pi/4,ph0:0.1,v_th0:1,v_ph0:8}) diff --git a/src/sage/manifolds/differentiable/tangent_vector.py b/src/sage/manifolds/differentiable/tangent_vector.py index 8a978945fde..1bd1dd5c647 100644 --- a/src/sage/manifolds/differentiable/tangent_vector.py +++ b/src/sage/manifolds/differentiable/tangent_vector.py @@ -210,7 +210,7 @@ def plot(self, chart=None, ambient_coords=None, mapping=None, - ``color`` -- (default: ``'blue'``) color of the arrow representing the vector - - ``print_label`` -- (boolean; default: ``True``) determines whether a + - ``print_label`` -- boolean (default: ``True``); determines whether a label is printed next to the arrow representing the vector - ``label`` -- (string; default: ``None``) label printed next to the diff --git a/src/sage/modules/free_quadratic_module_integer_symmetric.py b/src/sage/modules/free_quadratic_module_integer_symmetric.py index 16124c15266..ab715bc57d5 100644 --- a/src/sage/modules/free_quadratic_module_integer_symmetric.py +++ b/src/sage/modules/free_quadratic_module_integer_symmetric.py @@ -1572,7 +1572,7 @@ def twist(self, s, discard_basis=False): except TypeError: raise ValueError("the scaling factor must be an element of the base ring.") if s == 0: - raise ValueError("the scaling factor must be non zero") + raise ValueError("the scaling factor must be nonzero") if discard_basis: return IntegralLattice(s * self.gram_matrix()) else: diff --git a/src/sage/modules/tutorial_free_modules.py b/src/sage/modules/tutorial_free_modules.py index 8fe8cd8c7df..3af1ba78f54 100644 --- a/src/sage/modules/tutorial_free_modules.py +++ b/src/sage/modules/tutorial_free_modules.py @@ -137,12 +137,12 @@ Some definitions: * A *monomial* is an element of the basis `B_i`; - * A *term* is an element of the basis multiplied by a non zero + * A *term* is an element of the basis multiplied by a nonzero *coefficient*: `c B_i`; * The support of that term is `i`. * The corresponding *item* is the :class:`tuple` ``(i, c)``. * The *support* of an element `f` is the collection of indices `i` - such that `B_i` appears in `f` with non zero coefficient. + such that `B_i` appears in `f` with nonzero coefficient. * The *monomials*, *terms*, *items*, and *coefficients* of an element `f` are defined accordingly. * *Leading*/*trailing* refers to the *greatest*/*least* index. diff --git a/src/sage/quadratic_forms/binary_qf.py b/src/sage/quadratic_forms/binary_qf.py index 504c766576c..1a75f415b64 100755 --- a/src/sage/quadratic_forms/binary_qf.py +++ b/src/sage/quadratic_forms/binary_qf.py @@ -298,7 +298,7 @@ def __call__(self, *args): INPUT: - - args -- x and y values, as a pair x, y or a list, tuple, or + - ``args`` -- x and y values, as a pair x, y or a list, tuple, or vector EXAMPLES:: @@ -769,9 +769,9 @@ def _reduce_indef(self, transformation=False): INPUT: - - ``transformation`` -- bool (default: ``False``); if ``True``, - return both the reduced form and a matrix transforming - ``self`` into the reduced form. + - ``transformation`` -- boolean (default: ``False``); if ``True``, + return both the reduced form and a matrix transforming ``self`` into + the reduced form TESTS:: @@ -831,7 +831,7 @@ def _reduce_indef(self, transformation=False): return Q @cached_method - def reduced_form(self, transformation=False, algorithm="default"): + def reduced_form(self, transformation=False, algorithm='default'): """ Return a reduced form equivalent to ``self``. @@ -839,9 +839,9 @@ def reduced_form(self, transformation=False, algorithm="default"): - ``self`` -- binary quadratic form of non-square discriminant - - ``transformation`` -- boolean (default: ``False``): if ``True``, return + - ``transformation`` -- boolean (default: ``False``); if ``True``, return both the reduced form and a matrix whose :meth:`matrix_action_right` - transforms ``self`` into the reduced form. + transforms ``self`` into the reduced form - ``algorithm`` -- string; the algorithm to use. Valid options are: @@ -1279,7 +1279,7 @@ def is_singular(self): def is_nonsingular(self): """ - Return whether this form is nonsingular, i.e., has non-zero discriminant. + Return whether this form is nonsingular, i.e., has nonzero discriminant. EXAMPLES:: @@ -1298,7 +1298,7 @@ def is_equivalent(self, other, proper=True): INPUT: - - ``proper`` -- bool (default: ``True``); if ``True`` use proper + - ``proper`` -- boolean (default: ``True``); if ``True`` use proper equivalence - ``other`` -- a binary quadratic form @@ -1604,17 +1604,17 @@ def small_prime_value(self, Bmax=1000): raise ValueError("Unable to find a prime value of %s" % self) B += 10 - def solve_integer(self, n, *, algorithm="general", _flag=2): + def solve_integer(self, n, *, algorithm='general', _flag=2): r""" Solve `Q(x, y) = n` in integers `x` and `y` where `Q` is this quadratic form. INPUT: - - ``n`` -- a positive integer or a + - ``n`` -- positive integer or a `:sage:`~sage.structure.factorization.Factorization` object - - ``algorithm`` -- ``"general"`` (default) or ``"cornacchia"`` + - ``algorithm`` -- ``'general'`` (default) or ``'cornacchia'`` - ``_flag`` -- ``1``, ``2`` (default) or ``3``; passed onto the pari function``qfbsolve``. For internal use only. @@ -1685,7 +1685,7 @@ def solve_integer(self, n, *, algorithm="general", _flag=2): sage: xy is None or Q(*xy) == n # needs sage.libs.pari True - Also when using the ``"cornacchia"`` algorithm:: + Also when using the ``'cornacchia'`` algorithm:: sage: # needs sage.libs.pari sage: n = random_prime(10^9) @@ -1829,12 +1829,12 @@ def BinaryQF_reduced_representatives(D, primitive_only=False, proper=True): INPUT: - - ``D`` -- (integer) a discriminant + - ``D`` -- integer; a discriminant - - ``primitive_only`` -- (boolean; default: ``True``): if ``True``, only - return primitive forms. + - ``primitive_only`` -- boolean (default: ``True``); if ``True``, only + return primitive forms - - ``proper`` -- (boolean; default: ``True``) + - ``proper`` -- boolean (default: ``True``) OUTPUT: diff --git a/src/sage/quadratic_forms/constructions.py b/src/sage/quadratic_forms/constructions.py index da51beb1c2e..95bd131215e 100644 --- a/src/sage/quadratic_forms/constructions.py +++ b/src/sage/quadratic_forms/constructions.py @@ -40,7 +40,6 @@ def BezoutianQuadraticForm(f, g): AUTHORS: - Fernando Rodriguez-Villegas, Jonathan Hanke -- added on 11/9/2008 - """ # Check that f and g are polynomials with a common base ring if not isinstance(f, Polynomial) or not isinstance(g, Polynomial): @@ -69,13 +68,13 @@ def BezoutianQuadraticForm(f, g): def HyperbolicPlane_quadratic_form(R, r=1): """ - Constructs the direct sum of `r` copies of the quadratic form `xy` + Construct the direct sum of `r` copies of the quadratic form `xy` representing a hyperbolic plane defined over the base ring `R`. INPUT: - - ``R``: a ring - - ``n`` (integer, default 1) number of copies + - ``R`` -- a ring + - ``n`` -- integer (default: 1); number of copies EXAMPLES:: diff --git a/src/sage/quadratic_forms/count_local_2.pyx b/src/sage/quadratic_forms/count_local_2.pyx index 3ce05a3a413..55c64e56be7 100644 --- a/src/sage/quadratic_forms/count_local_2.pyx +++ b/src/sage/quadratic_forms/count_local_2.pyx @@ -18,12 +18,12 @@ def count_modp__by_gauss_sum(n, p, m, Qdet): INPUT: - - ``n`` -- an integer `\geq 1` + - ``n`` -- integer `\geq 1` - ``p`` -- a prime number > 2 - - ``m`` -- an integer - - ``Qdet`` -- a integer which is non-zero mod `p` + - ``m`` -- integer + - ``Qdet`` -- a integer which is nonzero mod `p` - OUTPUT: an integer `\geq 0` + OUTPUT: integer `\geq 0` EXAMPLES:: @@ -55,12 +55,10 @@ def count_modp__by_gauss_sum(n, p, m, Qdet): ....: == count_modp__by_gauss_sum(3, 3, m, 2) ....: for m in range(3)] [True, True, True] - - """ # Check that Qdet is non-degenerate if Qdet % p == 0: - raise RuntimeError("Qdet must be non-zero.") + raise RuntimeError("Qdet must be nonzero.") # Check that p is prime > 2 if not is_prime(p) or p == 2: @@ -157,9 +155,9 @@ def CountAllLocalTypesNaive(Q, p, k, m, zvec, nzvec): - ``Q`` -- quadratic form over `\ZZ` - ``p`` -- prime number > 0 - - ``k`` -- an integer > 0 - - ``m`` -- an integer (depending only on mod `p^k`) - - ``zvec``, ``nzvec`` -- a list of integers in ``range(Q.dim())``, or ``None`` + - ``k`` -- integer > 0 + - ``m`` -- integer (depending only on mod `p^k`) + - ``zvec``, ``nzvec`` -- list of integers in ``range(Q.dim())``, or ``None`` OUTPUT: @@ -176,7 +174,6 @@ def CountAllLocalTypesNaive(Q, p, k, m, zvec, nzvec): [6, 6, 0, 0, 0, 0] sage: CountAllLocalTypesNaive(Q, 3, 1, 0, None, None) [15, 12, 1, 2, 0, 2] - """ return CountAllLocalTypesNaive_cdef(Q, p, k, m, zvec, nzvec) @@ -189,7 +186,6 @@ cdef local_solution_type_cdef(Q, p, w, zvec, nzvec): NOTE: No internal checking is done to test if `p` is a prime >=2, or that Q has the same size as `w`. - """ cdef long i cdef long n @@ -218,7 +214,7 @@ cdef local_solution_type_cdef(Q, p, w, zvec, nzvec): # print("IsLocalSolutionType: Passed the Zero congruence condition test \n") # Check if the solution satisfies the nzvec "nonzero" congruence conditions - # (nzvec is non-empty and its components index a non-zero vector mod p) + # (nzvec is non-empty and its components index a nonzero vector mod p) if nzvec is None: nonzero_flag = True elif len(nzvec) == 0: @@ -228,7 +224,7 @@ cdef local_solution_type_cdef(Q, p, w, zvec, nzvec): i = 0 while not nonzero_flag and i < len(nzvec): if w[nzvec[i]] % p: - nonzero_flag = True # The non-zero condition is satisfied when we find one non-zero entry + nonzero_flag = True # The nonzero condition is satisfied when we find one nonzero entry i += 1 if not nonzero_flag: diff --git a/src/sage/quadratic_forms/extras.py b/src/sage/quadratic_forms/extras.py index edb738ac561..38ab9c498d9 100644 --- a/src/sage/quadratic_forms/extras.py +++ b/src/sage/quadratic_forms/extras.py @@ -13,7 +13,7 @@ def is_triangular_number(n, return_value=False): Return whether ``n`` is a triangular number. A *triangular number* is a number of the form `k(k+1)/2` for some - non-negative integer `n`. See :wikipedia:`Triangular_number`. The sequence + nonnegative integer `n`. See :wikipedia:`Triangular_number`. The sequence of triangular number is references as A000217 in the Online encyclopedia of integer sequences (OEIS). @@ -22,11 +22,11 @@ def is_triangular_number(n, return_value=False): INPUT: - - ``n`` -- an integer + - ``n`` -- integer - - ``return_value`` -- a boolean set to ``False`` by default. If set to + - ``return_value`` -- boolean (default: ``False``); if set to ``True`` the function returns a pair made of a boolean and the value `v` - such that `v(v+1)/2 = n`. + such that `v(v+1)/2 = n` EXAMPLES:: @@ -85,11 +85,9 @@ def extend_to_primitive(A_input): INPUT: - a matrix, or a list of length n vectors (in the same space) + - ``A_input`` -- a matrix or a list of length n vectors (in the same space) - OUTPUT: - - a square matrix, or a list of n vectors (resp.) + OUTPUT: a square matrix or a list of n vectors (resp.) EXAMPLES:: diff --git a/src/sage/quadratic_forms/genera/genus.py b/src/sage/quadratic_forms/genera/genus.py index 37dee9a124f..cf309b622fc 100644 --- a/src/sage/quadratic_forms/genera/genus.py +++ b/src/sage/quadratic_forms/genera/genus.py @@ -45,9 +45,9 @@ def genera(sig_pair, determinant, max_scale=None, even=False): INPUT: - - ``sig_pair`` -- a pair of non-negative integers giving the signature + - ``sig_pair`` -- a pair of nonnegative integers giving the signature - - ``determinant`` -- an integer; the sign is ignored + - ``determinant`` -- integer; the sign is ignored - ``max_scale`` -- (default: ``None``) an integer; the maximum scale of a jordan block @@ -85,7 +85,7 @@ def genera(sig_pair, determinant, max_scale=None, even=False): sig_pair = (ZZ(sig_pair[0]), ZZ(sig_pair[1])) even = bool(even) if not all(s >= 0 for s in sig_pair): - raise ValueError("the signature vector must be a pair of non negative integers.") + raise ValueError("the signature vector must be a pair of nonnegative integers.") if max_scale is None: max_scale = determinant else: @@ -139,7 +139,7 @@ def _local_genera(p, rank, det_val, max_scale, even): - ``det_val`` -- valuation of the determinant at `p` - - ``max_scale`` -- an integer the maximal scale of a jordan block + - ``max_scale`` -- integer the maximal scale of a jordan block - ``even`` -- ``bool``; is ignored if `p` is not `2` @@ -225,17 +225,17 @@ def _local_genera(p, rank, det_val, max_scale, even): def _blocks(b, even_only=False): r""" - Return all viable `2`-adic jordan blocks with rank and scale given by ``b`` + Return all viable `2`-adic jordan blocks with rank and scale given by ``b``. This is a helper function for :meth:`_local_genera`. It is based on the existence conditions for a modular `2`-adic genus symbol. INPUT: - - ``b`` -- a list of `5` non-negative integers the first two are kept + - ``b`` -- list of `5` nonnegative integers the first two are kept and all possibilities for the remaining `3` are enumerated - - ``even_only`` -- bool (default: ``True``) if set, the blocks are even + - ``even_only`` -- boolean (default: ``True``); if set, the blocks are even EXAMPLES:: @@ -469,7 +469,7 @@ def is_2_adic_genus(genus_symbol_quintuple_list) -> bool: INPUT: - ``genus_symbol_quintuple_list`` -- a quintuple of integers (with certain - restrictions). + restrictions) OUTPUT: boolean @@ -534,7 +534,7 @@ def canonical_2_adic_compartments(genus_symbol_quintuple_list): - ``genus_symbol_quintuple_list`` -- a quintuple of integers (with certain restrictions) - OUTPUT: a list of lists of integers + OUTPUT: list of lists of integers EXAMPLES:: @@ -607,7 +607,7 @@ def canonical_2_adic_trains(genus_symbol_quintuple_list, compartments=None): restrictions). - ``compartments`` -- this argument is deprecated - OUTPUT: a list of lists of distinct integers + OUTPUT: list of lists of distinct integers EXAMPLES:: @@ -705,9 +705,9 @@ def canonical_2_adic_reduction(genus_symbol_quintuple_list): - ``genus_symbol_quintuple_list`` -- a quintuple of integers (with certain restrictions) - - ``compartments`` -- a list of lists of distinct integers (optional) + - ``compartments`` -- list of lists of distinct integers (optional) - OUTPUT: a list of lists of distinct integers + OUTPUT: list of lists of distinct integers EXAMPLES:: @@ -824,7 +824,7 @@ def basis_complement(B): def signature_pair_of_matrix(A): r""" - Computes the signature pair `(p, n)` of a non-degenerate symmetric + Compute the signature pair `(p, n)` of a non-degenerate symmetric matrix, where - `p` is the number of positive eigenvalues of `A` @@ -886,11 +886,11 @@ def p_adic_symbol(A, p, val): - ``A`` -- symmetric matrix with integer coefficients - ``p`` -- prime number - - ``val`` -- non-negative integer; valuation of the maximal elementary + - ``val`` -- nonnegative integer; valuation of the maximal elementary divisor of `A` needed to obtain enough precision. Calculation is modulo `p` to the ``val+3``. - OUTPUT: a list of lists of integers + OUTPUT: list of lists of integers EXAMPLES:: @@ -902,7 +902,6 @@ def p_adic_symbol(A, p, val): sage: p_adic_symbol(A, 3, 1) [[0, 3, 1], [1, 1, -1]] - """ if p % 2 == 0: return two_adic_symbol(A, val) @@ -982,7 +981,7 @@ def split_odd(A): INPUT: - ``A`` -- an odd symmetric matrix with integer coefficients (which admits a - splitting as above). + splitting as above) OUTPUT: @@ -1073,7 +1072,7 @@ def trace_diag_mod_8(A): INPUT: - ``A`` -- symmetric matrix with coefficients in `\ZZ` which is odd in - `\ZZ/2\ZZ` and has determinant not divisible by `8`. + `\ZZ/2\ZZ` and has determinant not divisible by `8` OUTPUT: integer @@ -1120,7 +1119,7 @@ def two_adic_symbol(A, val): INPUT: - ``A`` -- symmetric matrix with integer coefficients, non-degenerate - - ``val`` -- non-negative integer; valuation of maximal `2`-elementary divisor + - ``val`` -- nonnegative integer; valuation of maximal `2`-elementary divisor OUTPUT: @@ -1133,7 +1132,6 @@ def two_adic_symbol(A, val): sage: A = diagonal_matrix(ZZ, [1, 2, 3, 4]) sage: two_adic_symbol(A, 2) [[0, 2, 3, 1, 4], [1, 1, 1, 1, 1], [2, 1, 1, 1, 1]] - """ from sage.rings.finite_rings.finite_field_constructor import FiniteField @@ -1266,7 +1264,6 @@ def __init__(self, prime, symbol, check=True): r""" Create the local genus symbol of given prime and local invariants. - EXAMPLES:: sage: from sage.quadratic_forms.genera.genus import p_adic_symbol @@ -1297,7 +1294,7 @@ def __init__(self, prime, symbol, check=True): def __repr__(self): r""" - String representation for the `p`-adic genus symbol + String representation for the `p`-adic genus symbol. OUTPUT: string @@ -1457,7 +1454,6 @@ def __eq__(self, other): True sage: G3 == G3 True - """ p = self._prime if p != other._prime: @@ -1673,7 +1669,7 @@ def canonical_symbol(self): only really affects the `2`-adic symbol, since when `p > 2` the symbol is already canonical. - OUTPUT: a list of lists of integers + OUTPUT: list of lists of integers EXAMPLES:: @@ -1739,7 +1735,7 @@ def gram_matrix(self, check=True): INPUT: - - ``check`` (default: ``True``) -- double check the result + - ``check`` -- boolean (default: ``True``); double check the result EXAMPLES:: @@ -1949,7 +1945,7 @@ def symbol_tuple_list(self): Return a copy of the underlying list of lists of integers defining the genus symbol. - OUTPUT: a list of lists of integers + OUTPUT: list of lists of integers EXAMPLES:: @@ -1980,7 +1976,7 @@ def number_of_blocks(self): r""" Return the number of positive dimensional symbols/Jordan blocks. - OUTPUT: a non-negative integer + OUTPUT: nonnegative integer EXAMPLES:: @@ -2007,7 +2003,7 @@ def number_of_blocks(self): def determinant(self): r""" - Returns the (`p`-part of the) determinant (square-class) of the + Return the (`p`-part of the) determinant (square-class) of the Hessian matrix of the quadratic form (given by regarding the integral symmetric matrix which generated this genus symbol as the Gram matrix of `Q`) associated to this local genus symbol. @@ -2042,7 +2038,7 @@ def dimension(self): r""" Return the dimension of a quadratic form associated to this genus symbol. - OUTPUT: a non-negative integer + OUTPUT: nonnegative integer EXAMPLES:: @@ -2183,7 +2179,6 @@ def excess(self): 0 sage: p = 11; Genus_Symbol_p_adic_ring(p, p_adic_symbol(A, p, 2)).excess() 0 - """ p = self._prime if self._prime == 2: @@ -2267,7 +2262,7 @@ def trains(self) -> list: symbol if it is associated to the prime `p=2` (and raise an error for all other primes). - OUTPUT: a list of non-negative integers + OUTPUT: list of nonnegative integers EXAMPLES:: @@ -2280,7 +2275,6 @@ def trains(self) -> list: Genus symbol at 2: [2^-2 4^1 8^1]_6 sage: G2.trains() [[0, 1, 2]] - """ # Check that p = 2 if self._prime != 2: @@ -2294,7 +2288,7 @@ def compartments(self) -> list: symbol if it is associated to the prime `p=2` (and raise an error for all other primes). - OUTPUT: a list of non-negative integers + OUTPUT: list of nonnegative integers EXAMPLES:: @@ -2307,7 +2301,6 @@ def compartments(self) -> list: Genus symbol at 2: [2^-2 4^1 8^1]_6 sage: G2.compartments() [[0, 1, 2]] - """ # Check that p = 2 if self._prime != 2: @@ -2324,15 +2317,15 @@ class GenusSymbol_global_ring: INPUT: - - ``signature_pair`` -- a tuple of two non-negative integers + - ``signature_pair`` -- tuple of two nonnegative integers - - ``local_symbols`` -- a list of :class:`Genus_Symbol_p_adic_ring` instances + - ``local_symbols`` -- list of :class:`Genus_Symbol_p_adic_ring` instances sorted by their primes - ``representative`` -- (default: ``None``) integer symmetric matrix; the Gram matrix of a representative of this genus - - ``check`` -- (default: ``True``) a boolean; checks the input + - ``check`` -- boolean (default: ``True``); checks the input EXAMPLES:: @@ -2416,7 +2409,6 @@ def __repr__(self) -> str: Signature: (2, 0) Genus symbol at 2: 1^-2 Genus symbol at 3: 1^-1 3^-1 - """ rep = "Genus" if self.dimension() <= 20: @@ -2458,7 +2450,7 @@ def __eq__(self, other) -> bool: INPUT: - a :class:`GenusSymbol_global_ring` object + - ``other`` -- a :class:`GenusSymbol_global_ring` object OUTPUT: boolean @@ -2508,7 +2500,7 @@ def __ne__(self, other) -> bool: INPUT: - a ``GenusSymbol_global_ring`` object + - ``other`` -- a ``GenusSymbol_global_ring`` object OUTPUT: boolean @@ -2530,7 +2522,6 @@ def __ne__(self, other) -> bool: sage: GS2 != GS2 False - """ return not self == other @@ -2653,7 +2644,7 @@ def spinor_generators(self, proper) -> list: - ``proper`` -- boolean - OUTPUT: a list of primes not dividing the determinant + OUTPUT: list of primes not dividing the determinant EXAMPLES:: @@ -2989,14 +2980,14 @@ def representative(self): def representatives(self, backend=None, algorithm=None): r""" - Return a list of representatives for the classes in this genus + Return a list of representatives for the classes in this genus. INPUT: - ``backend`` -- (default: ``None``) - ``algorithm`` -- (default: ``None``) - OUTPUT: a list of Gram matrices + OUTPUT: list of Gram matrices EXAMPLES:: @@ -3022,7 +3013,7 @@ def representatives(self, backend=None, algorithm=None): For positive definite forms the magma backend is available:: sage: G = Genus(matrix.diagonal([1, 1, 7])) - sage: G.representatives(backend="magma") # optional - magma + sage: G.representatives(backend='magma') # optional - magma ( [1 0 0] [ 1 0 0] [0 1 0] [ 0 2 -1] @@ -3161,7 +3152,6 @@ def _standard_mass(self): sage: GS = Genus(A) sage: GS._standard_mass() # needs sage.symbolic 1/48 - """ from sage.symbolic.constants import pi from sage.symbolic.ring import SR @@ -3204,7 +3194,7 @@ def mass(self, backend='sage'): INPUT: - - ``backend`` -- default: ``'sage'``, or ``'magma'`` + - ``backend`` -- (default: ``'sage'``) or ``'magma'`` OUTPUT: a rational number @@ -3332,10 +3322,10 @@ def _gram_from_jordan_block(p, block, discr_form=False): - ``p`` -- a prime number - - ``block`` -- a list of 3 integers or 5 integers if `p` is `2` + - ``block`` -- list of 3 integers or 5 integers if `p` is `2` - - ``discr_form`` -- bool (default: ``False``); if ``True`` invert the scales - to obtain a Gram matrix for the discriminant form instead. + - ``discr_form`` -- boolean (default: ``False``); if ``True`` invert the scales + to obtain a Gram matrix for the discriminant form instead EXAMPLES:: diff --git a/src/sage/quadratic_forms/genera/normal_form.py b/src/sage/quadratic_forms/genera/normal_form.py index 1dcf13d18e3..80609a3ac3d 100644 --- a/src/sage/quadratic_forms/genera/normal_form.py +++ b/src/sage/quadratic_forms/genera/normal_form.py @@ -101,12 +101,10 @@ def collect_small_blocks(G): INPUT: - - ``G`` -- a block_diagonal matrix consisting of + - ``G`` -- a ``block_diagonal`` matrix consisting of `1` by `1` and `2` by `2` blocks - OUTPUT: - - - a list of `1` by `1` and `2` by `2` matrices -- the blocks + OUTPUT: list of `1` by `1` and `2` by `2` matrices; the blocks EXAMPLES:: @@ -173,8 +171,8 @@ def p_adic_normal_form(G, p, precision=None, partial=False, debug=False): - ``G`` -- a symmetric `n` by `n` matrix in `\QQ` - ``p`` -- a prime number -- it is not checked whether it is prime - ``precision`` -- if not set, the minimal possible is taken - - ``partial`` -- boolean (default: ``False``) if set, only the - partial normal form is returned. + - ``partial`` -- boolean (default: ``False``); if set, only the + partial normal form is returned OUTPUT: @@ -300,7 +298,7 @@ def _find_min_p(G, cnt, lower_bound=0): - ``G`` -- a symmetric `n` by `n` matrix in `\QQ_p` - ``cnt`` -- start search from this index - - ``lower_bound`` -- an integer (default: ``0``) + - ``lower_bound`` -- integer (default: 0) a lower bound for the valuations used for optimization OUTPUT: @@ -363,7 +361,7 @@ def _get_small_block_indices(G): - ``G`` -- a block_diagonal matrix consisting of `1` by `1` and `2` by `2` blocks - OUTPUT: a list of integers + OUTPUT: list of integers EXAMPLES:: @@ -398,9 +396,9 @@ def _get_homogeneous_block_indices(G): INPUT: - ``G`` -- a block diagonal matrix over the `p`-adics - with blocks of size at most `2`. + with blocks of size at most `2` - OUTPUT: a list of integers + OUTPUT: list of integers EXAMPLES:: @@ -741,10 +739,6 @@ def _min_nonsquare(p): - ``p`` -- a prime number - OUTPUT: - - - ``a`` -- the minimal nonsquare mod `p` - EXAMPLES:: sage: from sage.quadratic_forms.genera.normal_form import _min_nonsquare @@ -771,8 +765,8 @@ def _normalize(G, normal_odd=True): - ``G`` -- a symmetric matrix over `\ZZ_p` in jordan form -- the output of :meth:`p_adic_normal_form` or :meth:`_jordan_2_adic` - - ``normal_odd`` -- bool (default: ``True``) if true and `p` is odd, - compute a normal form. + - ``normal_odd`` -- boolean (default: ``True``); if ``True`` and `p` is odd, + compute a normal form OUTPUT: @@ -988,12 +982,12 @@ def _normalize_odd_2x2(G): INPUT: - ``G`` -- a multiple of the `2` by `2` identity_matrix - over the `p`-adics for `p` odd. + over the `p`-adics for `p` odd OUTPUT: - - A transformation matrix ``B`` such that - ``B * G * B.T`` is the identity matrix + A transformation matrix ``B`` such that ``B * G * B.T`` is the identity + matrix. EXAMPLES:: @@ -1121,15 +1115,15 @@ def _relations(G, n): INPUT: - - ``n`` -- an integer between 1 and 10 -- the number of the relation + - ``n`` -- integer between 1 and 10 -- the number of the relation - ``G`` -- a block diagonal matrix consisting of blocks of types `U, V, W` the left side of the relation. If ``G`` does not match `n` then the results are unpredictable. OUTPUT: - - square matrix ``B`` such that ``B * G * B.T`` is the right side of the - relation which consists of blocks of types `U`, `V`, `W` again + Square matrix ``B`` such that ``B * G * B.T`` is the right side of the + relation which consists of blocks of types `U`, `V`, `W` again. EXAMPLES:: @@ -1385,11 +1379,9 @@ def _two_adic_normal_forms(G, partial=False): INPUT: - ``G`` -- block diagonal matrix with blocks of type `U`, `V`, `W` - - ``partial`` -- bool (default: ``False``) - - OUTPUT: + - ``partial`` -- boolean (default: ``False``) - - ``D``, ``B`` -- such that ``D = B * G * B.T`` + OUTPUT: ``D``, ``B``; such that ``D = B * G * B.T`` EXAMPLES:: diff --git a/src/sage/quadratic_forms/genera/spinor_genus.py b/src/sage/quadratic_forms/genera/spinor_genus.py index ee6453b1fd5..d773ed5f496 100644 --- a/src/sage/quadratic_forms/genera/spinor_genus.py +++ b/src/sage/quadratic_forms/genera/spinor_genus.py @@ -149,7 +149,7 @@ def to_square_class(self, x, p): - ``p`` -- a prime - - ``x``` -- a non zero rational number + - ``x`` -- nonzero rational number EXAMPLES:: @@ -166,7 +166,7 @@ def to_square_class(self, x, p): """ x = QQ(x) if x == 0: - raise ValueError("x must be non zero") + raise ValueError("x must be nonzero") if p not in self._primes: raise ValueError("not a coordinate prime") v, u = x.val_unit(p) @@ -194,11 +194,10 @@ def delta(self, r, prime=None): INPUT: - - ``r`` -- a non zero integer; - if ``prime`` is ``None``, ``r`` must not be divisible - by the defining primes of ``self`` + - ``r`` -- a nonzero integer; if ``prime`` is ``None``, ``r`` must not + be divisible by the defining primes of ``self`` - - ``prime`` -- (default:``None``) a prime or `-1` + - ``prime`` -- (default: ``None``) a prime or `-1` OUTPUT: diff --git a/src/sage/quadratic_forms/qfsolve.py b/src/sage/quadratic_forms/qfsolve.py index 0db9675f4c6..55fd9a4b3b2 100644 --- a/src/sage/quadratic_forms/qfsolve.py +++ b/src/sage/quadratic_forms/qfsolve.py @@ -129,7 +129,7 @@ def solve(self, c=0): - ``c`` -- (default: 0) a rational number - OUTPUT: a non-zero vector `x` satisfying ``self(x) == c``. + OUTPUT: a nonzero vector `x` satisfying ``self(x) == c`` ALGORITHM: diff --git a/src/sage/quadratic_forms/quadratic_form.py b/src/sage/quadratic_forms/quadratic_form.py index 9525609b36d..4f15ae113ae 100644 --- a/src/sage/quadratic_forms/quadratic_form.py +++ b/src/sage/quadratic_forms/quadratic_form.py @@ -76,14 +76,12 @@ def quadratic_form_from_invariants(F, rk, det, P, sminus): - ``F`` -- the base field; currently only ``QQ`` is allowed - ``rk`` -- integer; the rank - ``det`` -- rational; the determinant - - ``P`` -- a list of primes where Cassel's Hasse invariant + - ``P`` -- list of primes where Cassel's Hasse invariant is negative - ``sminus`` -- integer; the number of negative eigenvalues of any Gram matrix - OUTPUT: - - - a quadratic form with the specified invariants + OUTPUT: a quadratic form with the specified invariants Let `(a_1, \ldots, a_n)` be the gram marix of a regular quadratic space. Then Cassel's Hasse invariant is defined as @@ -194,8 +192,8 @@ class QuadraticForm(SageObject): #. ``QuadraticForm(R, n, entries)``, where - ``R`` -- ring for which the quadratic form is defined - - ``n`` -- an integer `\geq 0` - - ``entries`` -- a list of `n(n+1)/2` coefficients of the quadratic form + - ``n`` -- integer `\geq 0` + - ``entries`` -- list of `n(n+1)/2` coefficients of the quadratic form in `R` (given lexicographically, or equivalently, by rows of the matrix) @@ -221,7 +219,6 @@ class QuadraticForm(SageObject): - ``number_of_automorphisms`` - ``determinant`` - OUTPUT: quadratic form EXAMPLES:: @@ -503,7 +500,7 @@ class QuadraticForm(SageObject): # Genus lazy_import("sage.quadratic_forms.genera.genus", - "_genera_staticmethod", as_="genera") + "_genera_staticmethod", as_='genera') def __init__(self, R, n=None, entries=None, unsafe_initialization=False, number_of_automorphisms=None, determinant=None): """ @@ -539,7 +536,7 @@ def __init__(self, R, n=None, entries=None, unsafe_initialization=False, number_ sage: QuadraticForm(ZZ, -1) Traceback (most recent call last): ... - ValueError: the size must be a non-negative integer, not -1 + ValueError: the size must be a nonnegative integer, not -1 sage: x = polygen(ZZ, 'x') sage: QuadraticForm(x**2) @@ -618,7 +615,7 @@ def __init__(self, R, n=None, entries=None, unsafe_initialization=False, number_ # Verify the size of the matrix is an integer >= 0 n = ZZ(n) if n < 0: - raise ValueError(f"the size must be a non-negative integer, not {n}") + raise ValueError(f"the size must be a nonnegative integer, not {n}") # Store the relevant variables N = n * (n + 1) // 2 @@ -702,7 +699,6 @@ def __pari__(self): sage: Q = QuadraticForm(ZZ, 2, [1,0,5]) sage: Q.__pari__() # needs sage.libs.pari [2, 0; 0, 10] - """ return self.matrix().__pari__() @@ -780,7 +776,6 @@ def __getitem__(self, ij): [1 2 3] [2 4 5] [3 5 6] - """ # Unpack the list of indices i, j = ij @@ -813,7 +808,6 @@ def __setitem__(self, ij, coeff): [ 1 2 3 ] [ * 4 17 ] [ * * 6 ] - """ # Unpack the list of indices i, j = ij @@ -869,7 +863,6 @@ def __eq__(self, right): False sage: Q1 == Q2 False - """ if not isinstance(right, QuadraticForm): return False @@ -1043,7 +1036,6 @@ def __call__(self, v): sage: Q(M) Quadratic form in 1 variables over Integer Ring with coefficients: [ 14 ] - """ # If we are passed a matrix A, return the quadratic form Q(A(x)) # (In matrix notation: A^t * Q * A) @@ -1081,7 +1073,7 @@ def __call__(self, v): def _is_even_symmetric_matrix_(self, A, R=None): """ - Tests if a matrix is symmetric, defined over `R`, and has even diagonal in `R`. + Test if a matrix is symmetric, defined over `R`, and has even diagonal in `R`. INPUT: @@ -1101,7 +1093,6 @@ def _is_even_symmetric_matrix_(self, A, R=None): sage: A[0,0] = 1 sage: Q._is_even_symmetric_matrix_(A) False - """ if not isinstance(A, Matrix): raise TypeError("A is not a matrix.") @@ -1148,7 +1139,6 @@ def matrix(self): [ 0 1 2] [ 1 6 4] [ 2 4 10] - """ return self.Hessian_matrix() @@ -1167,7 +1157,6 @@ def Hessian_matrix(self): [2 6] sage: Q.matrix().base_ring() Rational Field - """ mat_entries = [] for i in range(self.dim()): @@ -1200,7 +1189,6 @@ def Gram_matrix_rational(self): [0 0 0 7] sage: A.base_ring() Rational Field - """ return (ZZ(1) / ZZ(2)) * self.matrix() @@ -1258,7 +1246,6 @@ def has_integral_Gram_matrix(self): sage: Q = QuadraticForm(ZZ, 2, [4,5,6]) sage: Q.has_integral_Gram_matrix() False - """ # Warning over fields if self.base_ring() in Fields(): @@ -1436,7 +1423,6 @@ def adjoint_primitive(self): Quadratic form in 2 variables over Integer Ring with coefficients: [ 3 -2 ] [ * 1 ] - """ return QuadraticForm(self.Hessian_matrix().adjoint_classical()).primitive() @@ -1581,7 +1567,7 @@ def level(self): generator for the smallest ideal `N` of `R` such that `N\cdot (` the matrix of `2*Q` `)^{(-1)}` is in `R` with diagonal in `2R`. - Over `\ZZ` this returns a non-negative number. + Over `\ZZ` this returns a nonnegative number. (Caveat: This always returns the unit ideal when working over a field!) @@ -1680,7 +1666,7 @@ def level_ideal(self): def bilinear_map(self, v, w): r""" - Return the value of the associated bilinear map on two vectors + Return the value of the associated bilinear map on two vectors. Given a quadratic form `Q` over some base ring `R` with characteristic not equal to 2, this gives the image of two diff --git a/src/sage/quadratic_forms/quadratic_form__automorphisms.py b/src/sage/quadratic_forms/quadratic_form__automorphisms.py index bec0063d3b5..4fa4d4fe1ff 100644 --- a/src/sage/quadratic_forms/quadratic_form__automorphisms.py +++ b/src/sage/quadratic_forms/quadratic_form__automorphisms.py @@ -103,8 +103,8 @@ def short_vector_list_up_to_length(self, len_bound, up_to_sign_flag=False): - ``len_bound`` -- bound for the length of the vectors - - ``up_to_sign_flag`` -- (default: ``False``) if set to True, then - only one of the vectors of the pair `[v, -v]` is listed. + - ``up_to_sign_flag`` -- boolean (default: ``False``); if set to ``True``, + then only one of the vectors of the pair `[v, -v]` is listed OUTPUT: @@ -229,7 +229,7 @@ def short_primitive_vector_list_up_to_length(self, len_bound, up_to_sign_flag=Fa This processes the PARI/GP output to always give elements of type `\ZZ`. - OUTPUT: a list of lists of vectors + OUTPUT: list of lists of vectors EXAMPLES:: @@ -336,7 +336,7 @@ def automorphisms(self): """ Return the list of the automorphisms of the quadratic form. - OUTPUT: a list of matrices + OUTPUT: list of matrices EXAMPLES:: @@ -375,7 +375,7 @@ def number_of_automorphisms(self): Return the number of automorphisms (of det `1` and `-1`) of the quadratic form. - OUTPUT: an integer `\geq 2` + OUTPUT: integer `\geq 2` EXAMPLES:: diff --git a/src/sage/quadratic_forms/quadratic_form__count_local_2.py b/src/sage/quadratic_forms/quadratic_form__count_local_2.py index b125d8d6840..3805945d0f7 100644 --- a/src/sage/quadratic_forms/quadratic_form__count_local_2.py +++ b/src/sage/quadratic_forms/quadratic_form__count_local_2.py @@ -38,8 +38,8 @@ def count_congruence_solutions_as_vector(self, p, k, m, zvec, nzvec): INPUT: - ``p`` -- prime number > 0 - - ``k`` -- an integer > 0 - - ``m`` -- an integer (depending only on mod `p^k`) + - ``k`` -- integer > 0 + - ``m`` -- integer (depending only on mod `p^k`) - ``zvec``, ``nzvec`` -- lists of integers in ``range(self.dim())``, or ``None`` OUTPUT: @@ -47,7 +47,6 @@ def count_congruence_solutions_as_vector(self, p, k, m, zvec, nzvec): a list of six integers `\geq 0` representing the solution types: [All, Good, Zero, Bad, BadI, BadII] - EXAMPLES:: sage: Q = DiagonalQuadraticForm(ZZ, [1,2,3]) @@ -63,7 +62,6 @@ def count_congruence_solutions_as_vector(self, p, k, m, zvec, nzvec): [6, 6, 0, 0, 0, 0] sage: Q.count_congruence_solutions_as_vector(3, 1, 0, None, None) [15, 12, 1, 2, 0, 2] - """ return CountAllLocalTypesNaive(self, p, k, m, zvec, nzvec) @@ -82,9 +80,9 @@ def count_congruence_solutions(self, p, k, m, zvec, nzvec): - ``p`` -- prime number > 0 - - ``k`` -- an integer > 0 + - ``k`` -- integer > 0 - - ``m`` -- an integer (depending only on mod `p^k`) + - ``m`` -- integer (depending only on mod `p^k`) - ``zvec``, ``nzvec`` -- lists of integers in ``range(self.dim())``, or ``None`` @@ -107,9 +105,9 @@ def count_congruence_solutions__good_type(self, p, k, m, zvec, nzvec): - ``p`` -- prime number > 0 - - ``k`` -- an integer > 0 + - ``k`` -- integer > 0 - - ``m`` -- an integer (depending only on mod `p^k`) + - ``m`` -- integer (depending only on mod `p^k`) - ``zvec``, ``nzvec`` -- lists of integers up to dim(`Q`) @@ -132,9 +130,9 @@ def count_congruence_solutions__zero_type(self, p, k, m, zvec, nzvec): - ``p`` -- prime number > 0 - - ``k`` -- an integer > 0 + - ``k`` -- integer > 0 - - ``m`` -- an integer (depending only on mod `p^k`) + - ``m`` -- integer (depending only on mod `p^k`) - ``zvec``, ``nzvec`` -- lists of integers up to dim(`Q`) @@ -157,9 +155,9 @@ def count_congruence_solutions__bad_type(self, p, k, m, zvec, nzvec): - ``p`` -- prime number > 0 - - ``k`` -- an integer > 0 + - ``k`` -- integer > 0 - - ``m`` -- an integer (depending only on mod `p^k`) + - ``m`` -- integer (depending only on mod `p^k`) - ``zvec``, ``nzvec`` -- lists of integers up to dim(`Q`) @@ -182,9 +180,9 @@ def count_congruence_solutions__bad_type_I(self, p, k, m, zvec, nzvec): - ``p`` -- prime number > 0 - - ``k`` -- an integer > 0 + - ``k`` -- integer > 0 - - ``m`` -- an integer (depending only on mod `p^k`) + - ``m`` -- integer (depending only on mod `p^k`) - ``zvec``, ``nzvec`` -- lists of integers up to dim(`Q`) @@ -207,9 +205,9 @@ def count_congruence_solutions__bad_type_II(self, p, k, m, zvec, nzvec): - ``p`` -- prime number > 0 - - ``k`` -- an integer > 0 + - ``k`` -- integer > 0 - - ``m`` -- an integer (depending only on mod `p^k`) + - ``m`` -- integer (depending only on mod `p^k`) - ``zvec``, ``nzvec`` -- lists of integers up to dim(`Q`) diff --git a/src/sage/quadratic_forms/quadratic_form__equivalence_testing.py b/src/sage/quadratic_forms/quadratic_form__equivalence_testing.py index 32f8bb62b4e..205ca57bc13 100644 --- a/src/sage/quadratic_forms/quadratic_form__equivalence_testing.py +++ b/src/sage/quadratic_forms/quadratic_form__equivalence_testing.py @@ -32,7 +32,7 @@ def is_globally_equivalent_to(self, other, return_matrix=False): - ``self``, ``other`` -- positive definite integral quadratic forms - - ``return_matrix`` -- (boolean, default ``False``) return + - ``return_matrix`` -- boolean (default: ``False``); return the transformation matrix instead of a boolean OUTPUT: @@ -307,8 +307,9 @@ def is_rationally_isometric(self, other, return_matrix=False): - ``other`` -- a quadratic form over a number field - - ``return_matrix`` -- (boolean, default ``False``) return - the transformation matrix instead of a boolean; this is currently only implemented for forms over ``QQ`` + - ``return_matrix`` -- boolean (default: ``False``); return + the transformation matrix instead of a boolean; this is currently + only implemented for forms over ``QQ`` OUTPUT: @@ -659,11 +660,9 @@ def _gram_schmidt(m, fixed_vector_index, inner_product): - ``fixed_vector_index`` -- any vectors preceding the vector (i.e. to its left) at this index are not changed. - ``inner_product`` -- a function that takes two vector arguments and returns a scalar, - representing an inner product. + representing an inner product - OUTPUT: - - - A matrix consisting of orthogonal columns with respect to the given inner product + OUTPUT: a matrix consisting of orthogonal columns with respect to the given inner product EXAMPLES:: diff --git a/src/sage/quadratic_forms/quadratic_form__evaluate.pyx b/src/sage/quadratic_forms/quadratic_form__evaluate.pyx index 95e82e669dc..b0c374e5381 100644 --- a/src/sage/quadratic_forms/quadratic_form__evaluate.pyx +++ b/src/sage/quadratic_forms/quadratic_form__evaluate.pyx @@ -23,7 +23,7 @@ def QFEvaluateVector(Q, v): INPUT: - ``Q`` -- :class:`QuadraticForm` over a base ring `R` - - ``v`` -- a tuple or list (or column matrix) of ``Q.dim()`` elements of `R` + - ``v`` -- tuple or list (or column matrix) of ``Q.dim()`` elements of `R` OUTPUT: an element of `R` @@ -48,7 +48,6 @@ cdef QFEvaluateVector_cdef(Q, v): r""" Routine to quickly evaluate a quadratic form `Q` on a vector `v`. See the Python wrapper function :meth:`QFEvaluate` above for details. - """ # If we are passed a matrix A, return the quadratic form Q(A(x)) # (In matrix notation: A^t * Q * A) @@ -115,7 +114,6 @@ cdef QFEvaluateMatrix_cdef(Q, M, Q2): r""" Routine to quickly evaluate a quadratic form `Q` on a matrix `M`. See the Python wrapper function :func:`QFEvaluateMatrix` above for details. - """ # Create the new quadratic form n = Q.dim() diff --git a/src/sage/quadratic_forms/quadratic_form__local_density_congruence.py b/src/sage/quadratic_forms/quadratic_form__local_density_congruence.py index a39637df8f0..a959be64455 100644 --- a/src/sage/quadratic_forms/quadratic_form__local_density_congruence.py +++ b/src/sage/quadratic_forms/quadratic_form__local_density_congruence.py @@ -34,9 +34,9 @@ def count_modp_solutions__by_Gauss_sum(self, p, m): - ``p`` -- a prime number > 2 - - ``m`` -- an integer + - ``m`` -- integer - OUTPUT: an integer `\geq 0` + OUTPUT: integer `\geq 0` EXAMPLES:: @@ -75,7 +75,7 @@ def local_good_density_congruence_odd(self, p, m, Zvec, NZvec): - ``p`` -- a prime number - - ``m`` -- an integer + - ``m`` -- integer - ``Zvec``, ``NZvec`` -- non-repeating lists of integers in ``range(self.dim())`` or ``None`` @@ -111,7 +111,7 @@ def local_good_density_congruence_odd(self, p, m, Zvec, NZvec): UnitVec = Set(i for i in range(n) if self[i, i] % p) NonUnitVec = Set(range(n)) - UnitVec - # Take cases on the existence of additional non-zero congruence conditions (mod p) + # Take cases on the existence of additional nonzero congruence conditions (mod p) UnitVec_minus_Zvec = list(UnitVec - Set(Zvec)) NonUnitVec_minus_Zvec = list(NonUnitVec - Set(Zvec)) Q_Unit_minus_Zvec = self.extract_variables(UnitVec_minus_Zvec) @@ -171,7 +171,7 @@ def local_good_density_congruence_even(self, m, Zvec, NZvec): - ``p`` -- a prime number - - ``m`` -- an integer + - ``m`` -- integer - ``Zvec``, ``NZvec`` -- non-repeating lists of integers in ``range(self.dim())`` or ``None`` @@ -237,7 +237,7 @@ def local_good_density_congruence_even(self, m, Zvec, NZvec): if (NZvec is not None) and (len(Set(NZvec) + Sn) > n): raise RuntimeError("NZvec must be a subset of {0, ..., n-1}.") - # Find the indices of x for which the associated Jordan blocks are non-zero mod 8 TODO: Move this to special Jordan block code separately! + # Find the indices of x for which the associated Jordan blocks are nonzero mod 8 TODO: Move this to special Jordan block code separately! # ------------------------------------------------------------------------------- Not8vec = [] for i in range(n): @@ -293,7 +293,7 @@ def local_good_density_congruence_even(self, m, Zvec, NZvec): verbose("Z_Is8 = " + str(Z_Is8)) verbose("Is8_minus_Z = " + str(Is8_minus_Z)) - # Take cases on the existence of additional non-zero congruence conditions (mod 2) + # Take cases on the existence of additional nonzero congruence conditions (mod 2) if NZvec is None: total = (4 ** len(Z_Is8)) * (8 ** len(Is8_minus_Z)) \ * Q_Not8.count_congruence_solutions__good_type(2, 3, m, list(Z_Not8), None) @@ -337,7 +337,7 @@ def local_good_density_congruence(self, p, m, Zvec=None, NZvec=None): - ``p`` -- a prime number - - ``m`` -- an integer + - ``m`` -- integer - ``Zvec``, ``NZvec`` -- non-repeating lists of integers in ``range(self.dim())`` or ``None`` @@ -358,7 +358,6 @@ def local_good_density_congruence(self, p, m, Zvec=None, NZvec=None): 1 sage: Q.local_good_density_congruence(3, 1, None, None) 8/9 - """ # DIAGNOSTIC verbose(" In local_good_density_congruence with ") @@ -408,7 +407,7 @@ def local_zero_density_congruence(self, p, m, Zvec=None, NZvec=None): - ``p`` -- a prime number - - ``m`` -- an integer + - ``m`` -- integer - ``Zvec``, ``NZvec`` -- non-repeating lists of integers in ``range(self.dim())`` or ``None`` @@ -481,7 +480,7 @@ def local_badI_density_congruence(self, p, m, Zvec=None, NZvec=None): - ``p`` -- a prime number - - ``m`` -- an integer + - ``m`` -- integer - ``Zvec``, ``NZvec`` -- non-repeating lists of integers in ``range(self.dim())`` or ``None`` @@ -560,7 +559,7 @@ def local_badI_density_congruence(self, p, m, Zvec=None, NZvec=None): S0 = [] S1_empty_flag = True # This is used to check if we should be computing BI solutions at all! - # (We should really to this earlier, but S1 must be non-zero to proceed.) + # (We should really to this earlier, but S1 must be nonzero to proceed.) # Find the valuation of each variable (which will be the same over 2x2 blocks), # remembering those of valuation 0 and if an entry of valuation 1 exists. @@ -644,7 +643,7 @@ def local_badII_density_congruence(self, p, m, Zvec=None, NZvec=None): - ``p`` -- a prime number - - ``m`` -- an integer + - ``m`` -- integer - ``Zvec``, ``NZvec`` -- non-repeating lists of integers in ``range(self.dim())`` or ``None`` @@ -790,7 +789,7 @@ def local_bad_density_congruence(self, p, m, Zvec=None, NZvec=None): - ``p`` -- a prime number - - ``m`` -- an integer + - ``m`` -- integer - ``Zvec``, ``NZvec`` -- non-repeating lists of integers in ``range(self.dim())`` or ``None`` @@ -848,7 +847,7 @@ def local_density_congruence(self, p, m, Zvec=None, NZvec=None): - ``p`` -- a prime number - - ``m`` -- an integer + - ``m`` -- integer - ``Zvec``, ``NZvec`` -- non-repeating lists of integers in ``range(self.dim())`` or ``None`` @@ -920,7 +919,7 @@ def local_primitive_density_congruence(self, p, m, Zvec=None, NZvec=None): - ``p`` -- a prime number - - ``m`` -- an integer + - ``m`` -- integer - ``Zvec``, ``NZvec`` -- non-repeating lists of integers in ``range(self.dim())`` or ``None`` diff --git a/src/sage/quadratic_forms/quadratic_form__local_density_interfaces.py b/src/sage/quadratic_forms/quadratic_form__local_density_interfaces.py index 2e5be4f59de..2643620e712 100644 --- a/src/sage/quadratic_forms/quadratic_form__local_density_interfaces.py +++ b/src/sage/quadratic_forms/quadratic_form__local_density_interfaces.py @@ -21,7 +21,7 @@ def local_density(self, p, m): INPUT: - ``p`` -- a prime number > 0 - - ``m`` -- an integer + - ``m`` -- integer OUTPUT: a rational number @@ -67,7 +67,7 @@ def local_density(self, p, m): def local_primitive_density(self, p, m): """ - Return the local primitive density -- should be called by the user. =) + Return the local primitive density -- should be called by the user. NOTE: This screens for imprimitive forms, and puts the quadratic form in local normal form, which is a *requirement* of @@ -76,7 +76,7 @@ def local_primitive_density(self, p, m): INPUT: - ``p`` -- a prime number > 0 - - ``m`` -- an integer + - ``m`` -- integer OUTPUT: a rational number diff --git a/src/sage/quadratic_forms/quadratic_form__local_field_invariants.py b/src/sage/quadratic_forms/quadratic_form__local_field_invariants.py index 51dc096a03f..bb3bba044c4 100644 --- a/src/sage/quadratic_forms/quadratic_form__local_field_invariants.py +++ b/src/sage/quadratic_forms/quadratic_form__local_field_invariants.py @@ -37,16 +37,16 @@ def rational_diagonal_form(self, return_matrix=False): INPUT: - - ``return_matrix`` -- (boolean, default: ``False``) also return the + - ``return_matrix`` -- boolean (default: ``False``); also return the transformation matrix OUTPUT: either the diagonal quadratic form `D` (if ``return_matrix`` is false) or the pair `(D, T)` (if ``return_matrix`` is true) where - - `D` -- the diagonalized form of this quadratic form + - ``D`` -- the diagonalized form of this quadratic form - - `T` -- transformation matrix. This is such that - ``T.transpose() * self.matrix() * T`` gives ``D.matrix()``. + - ``T`` -- transformation matrix. This is such that + ``T.transpose() * self.matrix() * T`` gives ``D.matrix()`` Both `D` and `T` are defined over the fraction field of the base ring of the given form. @@ -189,10 +189,10 @@ def _rational_diagonal_form_and_transformation(self): OUTPUT: a tuple `(D,T)` where - - `D` -- the diagonalized form of this quadratic form + - ``D`` -- the diagonalized form of this quadratic form - - `T` -- transformation matrix. This is such that - ``T.transpose() * self.matrix() * T`` gives ``D.matrix()``. + - ``T`` -- transformation matrix. This is such that + ``T.transpose() * self.matrix() * T`` gives ``D.matrix()`` Both `D` and `T` are defined over the fraction field of the base ring of the given form. @@ -258,7 +258,7 @@ def _rational_diagonal_form_and_transformation(self): # Deal with rows where the diagonal entry is zero. if Q[i, i] == 0: - # Look for a non-zero entry and use it to make the diagonal non-zero (if it exists) + # Look for a nonzero entry and use it to make the diagonal nonzero (if it exists) for j in range(i + 1, n): if Q[i, j] != 0: temp = MS(1) @@ -318,7 +318,6 @@ def signature_vector(self): [ * * * 9 ] sage: Q.signature_vector() (3, 1, 0) - """ diag = self.rational_diagonal_form() p = 0 @@ -677,7 +676,7 @@ def is_anisotropic(self, p): def is_isotropic(self, p): r""" - Checks if `Q` is isotropic over the `p`-adic numbers `\QQ_p` or `\RR`. + Check if `Q` is isotropic over the `p`-adic numbers `\QQ_p` or `\RR`. INPUT: @@ -718,7 +717,6 @@ def is_isotropic(self, p): ....: p, -p*least_quadratic_nonresidue(p)]).is_isotropic(p) ....: for p in prime_range(3, 30)] [False, False, False, False, False, False, False, False, False] - """ return not self.is_anisotropic(p) @@ -807,7 +805,6 @@ def compute_definiteness(self): False sage: Q.is_definite() False - """ # Sanity Check from sage.rings.real_mpfr import RR @@ -928,7 +925,7 @@ def is_positive_definite(self): The zero-dimensional form is considered both positive definite and negative definite. - OUTPUT: boolean -- True or False + OUTPUT: boolean EXAMPLES:: @@ -965,7 +962,7 @@ def is_negative_definite(self): The zero-dimensional form is considered both positive definite and negative definite. - OUTPUT: boolean -- True or False + OUTPUT: boolean EXAMPLES:: @@ -1002,7 +999,7 @@ def is_indefinite(self): The zero-dimensional form is not considered indefinite. - OUTPUT: boolean -- True or False + OUTPUT: boolean EXAMPLES:: @@ -1015,7 +1012,6 @@ def is_indefinite(self): sage: Q = DiagonalQuadraticForm(ZZ, [1,-3,5]) sage: Q.is_indefinite() True - """ # Try to use the cached value try: @@ -1040,7 +1036,7 @@ def is_definite(self): The zero-dimensional form is considered indefinite. - OUTPUT: boolean -- True or False + OUTPUT: boolean EXAMPLES:: diff --git a/src/sage/quadratic_forms/quadratic_form__local_normal_form.py b/src/sage/quadratic_forms/quadratic_form__local_normal_form.py index 5770a3c22f0..8631cc33382 100644 --- a/src/sage/quadratic_forms/quadratic_form__local_normal_form.py +++ b/src/sage/quadratic_forms/quadratic_form__local_normal_form.py @@ -143,7 +143,7 @@ def local_normal_form(self, p): else: min_val = valuation(Q[min_i, min_j], p) - # Error if we still haven't seen non-zero coefficients! + # Error if we still haven't seen nonzero coefficients! if min_val == Infinity: raise RuntimeError("the original matrix is degenerate") @@ -368,7 +368,7 @@ def jordan_blocks_in_unimodular_list_by_scale_power(self, p): - ``self`` -- a quadratic form over `\ZZ`, which has integer Gram matrix if `p = 2` - ``p`` -- a prime number > 0 - OUTPUT: a list of `p`-unimodular quadratic forms + OUTPUT: list of `p`-unimodular quadratic forms EXAMPLES:: diff --git a/src/sage/quadratic_forms/quadratic_form__local_representation_conditions.py b/src/sage/quadratic_forms/quadratic_form__local_representation_conditions.py index 2fba0234781..4cc9f18c152 100644 --- a/src/sage/quadratic_forms/quadratic_form__local_representation_conditions.py +++ b/src/sage/quadratic_forms/quadratic_form__local_representation_conditions.py @@ -96,7 +96,7 @@ class QuadraticFormLocalRepresentationConditions: """ def __init__(self, Q): r""" - Takes a :class:`QuadraticForm` and computes its local conditions (if + Take a :class:`QuadraticForm` and computes its local conditions (if they do not already exist). The ``recompute_flag`` overrides the previously computed conditions if they exist, and stores the new conditions. @@ -122,7 +122,7 @@ def __init__(self, Q): # Basic structure initialization self.local_repn_array = [] # List of all local conditions - self.dim = Q.dim() # We allow this to be any non-negative integer. + self.dim = Q.dim() # We allow this to be any nonnegative integer. self.exceptional_primes = [infinity] # Deal with the special cases of 0 and 1-dimensional forms @@ -291,7 +291,7 @@ def squareclass_vector(self, p) -> list: - ``p`` -- a positive prime number or "infinity" - OUTPUT: a list of integers + OUTPUT: list of integers EXAMPLES:: @@ -316,7 +316,7 @@ def local_conditions_vector_for_prime(self, p) -> list: - ``p`` -- a positive prime number. (Is 'infinity' allowed here?) - OUTPUT: a list of integers + OUTPUT: list of integers EXAMPLES:: @@ -360,7 +360,7 @@ def local_conditions_vector_for_prime(self, p) -> list: return [2, infinity, infinity, infinity, infinity, infinity, infinity, infinity, infinity] return [p, infinity, infinity, infinity, infinity, None, None, None, None] - raise RuntimeError("the stored dimension should be a non-negative integer") + raise RuntimeError("the stored dimension should be a nonnegative integer") def is_universal_at_prime(self, p) -> bool: r""" @@ -485,7 +485,7 @@ def is_locally_represented_at_place(self, m, p) -> bool: INPUT: - - ``m`` -- an integer + - ``m`` -- integer - ``p`` -- a positive prime number or "infinity" @@ -554,7 +554,7 @@ def is_locally_represented(self, m) -> bool: INPUT: - - ``m`` -- an integer + - ``m`` -- integer OUTPUT: boolean @@ -821,7 +821,7 @@ def is_locally_represented_number_at_place(self, m, p) -> bool: INPUT: - - ``m`` -- an integer + - ``m`` -- integer - ``p`` -- a prime number > 0 or 'infinity' @@ -866,7 +866,7 @@ def is_locally_represented_number(self, m) -> bool: INPUT: - - ``m`` -- an integer + - ``m`` -- integer OUTPUT: boolean diff --git a/src/sage/quadratic_forms/quadratic_form__mass__Conway_Sloane_masses.py b/src/sage/quadratic_forms/quadratic_form__mass__Conway_Sloane_masses.py index dd4eb0a8201..d5877962a43 100644 --- a/src/sage/quadratic_forms/quadratic_form__mass__Conway_Sloane_masses.py +++ b/src/sage/quadratic_forms/quadratic_form__mass__Conway_Sloane_masses.py @@ -31,9 +31,9 @@ def parity(self, allow_rescaling_flag=True): INPUT: - ``self`` -- a quadratic form with base ring `\ZZ`, which we may - require to have integer Gram matrix. + require to have integer Gram matrix - OUTPUT: one of the strings: "even" or "odd" + OUTPUT: one of the strings: ``'even'`` or ``'odd'`` EXAMPLES:: @@ -141,7 +141,6 @@ def is_odd(self, allow_rescaling_flag=True): sage: Q = QuadraticForm(ZZ, 2, [1, 1, 1]) sage: Q.is_odd() False - """ return self.parity(allow_rescaling_flag) == "odd" @@ -165,7 +164,7 @@ def conway_species_list_at_odd_prime(self, p): - ``p`` -- a positive prime number - OUTPUT: a list of integers + OUTPUT: list of integers EXAMPLES:: @@ -180,7 +179,6 @@ def conway_species_list_at_odd_prime(self, p): [5, 2] sage: Q.conway_species_list_at_odd_prime(5) [-6, 1] - """ # Sanity Check: if not (p > 2 and is_prime(p)): @@ -231,7 +229,7 @@ def conway_species_list_at_2(self): The species of a zero dimensional form is always 0+, so we interpret the return value of zero as positive here! =) - OUTPUT: a list of integers + OUTPUT: list of integers EXAMPLES:: @@ -244,7 +242,6 @@ def conway_species_list_at_2(self): sage: Q = DiagonalQuadraticForm(ZZ, range(1,8)) sage: Q.conway_species_list_at_2() [1, 3, 1, 1, 1] - """ # Some useful variables n = self.dim() @@ -310,7 +307,7 @@ def conway_octane_of_this_unimodular_Jordan_block_at_2(self): unimodular blocks of size `\leq 2` and the `1 \times 1` blocks are all in the upper leftmost position. - OUTPUT: an integer `0 \leq x \leq 7` + OUTPUT: integer `0 \leq x \leq 7` EXAMPLES:: diff --git a/src/sage/quadratic_forms/quadratic_form__mass__Siegel_densities.py b/src/sage/quadratic_forms/quadratic_form__mass__Siegel_densities.py index 3feb363ddc3..e1b7c897032 100644 --- a/src/sage/quadratic_forms/quadratic_form__mass__Siegel_densities.py +++ b/src/sage/quadratic_forms/quadratic_form__mass__Siegel_densities.py @@ -23,7 +23,7 @@ from sage.rings.rational_field import QQ -def mass__by_Siegel_densities(self, odd_algorithm="Pall", even_algorithm="Watson"): +def mass__by_Siegel_densities(self, odd_algorithm='Pall', even_algorithm='Watson'): """ Return the mass of transformations (det 1 and -1). @@ -33,9 +33,10 @@ def mass__by_Siegel_densities(self, odd_algorithm="Pall", even_algorithm="Watson INPUT: - - ``odd_algorithm`` -- algorithm to be used when `p>2`; ``"Pall"`` (only one choice for now) - - ``even_algorithm`` -- algorithm to be used when `p=2`; - either ``"Kitaoka"`` or ``"Watson"`` (the default) + - ``odd_algorithm`` -- algorithm to be used when `p>2`; ``'Pall'`` (only + one choice for now) + - ``even_algorithm`` -- algorithm to be used when `p=2`; either + ``'Kitaoka'`` or ``'Watson'`` (the default) REFERENCES: @@ -267,7 +268,6 @@ def Kitaoka_mass_at_2(self): sage: Q = DiagonalQuadraticForm(ZZ, [1,1,1]) sage: Q.Kitaoka_mass_at_2() # WARNING: WE NEED TO CHECK THIS CAREFULLY! 1/2 - """ # Make a 0-dim'l quadratic form (for initialization purposes) Null_Form = deepcopy(self) @@ -352,7 +352,7 @@ def mass_at_two_by_counting_mod_power(self, k): INPUT: - - ``k`` -- an integer `\geq 1` + - ``k`` -- integer `\geq 1` OUTPUT: a rational number diff --git a/src/sage/quadratic_forms/quadratic_form__neighbors.py b/src/sage/quadratic_forms/quadratic_form__neighbors.py index 25566313812..15fb6ed2202 100644 --- a/src/sage/quadratic_forms/quadratic_form__neighbors.py +++ b/src/sage/quadratic_forms/quadratic_form__neighbors.py @@ -59,7 +59,7 @@ def find_primitive_p_divisible_vector__next(self, p, v=None): value is `p`-divisible, where the last vector returned was `v`. For an initial call, no `v` needs to be passed. - Return vectors whose last non-zero entry is normalized to 0 or 1 (so no + Return vectors whose last nonzero entry is normalized to 0 or 1 (so no lines are counted repeatedly). The ordering is by increasing the first non-normalized entry. If we have tested all (lines of) vectors, then return None. @@ -97,12 +97,12 @@ def find_primitive_p_divisible_vector__next(self, p, v=None): if n <= 1: raise NotImplementedError("Sorry -- Not implemented yet!") - # Look for the last non-zero entry (which must be 1) + # Look for the last nonzero entry (which must be 1) nz = n - 1 while w[nz] == 0: nz += -1 - # Test that the last non-zero entry is 1 (to detect tampering). + # Test that the last nonzero entry is 1 (to detect tampering). if w[nz] != 1: print("Warning: The input vector to QuadraticForm.find_primitive_p_divisible_vector__next() is not normalized properly.") @@ -124,7 +124,7 @@ def find_primitive_p_divisible_vector__next(self, p, v=None): w[j] = 0 if nz != 0: - # Move the non-zero normalized index over by one, or + # Move the nonzero normalized index over by one, or # return the zero vector w[nz - 1] = 1 nz += -1 @@ -153,8 +153,8 @@ def find_p_neighbor_from_vec(self, p, y, return_matrix=False): - ``p`` -- a prime number - ``y`` -- a vector with `q(y) \in p \ZZ` - - ``odd`` -- (default: ``False``) if `p=2`, return also odd neighbors - - ``return_matrix`` -- (boolean, default ``False``) return + - ``odd`` -- boolean (default: ``False``); if `p=2`, return also odd neighbors + - ``return_matrix`` -- boolean (default: ``False``); return the transformation matrix instead of the quadratic form EXAMPLES:: @@ -259,7 +259,7 @@ def neighbor_iteration(seeds, p, mass=None, max_classes=None, INPUT: - - ``seeds`` -- a list of quadratic forms in the same genus + - ``seeds`` -- list of quadratic forms in the same genus - ``p`` -- a prime number @@ -272,7 +272,7 @@ def neighbor_iteration(seeds, p, mass=None, max_classes=None, - ``max_random_trys`` -- (default: ``1000``) the maximum number of neighbors computed for a single lattice - OUTPUT: a list of quadratic forms + OUTPUT: list of quadratic forms EXAMPLES:: @@ -386,7 +386,7 @@ def orbits_lines_mod_p(self, p): - ``p`` -- a prime number - OUTPUT: a list of vectors over ``GF(p)`` + OUTPUT: list of vectors over ``GF(p)`` EXAMPLES:: diff --git a/src/sage/quadratic_forms/quadratic_form__split_local_covering.py b/src/sage/quadratic_forms/quadratic_form__split_local_covering.py index 226a723f2bf..a2eb1b4116f 100644 --- a/src/sage/quadratic_forms/quadratic_form__split_local_covering.py +++ b/src/sage/quadratic_forms/quadratic_form__split_local_covering.py @@ -36,7 +36,7 @@ def cholesky_decomposition(self, bit_prec=53): INPUT: - - ``bit_prec`` -- a natural number (default 53) + - ``bit_prec`` -- a natural number (default: 53) OUTPUT: an upper triangular real matrix of precision ``bit_prec`` @@ -55,7 +55,6 @@ def cholesky_decomposition(self, bit_prec=53): Finds the Cholesky decomposition of a quadratic form -- as an upper-triangular matrix! (It's assumed to be global, hence twice the form it refers to.) <-- Python revision asks: Is this true?!? =| - EXAMPLES:: sage: Q = DiagonalQuadraticForm(ZZ, [1,1,1]) @@ -118,7 +117,7 @@ def vectors_by_length(self, bound): INPUT: - - ``bound`` -- an integer `\geq 0` + - ``bound`` -- integer `\geq 0` OUTPUT: @@ -278,7 +277,7 @@ def complementary_subform_to_vector(self, v): INPUT: - - ``v`` -- a list of ``self.dim()`` integers + - ``v`` -- list of ``self.dim()`` integers OUTPUT: a :class:`QuadraticForm` over `\ZZ` @@ -312,7 +311,7 @@ def complementary_subform_to_vector(self, v): # Copy the quadratic form Q = deepcopy(self) - # Find the first non-zero component of v, and call it nz (Note: 0 <= nz < n) + # Find the first nonzero component of v, and call it nz (Note: 0 <= nz < n) nz = 0 while nz < n and v[nz] == 0: nz += 1 @@ -356,7 +355,7 @@ def complementary_subform_to_vector(self, v): def split_local_cover(self): r""" - Tries to find subform of the given (positive definite quaternary) + Try to find subform of the given (positive definite quaternary) quadratic form `Q` of the form .. MATH:: diff --git a/src/sage/quadratic_forms/quadratic_form__ternary_Tornaria.py b/src/sage/quadratic_forms/quadratic_form__ternary_Tornaria.py index cc7a6549312..0e447f982dd 100644 --- a/src/sage/quadratic_forms/quadratic_form__ternary_Tornaria.py +++ b/src/sage/quadratic_forms/quadratic_form__ternary_Tornaria.py @@ -53,7 +53,6 @@ def disc(self): 4 sage: DiagonalQuadraticForm(ZZ, [1,1,1,1]).disc() 16 - """ if is_odd(self.dim()): # This is not so good for characteristic 2. @@ -129,7 +128,6 @@ def adjoint(self): [ 39 2 8 ] [ * 19 4 ] [ * * 8 ] - """ from sage.quadratic_forms.quadratic_form import QuadraticForm as QuadraticForm diff --git a/src/sage/quadratic_forms/quadratic_form__theta.py b/src/sage/quadratic_forms/quadratic_form__theta.py index a784f2a4c88..2929751bea8 100644 --- a/src/sage/quadratic_forms/quadratic_form__theta.py +++ b/src/sage/quadratic_forms/quadratic_form__theta.py @@ -50,7 +50,6 @@ def theta_series(self, Max=10, var_str='q', safe_flag=True): 1 + 2*q + 2*q^3 + 6*q^4 + 2*q^5 + 4*q^6 + 6*q^7 + 8*q^8 + 14*q^9 + 4*q^10 + 12*q^11 + 18*q^12 + 12*q^13 + 12*q^14 + 8*q^15 + 34*q^16 + 12*q^17 + 8*q^18 + 32*q^19 + 10*q^20 + 28*q^21 + 16*q^23 + 44*q^24 + O(q^25) - """ # Sanity Check: Max is an integer or an allowed string: try: @@ -89,8 +88,8 @@ def theta_by_pari(self, Max, var_str='q', safe_flag=True): INPUT: - - ``Max`` -- an integer `\geq 0` - - ``var_str`` -- a string + - ``Max`` -- integer `\geq 0` + - ``var_str`` -- string OUTPUT: a power series or a vector @@ -103,7 +102,6 @@ def theta_by_pari(self, Max, var_str='q', safe_flag=True): ....: for i in range(1, Prec)] sage: compute == exact # needs sage.libs.pari True - """ # Try to use the cached result if it's enough precision if hasattr(self, '__theta_vec') and len(self.__theta_vec) >= Max: @@ -271,7 +269,7 @@ def theta_series_degree_2(Q, prec): INPUT: - - ``prec`` -- an integer + - ``prec`` -- integer OUTPUT: dictionary, where: diff --git a/src/sage/quadratic_forms/quadratic_form__variable_substitutions.py b/src/sage/quadratic_forms/quadratic_form__variable_substitutions.py index aa72053793b..ba3b26bacaa 100644 --- a/src/sage/quadratic_forms/quadratic_form__variable_substitutions.py +++ b/src/sage/quadratic_forms/quadratic_form__variable_substitutions.py @@ -84,7 +84,7 @@ def multiply_variable(self, c, i, in_place=False): - ``c`` -- an element of ``self.base_ring()`` - - ``i`` -- an integer `\geq 0` + - ``i`` -- integer `\geq 0` OUTPUT: a :class:`QuadraticForm` (by default, otherwise none) @@ -127,7 +127,7 @@ def divide_variable(self, c, i, in_place=False): - ``c`` -- an element of ``self.base_ring()`` - - ``i`` -- an integer `\geq 0` + - ``i`` -- integer `\geq 0` OUTPUT: @@ -218,7 +218,7 @@ def extract_variables(QF, var_indices): INPUT: - - ``var_indices`` -- a list of integers `\geq 0` + - ``var_indices`` -- list of integers `\geq 0` OUTPUT: a :class:`QuadraticForm` diff --git a/src/sage/quadratic_forms/random_quadraticform.py b/src/sage/quadratic_forms/random_quadraticform.py index 3e1789f14a2..fb36812bcbd 100644 --- a/src/sage/quadratic_forms/random_quadraticform.py +++ b/src/sage/quadratic_forms/random_quadraticform.py @@ -24,9 +24,9 @@ def random_quadraticform(R, n, rand_arg_list=None): INPUT: - ``R`` -- a ring - - ``n`` -- an integer `\ge 0` - - ``rand_arg_list`` -- a list of at most 3 arguments which can be taken by - ``R.random_element()``. + - ``n`` -- integer `\ge 0` + - ``rand_arg_list`` -- list of at most 3 arguments which can be taken by + ``R.random_element()`` OUTPUT: a quadratic form over the ring `R` @@ -134,8 +134,8 @@ def random_ternaryqf(rand_arg_list=None): INPUT: - - ``rand_arg_list`` -- a list of at most 3 arguments which can be taken by - ``R.random_element()``. + - ``rand_arg_list`` -- list of at most 3 arguments which can be taken by + ``R.random_element()`` OUTPUT: a ternary quadratic form diff --git a/src/sage/quadratic_forms/special_values.py b/src/sage/quadratic_forms/special_values.py index 2ee775e053d..43a325944cc 100644 --- a/src/sage/quadratic_forms/special_values.py +++ b/src/sage/quadratic_forms/special_values.py @@ -1,10 +1,10 @@ r""" Routines for computing special values of `L`-functions -- :func:`gamma__exact` -- Exact values of the `\Gamma` function at integers and half-integers -- :func:`zeta__exact` -- Exact values of the Riemann `\zeta` function at critical values -- :func:`quadratic_L_function__exact` -- Exact values of the Dirichlet L-functions of quadratic characters at critical values -- :func:`quadratic_L_function__numerical` -- Numerical values of the Dirichlet L-functions of quadratic characters in the domain of convergence +- :func:`gamma__exact` -- exact values of the `\Gamma` function at integers and half-integers +- :func:`zeta__exact` -- exact values of the Riemann `\zeta` function at critical values +- :func:`quadratic_L_function__exact` -- exact values of the Dirichlet L-functions of quadratic characters at critical values +- :func:`quadratic_L_function__numerical` -- numerical values of the Dirichlet L-functions of quadratic characters in the domain of convergence """ import sage.rings.abc @@ -96,7 +96,7 @@ def gamma__exact(n): def zeta__exact(n): r""" - Return the exact value of the Riemann Zeta function + Return the exact value of the Riemann Zeta function. The argument must be a critical value, namely either positive even or negative odd. diff --git a/src/sage/quadratic_forms/ternary.pyx b/src/sage/quadratic_forms/ternary.pyx index 1d439e46d29..345d6b962b3 100644 --- a/src/sage/quadratic_forms/ternary.pyx +++ b/src/sage/quadratic_forms/ternary.pyx @@ -594,7 +594,6 @@ def _find_zeros_mod_p_odd(long long a, long long b, long long c, long long r, lo (0, 32, 1) sage: Q((0, 32, 1)) 2018 - """ cdef long long a_i diff --git a/src/sage/quadratic_forms/ternary_qf.py b/src/sage/quadratic_forms/ternary_qf.py index 5debc32e846..79436ff4f77 100644 --- a/src/sage/quadratic_forms/ternary_qf.py +++ b/src/sage/quadratic_forms/ternary_qf.py @@ -52,11 +52,9 @@ class TernaryQF(SageObject): INPUT: - - ``v`` -- a list or tuple of 6 entries: ``[a,b,c,r,s,t]`` + - ``v`` -- list or tuple of 6 entries: ``[a,b,c,r,s,t]`` - OUTPUT: - - - the ternary quadratic form `a\cdot x^2 + b\cdot y^2 + c\cdot z^2 + r\cdot y\cdot z + s\cdot x\cdot z + t\cdot x\cdot y`. + OUTPUT: the ternary quadratic form `a\cdot x^2 + b\cdot y^2 + c\cdot z^2 + r\cdot y\cdot z + s\cdot x\cdot z + t\cdot x\cdot y` EXAMPLES:: @@ -117,7 +115,7 @@ def coefficients(self): def __hash__(self): """ - Returns a hash for self. + Return a hash for ``self``. EXAMPLES:: @@ -135,7 +133,7 @@ def coefficient(self, n): INPUT: - - ``n`` -- integer with `0 \leq n \leq 5`. + - ``n`` -- integer with `0 \leq n \leq 5` EXAMPLES:: @@ -426,7 +424,7 @@ def is_negative_definite(self) -> bool: def __neg__(self): """ - Return the ternary quadratic form with coefficients negatives of self. + Return the ternary quadratic form with coefficients negatives of ``self``. EXAMPLES:: @@ -951,7 +949,6 @@ def find_p_neighbors(self, p, mat=False): 1 sage: neig.count(Q2) 3 - """ z = self.find_zeros_mod_p(p) @@ -1309,8 +1306,6 @@ def _automorphisms_reduced_fast(self): sage: Q = TernaryQF([3, 4, 5, 3, 3, 2]) sage: Q._automorphisms_reduced_fast() [(1, 0, 0, 0, 1, 0, 0, 0, 1)] - - """ if self._border(1):