08.02.2015 Views

Sage Reference Manual: Matrices and Spaces of Matrices - Mirrors

Sage Reference Manual: Matrices and Spaces of Matrices - Mirrors

Sage Reference Manual: Matrices and Spaces of Matrices - Mirrors

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

CHAPTER<br />

SIX<br />

BASE CLASS FOR MATRICES, PART 1<br />

Base class for matrices, part 1<br />

For design documentation see sage.matrix.docs.<br />

TESTS:<br />

sage: A = Matrix(GF(5),3,3,srange(9))<br />

sage: TestSuite(A).run()<br />

class sage.matrix.matrix1.Matrix<br />

Bases: sage.matrix.matrix0.Matrix<br />

The initialization routine <strong>of</strong> the Matrix base class ensures that it sets the attributes self._parent, self._base_ring,<br />

self._nrows, self._ncols. It sets the latter ones by accessing the relevant information on parent, which is <strong>of</strong>ten<br />

slower than what a more specific subclass can do.<br />

Subclasses <strong>of</strong> Matrix can safely skip calling Matrix.__init__ provided they take care <strong>of</strong> initializing these attributes<br />

themselves.<br />

The private attributes self._is_immutable <strong>and</strong> self._cache are implicitly initialized to valid values upon memory<br />

allocation.<br />

EXAMPLES:<br />

sage: import sage.matrix.matrix0<br />

sage: A = sage.matrix.matrix0.Matrix(MatrixSpace(QQ,2))<br />

sage: type(A)<br />

<br />

augment(right, subdivide=False)<br />

Returns a new matrix formed by appending the matrix (or vector) right on the right side <strong>of</strong> self.<br />

INPUT:<br />

•right - a matrix, vector or free module element, whose dimensions are compatible with self.<br />

•subdivide - default: False - request the resulting matrix to have a new subdivision, separating<br />

self from right.<br />

OUTPUT:<br />

A new matrix formed by appending right onto the right side <strong>of</strong> self. If right is a vector (or free<br />

module element) then in this context it is appropriate to consider it as a column vector. (The code first<br />

converts a vector to a 1-column matrix.)<br />

If subdivide is True then any column subdivisions for the two matrices are preserved, <strong>and</strong> a new<br />

subdivision is added between self <strong>and</strong> right. If the row divisions are identical, then they are preserved,<br />

97

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!