# HG changeset patch
# Parent e6342acc32daf541a4670ee1f4539c3e2a28a21a
# User Keshav Kini
# Date 1300759270 25200
minor formatting
diff --git a/sage/matrix/matrix1.pyx b/sage/matrix/matrix1.pyx
--- a/sage/matrix/matrix1.pyx
+++ b/sage/matrix/matrix1.pyx
@@ -981,9 +981,9 @@
return V(tmp, coerce=False, copy=False, check=False)
- ############################################################################################
+ ###########################################################################
# Building matrices out of other matrices, rows, or columns
- ############################################################################################
+ ###########################################################################
def stack(self, bottom, subdivide=False):
r"""
Returns a new matrix formed by appending the matrix
@@ -1185,13 +1185,15 @@
if hasattr(bottom, '_vector_'):
bottom = bottom.row()
if not isinstance(bottom, sage.matrix.matrix1.Matrix):
- raise TypeError('a matrix must be stacked with another matrix, or a vector')
+ raise TypeError('a matrix must be stacked with another matrix, or '
+ 'a vector')
cdef Matrix other
other = bottom
if self._ncols != other._ncols:
- raise TypeError('number of columns must be the same, {0} != {1}'.format(self._ncols, other._ncols))
+ raise TypeError('number of columns must be the same, '
+ '{0} != {1}'.format(self._ncols, other._ncols))
if not (self._base_ring is other.base_ring()):
other = other.change_ring(self._base_ring)
@@ -1215,8 +1217,8 @@
def augment(self, right, subdivide=False):
r"""
- Returns a new matrix formed by appending the matrix
- (or vector) ``right`` on the right side of ``self``.
+ Returns a new matrix formed by appending the matrix (or vector)
+ ``right`` on the right side of ``self``.
INPUT:
@@ -1224,32 +1226,32 @@
dimensions are compatible with ``self``.
- ``subdivide`` - default: ``False`` - request the resulting
- matrix to have a new subdivision, separating ``self`` from ``right``.
+ matrix to have a new subdivision, separating ``self`` from
+ ``right``.
OUTPUT:
- A new matrix formed by appending ``right`` onto the right side of ``self``.
- If ``right`` is a vector (or free module element) then in this context
- it is appropriate to consider it as a column vector. (The code first
- converts a vector to a 1-column matrix.)
+ A new matrix formed by appending ``right`` onto the right side
+ of ``self``. If ``right`` is a vector (or free module element)
+ then in this context it is appropriate to consider it as a
+ column vector. (The code first converts a vector to a 1-column
+ matrix.)
If ``subdivide`` is ``True`` then any column subdivisions for
the two matrices are preserved, and a new subdivision is added
between ``self`` and ``right``. If the row divisions are
- identical, then they are preserved, otherwise they are discarded.
- When ``subdivide`` is ``False`` there is no subdivision information
- in the result.
+ identical, then they are preserved, otherwise they are
+ discarded. When ``subdivide`` is ``False`` there is no
+ subdivision information in the result.
.. warning::
If ``subdivide`` is ``True`` then unequal row subdivisions
- will be discarded, since it would be ambiguous how to interpret
- them. If the subdivision behavior is not what you need,
- you can manage subdivisions yourself with methods like
- :meth:`~sage.matrix.matrix2.Matrix.get_subdivisions`
- and
- :meth:`~sage.matrix.matrix2.Matrix.subdivide`.
- You might also find :func:`~sage.matrix.constructor.block_matrix`
- or
+ will be discarded, since it would be ambiguous how to
+ interpret them. If the subdivision behavior is not what you
+ need, you can manage subdivisions yourself with methods like
+ :meth:`~sage.matrix.matrix2.Matrix.get_subdivisions` and
+ :meth:`~sage.matrix.matrix2.Matrix.subdivide`. You might
+ also find :func:`~sage.matrix.constructor.block_matrix` or
:func:`~sage.matrix.constructor.block_diagonal_matrix`
useful and simpler in some instances.
@@ -1311,9 +1313,9 @@
[2|3|3 4|5]
[4|5|6 7|8]
- Row subdivisions can be preserved, but only if they are identical.
- Otherwise, this information is discarded and must be managed
- separately. ::
+ Row subdivisions can be preserved, but only if they are
+ identical. Otherwise, this information is discarded and must be
+ managed separately. ::
sage: A = matrix(QQ, 3, range(6))
sage: A.subdivide([1,3], None)
@@ -1332,8 +1334,8 @@
[2 3|3 4 5]
[4 5|6 7 8]
- The result retains the base ring of ``self`` by coercing
- the elements of ``right`` into the base ring of ``self``. ::
+ The result retains the base ring of ``self`` by coercing the
+ elements of ``right`` into the base ring of ``self``. ::
sage: A = matrix(QQ, 2, [1,2])
sage: B = matrix(RR, 2, [sin(1.1), sin(2.2)])
@@ -1349,10 +1351,10 @@
sage: D.parent()
Full MatrixSpace of 2 by 2 dense matrices over Real Field with 53 bits of precision
- Sometimes it is not possible to coerce into the base ring
- of ``self``. A solution is to change the base ring of ``self``
- to a more expansive ring. Here we mix the rationals with
- a ring of polynomials with rational coefficients. ::
+ Sometimes it is not possible to coerce into the base ring of
+ ``self``. A solution is to change the base ring of ``self`` to
+ a more expansive ring. Here we mix the rationals with a ring of
+ polynomials with rational coefficients. ::
sage: R = PolynomialRing(QQ, 'y')
sage: A = matrix(QQ, 1, [1,2])
@@ -1384,13 +1386,15 @@
if hasattr(right, '_vector_'):
right = right.column()
if not isinstance(right, sage.matrix.matrix1.Matrix):
- raise TypeError("a matrix must be augmented with another matrix, or a vector")
+ raise TypeError("a matrix must be augmented with another matrix, "
+ "or a vector")
cdef Matrix other
other = right
if self._nrows != other._nrows:
- raise TypeError('number of rows must be the same, {0} != {1}'.format(self._nrows, other._nrows))
+ raise TypeError('number of rows must be the same, '
+ '{0} != {1}'.format(self._nrows, other._nrows))
if not (self._base_ring is other.base_ring()):
other = other.change_ring(self._base_ring)