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.

<strong>Sage</strong> <strong>Reference</strong> <strong>Manual</strong>: <strong>Matrices</strong> <strong>and</strong> <strong>Spaces</strong> <strong>of</strong> <strong>Matrices</strong>, Release 6.1.1<br />

[1 2]<br />

[3 4]<br />

sage: B.parent()<br />

Full MatrixSpace <strong>of</strong> 2 by 2 dense matrices over Rational Field<br />

matrix_space(nrows=None, ncols=None, sparse=None)<br />

Return the ambient matrix space <strong>of</strong> self.<br />

INPUT:<br />

•nrows, ncols - (optional) number <strong>of</strong> rows <strong>and</strong> columns in returned matrix space.<br />

•sparse - whether the returned matrix space uses sparse or dense matrices.<br />

EXAMPLES:<br />

sage: m = matrix(3, [1..9])<br />

sage: m.matrix_space()<br />

Full MatrixSpace <strong>of</strong> 3 by 3 dense matrices over Integer Ring<br />

sage: m.matrix_space(ncols=2)<br />

Full MatrixSpace <strong>of</strong> 3 by 2 dense matrices over Integer Ring<br />

sage: m.matrix_space(1)<br />

Full MatrixSpace <strong>of</strong> 1 by 3 dense matrices over Integer Ring<br />

sage: m.matrix_space(1, 2, True)<br />

Full MatrixSpace <strong>of</strong> 1 by 2 sparse matrices over Integer Ring<br />

new_matrix(nrows=None, ncols=None, entries=None, coerce=True, copy=True, sparse=None)<br />

Create a matrix in the parent <strong>of</strong> this matrix with the given number <strong>of</strong> rows, columns, etc. The default<br />

parameters are the same as for self.<br />

INPUT:<br />

These three variables get sent to matrix_space():<br />

•nrows, ncols - number <strong>of</strong> rows <strong>and</strong> columns in returned matrix. If not specified, defaults to None<br />

<strong>and</strong> will give a matrix <strong>of</strong> the same size as self.<br />

•sparse - whether returned matrix is sparse or not. Defaults to same value as self.<br />

The remaining three variables (coerce, entries, <strong>and</strong> copy) are used by<br />

sage.matrix.matrix_space.MatrixSpace() to construct the new matrix.<br />

Warning: This function called with no arguments returns the zero matrix <strong>of</strong> the same dimension <strong>and</strong><br />

sparseness <strong>of</strong> self.<br />

EXAMPLES:<br />

sage: A = matrix(ZZ,2,2,[1,2,3,4]); A<br />

[1 2]<br />

[3 4]<br />

sage: A.new_matrix()<br />

[0 0]<br />

[0 0]<br />

sage: A.new_matrix(1,1)<br />

[0]<br />

sage: A.new_matrix(3,3).parent()<br />

Full MatrixSpace <strong>of</strong> 3 by 3 dense matrices over Integer Ring<br />

sage: A = matrix(RR,2,3,[1.1,2.2,3.3,4.4,5.5,6.6]); A<br />

[1.10000000000000 2.20000000000000 3.30000000000000]<br />

[4.40000000000000 5.50000000000000 6.60000000000000]<br />

107

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

Saved successfully!

Ooh no, something went wrong!