Skip to content

Commit a60b315

Browse files
author
Matthias Koeppe
committed
sage.matrix.misc*: Fix doctests
1 parent 79e7056 commit a60b315

File tree

3 files changed

+29
-26
lines changed

3 files changed

+29
-26
lines changed

src/sage/matrix/misc.pyx

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@ from .matrix_rational_sparse cimport Matrix_rational_sparse
2424

2525
matrix_integer_dense_rational_reconstruction = \
2626
LazyImport('sage.matrix.misc_flint', 'matrix_integer_dense_rational_reconstruction',
27-
deprecation=99999)
27+
deprecation=35758)
2828
hadamard_row_bound_mpfr = \
2929
LazyImport('sage.matrix.misc_mpfr', 'hadamard_row_bound_mpfr',
30-
deprecation=99999)
30+
deprecation=35758)
3131

3232

3333
def matrix_integer_sparse_rational_reconstruction(Matrix_integer_sparse A, Integer N):
@@ -39,7 +39,8 @@ def matrix_integer_sparse_rational_reconstruction(Matrix_integer_sparse A, Integ
3939
EXAMPLES::
4040
4141
sage: A = matrix(ZZ, 3, 4, [(1/3)%500, 2, 3, (-4)%500, 7, 2, 2, 3, 4, 3, 4, (5/7)%500], sparse=True)
42-
sage: sage.matrix.misc.matrix_integer_sparse_rational_reconstruction(A, 500)
42+
sage: from sage.matrix.misc import matrix_integer_sparse_rational_reconstruction
43+
sage: matrix_integer_sparse_rational_reconstruction(A, 500)
4344
[1/3 2 3 -4]
4445
[ 7 2 2 3]
4546
[ 4 3 4 5/7]
@@ -329,29 +330,30 @@ def cmp_pivots(x, y):
329330
"""
330331
Compare two sequences of pivot columns.
331332
332-
If x is shorter than y, return -1, i.e., x < y, "not as good".
333-
If x is longer than y, then x > y, so "better" and return +1.
334-
If the length is the same, then x is better, i.e., x > y
335-
if the entries of x are correspondingly <= those of y with
333+
If `x` is shorter than `y`, return `-1`, i.e., `x < y`, "not as good".
334+
If `x` is longer than `y`, then `x > y`, so "better" and return `+1`.
335+
If the length is the same, then `x` is better, i.e., `x > y`
336+
if the entries of `x` are correspondingly `\leq` those of `y` with
336337
one being strictly less.
337338
338339
INPUT:
339340
340-
- x, y -- lists or tuples of integers
341+
- ``x``, ``y`` -- lists or tuples of integers
341342
342343
EXAMPLES:
343344
344345
We illustrate each of the above comparisons. ::
345346
346-
sage: sage.matrix.misc.cmp_pivots([1,2,3], [4,5,6,7])
347+
sage: from sage.matrix.misc import cmp_pivots
348+
sage: cmp_pivots([1,2,3], [4,5,6,7])
347349
-1
348-
sage: sage.matrix.misc.cmp_pivots([1,2,3,5], [4,5,6])
350+
sage: cmp_pivots([1,2,3,5], [4,5,6])
349351
1
350-
sage: sage.matrix.misc.cmp_pivots([1,2,4], [1,2,3])
352+
sage: cmp_pivots([1,2,4], [1,2,3])
351353
-1
352-
sage: sage.matrix.misc.cmp_pivots([1,2,3], [1,2,3])
354+
sage: cmp_pivots([1,2,3], [1,2,3])
353355
0
354-
sage: sage.matrix.misc.cmp_pivots([1,2,3], [1,2,4])
356+
sage: cmp_pivots([1,2,3], [1,2,4])
355357
1
356358
"""
357359
x = tuple(x)

src/sage/matrix/misc_flint.pyx

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,18 +21,19 @@ def matrix_integer_dense_rational_reconstruction(Matrix_integer_dense A, Integer
2121
"""
2222
Given a matrix over the integers and an integer modulus, do
2323
rational reconstruction on all entries of the matrix, viewed as
24-
numbers mod N. This is done efficiently by assuming there is a
24+
numbers mod `N`. This is done efficiently by assuming there is a
2525
large common factor dividing the denominators.
2626
2727
INPUT:
2828
29-
A -- matrix
30-
N -- an integer
29+
- ``A`` -- matrix
30+
- ``N`` -- an integer
3131
3232
EXAMPLES::
3333
3434
sage: B = ((matrix(ZZ, 3,4, [1,2,3,-4,7,2,18,3,4,3,4,5])/3)%500).change_ring(ZZ)
35-
sage: sage.matrix.misc.matrix_integer_dense_rational_reconstruction(B, 500)
35+
sage: from sage.matrix.misc import matrix_integer_dense_rational_reconstruction
36+
sage: matrix_integer_dense_rational_reconstruction(B, 500)
3637
[ 1/3 2/3 1 -4/3]
3738
[ 7/3 2/3 6 1]
3839
[ 4/3 1 4/3 5/3]
@@ -42,7 +43,7 @@ def matrix_integer_dense_rational_reconstruction(Matrix_integer_dense A, Integer
4243
Check that :trac:`9345` is fixed::
4344
4445
sage: A = random_matrix(ZZ, 3)
45-
sage: sage.matrix.misc.matrix_integer_dense_rational_reconstruction(A, 0)
46+
sage: matrix_integer_dense_rational_reconstruction(A, 0)
4647
Traceback (most recent call last):
4748
...
4849
ZeroDivisionError: The modulus cannot be zero

src/sage/matrix/misc_mpfr.pyx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,31 +14,31 @@ from .matrix0 cimport Matrix
1414

1515
def hadamard_row_bound_mpfr(Matrix A):
1616
"""
17-
Given a matrix A with entries that coerce to RR, compute the row
17+
Given a matrix `A` with entries that coerce to ``RR``, compute the row
1818
Hadamard bound on the determinant.
1919
2020
INPUT:
2121
22-
A -- a matrix over RR
22+
- ``A`` -- a matrix over ``RR``
2323
2424
OUTPUT:
2525
26-
integer -- an integer n such that the absolute value of the
27-
determinant of this matrix is at most $10^n$.
26+
integer -- an integer n such that the absolute value of the
27+
determinant of this matrix is at most `10^n`.
2828
2929
EXAMPLES:
3030
3131
We create a very large matrix, compute the row Hadamard bound,
3232
and also compute the row Hadamard bound of the transpose, which
3333
happens to be sharp. ::
3434
35-
sage: a = matrix(ZZ, 2, [2^10000,3^10000,2^50,3^19292])
36-
sage: import sage.matrix.misc
37-
sage: sage.matrix.misc.hadamard_row_bound_mpfr(a.change_ring(RR))
35+
sage: a = matrix(ZZ, 2, [2^10000, 3^10000, 2^50, 3^19292])
36+
sage: from sage.matrix.misc import hadamard_row_bound_mpfr
37+
sage: hadamard_row_bound_mpfr(a.change_ring(RR))
3838
13976
3939
sage: len(str(a.det()))
4040
12215
41-
sage: sage.matrix.misc.hadamard_row_bound_mpfr(a.transpose().change_ring(RR))
41+
sage: hadamard_row_bound_mpfr(a.transpose().change_ring(RR))
4242
12215
4343
4444
Note that in the above example using RDF would overflow::

0 commit comments

Comments
 (0)