Skip to content

Commit fc36e24

Browse files
author
Matthias Koeppe
committed
Use more block tags, update # needs
1 parent adb22d5 commit fc36e24

12 files changed

+257
-234
lines changed

src/sage/matrix/matrix0.pyx

Lines changed: 32 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1926,11 +1926,12 @@ cdef class Matrix(sage.structure.element.Matrix):
19261926
19271927
Prior to :trac:`11544` this could take a full minute to run (2011). ::
19281928
1929+
sage: # needs sage.rings.number_field
19291930
sage: A = matrix(QQ, 4, 4, [1, 2, -2, 2, 1, 0, -1, -1, 0, -1, 1, 1, -1, 2, 1/2, 0])
1930-
sage: e = A.eigenvalues()[3] # needs sage.rings.number_field
1931-
sage: K = (A - e).kernel() # needs sage.rings.number_field
1932-
sage: P = K.basis_matrix() # needs sage.rings.number_field
1933-
sage: P.str() # needs sage.rings.number_field
1931+
sage: e = A.eigenvalues()[3]
1932+
sage: K = (A - e).kernel()
1933+
sage: P = K.basis_matrix()
1934+
sage: P.str()
19341935
'[ 1.000000000000000? + 0.?e-17*I -2.116651487479748? + 0.0255565807096352?*I -0.2585224251020429? + 0.2886023409047535?*I -0.4847545623533090? - 1.871890760086142?*I]'
19351936
19361937
Use single-row delimiters where appropriate::
@@ -2946,7 +2947,7 @@ cdef class Matrix(sage.structure.element.Matrix):
29462947
Traceback (most recent call last):
29472948
...
29482949
TypeError: Multiplying row by Symbolic Ring element cannot be done over
2949-
Rational Field, use change_ring or with_added_multiple_of_row instead.
2950+
Rational Field, use change_ring or with_added_multiple_of_row instead.
29502951
"""
29512952
self.check_row_bounds_and_mutability(i,j)
29522953
try:
@@ -3031,7 +3032,7 @@ cdef class Matrix(sage.structure.element.Matrix):
30313032
Traceback (most recent call last):
30323033
...
30333034
TypeError: Multiplying column by Symbolic Ring element cannot be done over
3034-
Rational Field, use change_ring or with_added_multiple_of_column instead.
3035+
Rational Field, use change_ring or with_added_multiple_of_column instead.
30353036
"""
30363037
self.check_column_bounds_and_mutability(i,j)
30373038
try:
@@ -3135,7 +3136,8 @@ cdef class Matrix(sage.structure.element.Matrix):
31353136
sage: a.rescale_row(1,1/2)
31363137
Traceback (most recent call last):
31373138
...
3138-
TypeError: Rescaling row by Rational Field element cannot be done over Integer Ring, use change_ring or with_rescaled_row instead.
3139+
TypeError: Rescaling row by Rational Field element cannot be done
3140+
over Integer Ring, use change_ring or with_rescaled_row instead.
31393141
31403142
To rescale the matrix by 1/2, you must change the base ring to the
31413143
rationals::
@@ -3249,7 +3251,8 @@ cdef class Matrix(sage.structure.element.Matrix):
32493251
sage: a.rescale_col(2,1/2)
32503252
Traceback (most recent call last):
32513253
...
3252-
TypeError: Rescaling column by Rational Field element cannot be done over Integer Ring, use change_ring or with_rescaled_col instead.
3254+
TypeError: Rescaling column by Rational Field element cannot be done
3255+
over Integer Ring, use change_ring or with_rescaled_col instead.
32533256
32543257
To rescale the matrix by 1/2, you must change the base ring to the
32553258
rationals::
@@ -3940,21 +3943,21 @@ cdef class Matrix(sage.structure.element.Matrix):
39403943

39413944
def is_symmetric(self):
39423945
"""
3943-
Return True if this is a symmetric matrix.
3946+
Return ``True`` if this is a symmetric matrix.
39443947
39453948
A symmetric matrix is necessarily square.
39463949
39473950
EXAMPLES::
39483951
3949-
sage: m=Matrix(QQ,2,range(0,4))
3952+
sage: m = Matrix(QQ, 2, range(0,4))
39503953
sage: m.is_symmetric()
39513954
False
39523955
3953-
sage: m=Matrix(QQ,2,(1,1,1,1,1,1))
3956+
sage: m = Matrix(QQ, 2, (1,1,1,1,1,1))
39543957
sage: m.is_symmetric()
39553958
False
39563959
3957-
sage: m=Matrix(QQ,1,(2,))
3960+
sage: m = Matrix(QQ, 1, (2,))
39583961
sage: m.is_symmetric()
39593962
True
39603963
@@ -4901,7 +4904,7 @@ cdef class Matrix(sage.structure.element.Matrix):
49014904
Over finite fields::
49024905
49034906
sage: A = matrix(GF(59), 3, [10,56,39,53,56,33,58,24,55])
4904-
sage: A.multiplicative_order() # needs sage.rings.finite_rings
4907+
sage: A.multiplicative_order() # needs sage.groups
49054908
580
49064909
sage: (A^580).is_one()
49074910
True
@@ -5243,7 +5246,7 @@ cdef class Matrix(sage.structure.element.Matrix):
52435246
sage: R.<x,y> = FreeAlgebra(QQ,2)
52445247
sage: a = matrix(2, 2, [1,2,x*y,y*x])
52455248
sage: b = matrix(2, 2, [1,2,y*x,y*x])
5246-
sage: a - b # indirect doctest
5249+
sage: a - b # indirect doctest
52475250
[ 0 0]
52485251
[x*y - y*x 0]
52495252
@@ -5316,11 +5319,12 @@ cdef class Matrix(sage.structure.element.Matrix):
53165319
[ x*y x^2*y x*y^2]
53175320
[ -x^2*y^2 x^2*y + x*y^2 x^2*y - x*y^2]
53185321
5319-
sage: R.<x,y> = FreeAlgebra(ZZ,2) # needs sage.combinat
5322+
sage: # needs sage.combinat
5323+
sage: R.<x,y> = FreeAlgebra(ZZ,2)
53205324
sage: a = matrix(R, 2, 3, [1,x,y, -x*y,x+y,x-y]); a
53215325
[ 1 x y]
53225326
[ -x*y x + y x - y]
5323-
sage: (x*y) * a # indirect doctest # needs sage.combinat
5327+
sage: (x*y) * a # indirect doctest
53245328
[ x*y x*y*x x*y^2]
53255329
[ -x*y*x*y x*y*x + x*y^2 x*y*x - x*y^2]
53265330
"""
@@ -5361,11 +5365,12 @@ cdef class Matrix(sage.structure.element.Matrix):
53615365
[ x*y y^2]
53625366
[x^2*y y^3]
53635367
5364-
sage: R.<x,y> = FreeAlgebra(ZZ,2) # needs sage.combinat
5365-
sage: a = matrix(R, 2, 3, [1,x,y, -x*y,x+y,x-y]); a # needs sage.combinat
5368+
sage: # needs sage.combinat
5369+
sage: R.<x,y> = FreeAlgebra(ZZ,2)
5370+
sage: a = matrix(R, 2, 3, [1,x,y, -x*y,x+y,x-y]); a
53665371
[ 1 x y]
53675372
[ -x*y x + y x - y]
5368-
sage: a * (x*y) # needs sage.combinat
5373+
sage: a * (x*y)
53695374
[ x*y x^2*y y*x*y]
53705375
[ -x*y*x*y x^2*y + y*x*y x^2*y - y*x*y]
53715376
"""
@@ -5396,10 +5401,10 @@ cdef class Matrix(sage.structure.element.Matrix):
53965401
[ 1 -x*y]
53975402
[ x x + y]
53985403
[ y x - y]
5399-
sage: a*b # indirect doctest
5404+
sage: a*b # indirect doctest
54005405
[ x^2 + y^2 + 1 x^2 + x*y - y^2]
54015406
[ x^2 + x*y - y^2 x^2*y^2 + 2*x^2 + 2*y^2]
5402-
sage: b*a # indirect doctest
5407+
sage: b*a # indirect doctest
54035408
[ x^2*y^2 + 1 -x^2*y - x*y^2 + x -x^2*y + x*y^2 + y]
54045409
[ -x^2*y - x*y^2 + x 2*x^2 + 2*x*y + y^2 x^2 + x*y - y^2]
54055410
[ -x^2*y + x*y^2 + y x^2 + x*y - y^2 x^2 - 2*x*y + 2*y^2]
@@ -5487,7 +5492,9 @@ cdef class Matrix(sage.structure.element.Matrix):
54875492
sage: a*v
54885493
Traceback (most recent call last):
54895494
...
5490-
TypeError: unsupported operand parent(s) for *: 'Full MatrixSpace of 2 by 3 dense matrices over Integer Ring' and 'Ambient free module of rank 2 over the principal ideal domain Integer Ring'
5495+
TypeError: unsupported operand parent(s) for *:
5496+
'Full MatrixSpace of 2 by 3 dense matrices over Integer Ring' and
5497+
'Ambient free module of rank 2 over the principal ideal domain Integer Ring'
54915498
54925499
This illustrates how coercion works::
54935500
@@ -5672,8 +5679,9 @@ cdef class Matrix(sage.structure.element.Matrix):
56725679
56735680
Matrices over p-adics. See :trac:`17272` ::
56745681
5675-
sage: R = ZpCA(5, 5, print_mode='val-unit') # needs sage.rings.padics
5676-
sage: A = matrix(R, 3, 3, [250,2369,1147,106,927,362,90,398,2483]) # needs sage.rings.padics
5682+
sage: # needs sage.rings.padics
5683+
sage: R = ZpCA(5, 5, print_mode='val-unit')
5684+
sage: A = matrix(R, 3, 3, [250,2369,1147,106,927,362,90,398,2483])
56775685
sage: A
56785686
[5^3 * 2 + O(5^5) 2369 + O(5^5) 1147 + O(5^5)]
56795687
[ 106 + O(5^5) 927 + O(5^5) 362 + O(5^5)]

src/sage/matrix/special.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2449,9 +2449,9 @@ def random_rref_matrix(parent, num_pivots):
24492449
24502450
sage: B = random_matrix(FiniteField(7), 4, 4,
24512451
....: algorithm='echelon_form', num_pivots=3); B
2452-
[1 0 0 0]
2453-
[0 1 0 6]
2454-
[0 0 1 4]
2452+
[1 0 0 5]
2453+
[0 1 0 2]
2454+
[0 0 1 6]
24552455
[0 0 0 0]
24562456
sage: B.rank() == 3
24572457
True

src/sage/modules/free_module.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2776,7 +2776,7 @@ def coordinate_module(self, V):
27762776
27772777
sage: M = ModularSymbols(54) # needs sage.modular
27782778
sage: S = M.cuspidal_subspace() # needs sage.modular
2779-
sage: K = S.integral_structure(); K
2779+
sage: K = S.integral_structure(); K # needs sage.modular
27802780
Free module of degree 19 and rank 8 over Integer Ring
27812781
Echelon basis matrix:
27822782
[ 0 1 0 0 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 0]
@@ -2786,12 +2786,12 @@ def coordinate_module(self, V):
27862786
Echelon basis matrix:
27872787
[ 0 1 1 0 -2 1 -1 1 -1 -2 2 0 0 0 0 0 0 0 0]
27882788
[ 0 0 3 0 -3 2 -1 2 -1 -4 2 -1 -2 1 2 0 0 -1 1]
2789-
sage: K.coordinate_module(L)
2789+
sage: K.coordinate_module(L) # needs sage.modular
27902790
Free module of degree 8 and rank 2 over Integer Ring
27912791
User basis matrix:
27922792
[ 1 1 1 -1 1 -1 0 0]
27932793
[ 0 3 2 -1 2 -1 -1 -2]
2794-
sage: K.coordinate_module(L).basis_matrix() * K.basis_matrix()
2794+
sage: K.coordinate_module(L).basis_matrix() * K.basis_matrix() # needs sage.modular
27952795
[ 0 1 1 0 -2 1 -1 1 -1 -2 2 0 0 0 0 0 0 0 0]
27962796
[ 0 0 3 0 -3 2 -1 2 -1 -4 2 -1 -2 1 2 0 0 -1 1]
27972797
"""
@@ -3816,7 +3816,7 @@ def intersection(self, other):
38163816
sage: V = L**3
38173817
sage: W1 = V.span([[0,w/5,0], [1,0,-1/17]], OL) # needs sage.rings.number_field
38183818
sage: W2 = V.span([[0,(1-w)/5,0]], OL) # needs sage.rings.number_field
3819-
sage: W1.intersection(W2)
3819+
sage: W1.intersection(W2) # needs sage.rings.number_field
38203820
Free module of degree 3 and rank 1 over Maximal Order in
38213821
Number Field in w with defining polynomial x^2 - x + 2
38223822
Echelon basis matrix:

0 commit comments

Comments
 (0)