Skip to content

Commit adb22d5

Browse files
author
Matthias Koeppe
committed
Use more block tags
1 parent 8833cf9 commit adb22d5

9 files changed

+230
-236
lines changed

src/sage/matrix/args.pyx

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -194,24 +194,27 @@ cdef class MatrixArgs:
194194
<MatrixArgs for Full MatrixSpace of 2 by 2 dense matrices over Integer Ring; typ=SEQ_FLAT; entries=(1, 2, 3, 4)>
195195
[1 2]
196196
[3 4]
197-
sage: ma = MatrixArgs(QQ, entries=pari("[1,2;3,4]")); ma.finalized() # needs sage.libs.pari
197+
198+
sage: # needs sage.libs.pari
199+
sage: ma = MatrixArgs(QQ, entries=pari("[1,2;3,4]")); ma.finalized()
198200
<MatrixArgs for Full MatrixSpace of 2 by 2 dense matrices
199201
over Rational Field; typ=SEQ_FLAT; entries=[1, 2, 3, 4]>
200202
sage: ma.matrix()
201203
[1 2]
202204
[3 4]
203-
sage: ma = MatrixArgs(QQ, 2, 2, entries=pari("[1,2,3,4]")); ma.finalized() # needs sage.libs.pari
205+
sage: ma = MatrixArgs(QQ, 2, 2, entries=pari("[1,2,3,4]")); ma.finalized()
204206
<MatrixArgs for Full MatrixSpace of 2 by 2 dense matrices
205207
over Rational Field; typ=SEQ_FLAT; entries=[1, 2, 3, 4]>
206208
sage: ma.matrix()
207209
[1 2]
208210
[3 4]
209-
sage: ma = MatrixArgs(QQ, 2, 2, entries=pari("3/5")); ma.finalized() # needs sage.libs.pari
211+
sage: ma = MatrixArgs(QQ, 2, 2, entries=pari("3/5")); ma.finalized()
210212
<MatrixArgs for Full MatrixSpace of 2 by 2 dense matrices
211213
over Rational Field; typ=SCALAR; entries=3/5>
212-
sage: ma.matrix() # needs sage.libs.pari
214+
sage: ma.matrix()
213215
[3/5 0]
214216
[ 0 3/5]
217+
215218
sage: ma = MatrixArgs(entries=matrix(2,2)); ma.finalized(); ma.matrix()
216219
<MatrixArgs for Full MatrixSpace of 2 by 2 dense matrices over Integer Ring; typ=MATRIX; entries=[0 0]
217220
[0 0]>
@@ -225,33 +228,37 @@ cdef class MatrixArgs:
225228
<MatrixArgs for Full MatrixSpace of 2 by 2 dense matrices over Integer Ring; typ=CALLABLE; entries=<function ...>>
226229
[1 2]
227230
[3 4]
228-
sage: from numpy import array # needs numpy
229-
sage: ma = MatrixArgs(array([[1,2],[3,4]])); ma.finalized() # needs numpy
231+
232+
sage: # needs numpy
233+
sage: from numpy import array
234+
sage: ma = MatrixArgs(array([[1,2],[3,4]])); ma.finalized()
230235
<MatrixArgs for Full MatrixSpace of 2 by 2 dense matrices
231236
over Integer Ring; typ=SEQ_SEQ; entries=array([[1, 2], [3, 4]])>
232237
sage: ma.matrix()
233238
[1 2]
234239
[3 4]
235-
sage: ma = MatrixArgs(array([[1.,2.],[3.,4.]])); ma.finalized() # needs numpy
240+
sage: ma = MatrixArgs(array([[1.,2.],[3.,4.]])); ma.finalized()
236241
<MatrixArgs for Full MatrixSpace of 2 by 2 dense matrices
237242
over Real Double Field; typ=MATRIX; entries=[1.0 2.0]
238243
[3.0 4.0]>
239244
sage: ma.matrix()
240245
[1.0 2.0]
241246
[3.0 4.0]
242-
sage: ma = MatrixArgs(RealField(20), array([[1.,2.],[3.,4.]])); ma.finalized() # needs numpy
247+
sage: ma = MatrixArgs(RealField(20), array([[1.,2.],[3.,4.]])); ma.finalized()
243248
<MatrixArgs for Full MatrixSpace of 2 by 2 dense matrices over Real Field
244249
with 20 bits of precision; typ=MATRIX; entries=[1.0 2.0]
245250
[3.0 4.0]>
246-
sage: ma.matrix() # needs numpy
251+
sage: ma.matrix()
247252
[1.0000 2.0000]
248253
[3.0000 4.0000]
249-
sage: ma = MatrixArgs(graphs.CycleGraph(3)); ma.finalized() # needs sage.graphs
254+
255+
sage: # needs sage.graphs
256+
sage: ma = MatrixArgs(graphs.CycleGraph(3)); ma.finalized()
250257
<MatrixArgs for Full MatrixSpace of 3 by 3 dense matrices
251258
over Integer Ring; typ=MATRIX; entries=[0 1 1]
252259
[1 0 1]
253260
[1 1 0]>
254-
sage: ma.matrix() # needs sage.graphs
261+
sage: ma.matrix()
255262
[0 1 1]
256263
[1 0 1]
257264
[1 1 0]

src/sage/matrix/constructor.pyx

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -456,53 +456,54 @@ def matrix(*args, **kwds):
456456
457457
Check conversion from numpy::
458458
459-
sage: import numpy # needs numpy
460-
sage: n = numpy.array([[complex(0,1),complex(0,2)], [3,4]], complex) # needs numpy
461-
sage: m = matrix(n); m; m.parent() # needs numpy
459+
sage: # needs numpy
460+
sage: import numpy
461+
sage: n = numpy.array([[complex(0,1),complex(0,2)], [3,4]], complex)
462+
sage: m = matrix(n); m; m.parent()
462463
[1.0*I 2.0*I]
463464
[ 3.0 4.0]
464465
Full MatrixSpace of 2 by 2 dense matrices over Complex Double Field
465-
sage: n = numpy.array([[1,2], [3,4]], 'int32') # needs numpy
466-
sage: m = matrix(n); m; m.parent() # needs numpy
466+
sage: n = numpy.array([[1,2], [3,4]], 'int32')
467+
sage: m = matrix(n); m; m.parent()
467468
[1 2]
468469
[3 4]
469470
Full MatrixSpace of 2 by 2 dense matrices over Integer Ring
470-
sage: n = numpy.array([[1,2,3], [4,5,6], [7,8,9]], 'float32') # needs numpy
471-
sage: m = matrix(n); m; m.parent() # needs numpy
471+
sage: n = numpy.array([[1,2,3], [4,5,6], [7,8,9]], 'float32')
472+
sage: m = matrix(n); m; m.parent()
472473
[1.0 2.0 3.0]
473474
[4.0 5.0 6.0]
474475
[7.0 8.0 9.0]
475476
Full MatrixSpace of 3 by 3 dense matrices over Real Double Field
476-
sage: n = numpy.matrix([[1,2,3], [4,5,6], [7,8,9]], 'float64') # needs numpy
477-
sage: m = matrix(n); m; m.parent() # needs numpy
477+
sage: n = numpy.matrix([[1,2,3], [4,5,6], [7,8,9]], 'float64')
478+
sage: m = matrix(n); m; m.parent()
478479
[1.0 2.0 3.0]
479480
[4.0 5.0 6.0]
480481
[7.0 8.0 9.0]
481482
Full MatrixSpace of 3 by 3 dense matrices over Real Double Field
482-
sage: n = numpy.array([[1,2,3], [4,5,6], [7,8,9]], 'complex64') # needs numpy
483-
sage: m = matrix(n); m; m.parent() # needs numpy
483+
sage: n = numpy.array([[1,2,3], [4,5,6], [7,8,9]], 'complex64')
484+
sage: m = matrix(n); m; m.parent()
484485
[1.0 2.0 3.0]
485486
[4.0 5.0 6.0]
486487
[7.0 8.0 9.0]
487488
Full MatrixSpace of 3 by 3 dense matrices over Complex Double Field
488-
sage: n = numpy.matrix([[1,2,3], [4,5,6], [7,8,9]], 'complex128') # needs numpy
489-
sage: m = matrix(n); m; m.parent() # needs numpy
489+
sage: n = numpy.matrix([[1,2,3], [4,5,6], [7,8,9]], 'complex128')
490+
sage: m = matrix(n); m; m.parent()
490491
[1.0 2.0 3.0]
491492
[4.0 5.0 6.0]
492493
[7.0 8.0 9.0]
493494
Full MatrixSpace of 3 by 3 dense matrices over Complex Double Field
494495
sage: a = matrix([[1,2], [3,4]])
495-
sage: b = matrix(a.numpy()); b # needs numpy
496+
sage: b = matrix(a.numpy()); b
496497
[1 2]
497498
[3 4]
498-
sage: a == b # needs numpy
499+
sage: a == b
499500
True
500-
sage: c = matrix(a.numpy('float32')); c # needs numpy
501+
sage: c = matrix(a.numpy('float32')); c
501502
[1.0 2.0]
502503
[3.0 4.0]
503-
sage: matrix(numpy.array([[5]])) # needs numpy
504+
sage: matrix(numpy.array([[5]]))
504505
[5]
505-
sage: matrix(numpy.matrix([[5]])) # needs numpy
506+
sage: matrix(numpy.matrix([[5]]))
506507
[5]
507508
508509
A ring and a numpy array::

src/sage/matrix/matrix_generic_dense.pyx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,12 +69,13 @@ cdef class Matrix_generic_dense(matrix_dense.Matrix_dense):
6969
We check that the problem related to :trac:`9049` is not an issue any
7070
more::
7171
72+
sage: # needs sage.rings.number_field
7273
sage: S.<t> = PolynomialRing(QQ)
73-
sage: F.<q> = QQ.extension(t^4 + 1) # needs sage.rings.number_field
74-
sage: R.<x,y> = PolynomialRing(F) # needs sage.rings.number_field
75-
sage: M = MatrixSpace(R, 1, 2) # needs sage.rings.number_field
74+
sage: F.<q> = QQ.extension(t^4 + 1)
75+
sage: R.<x,y> = PolynomialRing(F)
76+
sage: M = MatrixSpace(R, 1, 2)
7677
sage: from sage.matrix.matrix_generic_dense import Matrix_generic_dense
77-
sage: Matrix_generic_dense(M, (x, y), True, True) # needs sage.rings.number_field
78+
sage: Matrix_generic_dense(M, (x, y), True, True)
7879
[x y]
7980
"""
8081
ma = MatrixArgs_init(parent, entries)

0 commit comments

Comments
 (0)