Skip to content

Commit

Permalink
Docstring edits
Browse files Browse the repository at this point in the history
Work in `quadratic_forms`.
  • Loading branch information
gmou3 committed Jun 28, 2024
1 parent 07dd3f3 commit eb1f83b
Show file tree
Hide file tree
Showing 43 changed files with 250 additions and 314 deletions.
2 changes: 1 addition & 1 deletion src/sage/algebras/hecke_algebras/cubic_hecke_matrix_rep.py
Original file line number Diff line number Diff line change
Expand Up @@ -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::
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/sage/combinat/designs/difference_family.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]_.
Expand Down
2 changes: 1 addition & 1 deletion src/sage/combinat/enumeration_mod_permgroup.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -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::
Expand Down
10 changes: 5 additions & 5 deletions src/sage/data_structures/bitset_base.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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``.
"""
Expand Down Expand Up @@ -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``.
Expand Down Expand Up @@ -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``.
Expand All @@ -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``.
Expand Down
2 changes: 1 addition & 1 deletion src/sage/data_structures/blas_dict.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -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`.
"""
Expand Down
4 changes: 2 additions & 2 deletions src/sage/data_structures/sparse_bitset.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/sage/dynamics/arithmetic_dynamics/wehlerK3.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion src/sage/libs/giac/giac.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 6 additions & 6 deletions src/sage/manifolds/differentiable/integrated_curve.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]})
Expand All @@ -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)
Expand Down Expand Up @@ -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)
Expand All @@ -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]})
Expand All @@ -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]})
Expand Down Expand Up @@ -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})
Expand Down
2 changes: 1 addition & 1 deletion src/sage/manifolds/differentiable/tangent_vector.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions src/sage/modules/tutorial_free_modules.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
34 changes: 17 additions & 17 deletions src/sage/quadratic_forms/binary_qf.py
Original file line number Diff line number Diff line change
Expand Up @@ -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::
Expand Down Expand Up @@ -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::
Expand Down Expand Up @@ -831,17 +831,17 @@ 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``.
INPUT:
- ``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:
Expand Down Expand Up @@ -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::
Expand All @@ -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
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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:
Expand Down
7 changes: 3 additions & 4 deletions src/sage/quadratic_forms/constructions.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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::
Expand Down
Loading

0 comments on commit eb1f83b

Please sign in to comment.