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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<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 />

sage: MatrixSpace(Qp(3),1,1)([Qp(3).zero()])<br />

[0]<br />

sage: MatrixSpace(Qp(3),1,1)([Qp(3)(4/3)])<br />

[3^-1 + 1 + O(3^19)]<br />

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

Return the matrix space with given number <strong>of</strong> rows, columns <strong>and</strong> sparcity over the same base ring as self,<br />

<strong>and</strong> defaults the same as self.<br />

EXAMPLES:<br />

sage: M = Mat(GF(7),100,200)<br />

sage: M.matrix_space(5000)<br />

Full MatrixSpace <strong>of</strong> 5000 by 200 dense matrices over Finite Field <strong>of</strong> size 7<br />

sage: M.matrix_space(ncols=5000)<br />

Full MatrixSpace <strong>of</strong> 100 by 5000 dense matrices over Finite Field <strong>of</strong> size 7<br />

sage: M.matrix_space(sparse=True)<br />

Full MatrixSpace <strong>of</strong> 100 by 200 sparse matrices over Finite Field <strong>of</strong> size 7<br />

ncols()<br />

Return the number <strong>of</strong> columns <strong>of</strong> matrices in this space.<br />

EXAMPLES:<br />

sage: M = Mat(ZZ[’x’],200000,500000,sparse=True)<br />

sage: M.ncols()<br />

500000<br />

ngens()<br />

Return the number <strong>of</strong> generators <strong>of</strong> this matrix space, which is the number <strong>of</strong> entries in the matrices in this<br />

space.<br />

EXAMPLES:<br />

sage: M = Mat(GF(7),100,200); M.ngens()<br />

20000<br />

nrows()<br />

Return the number <strong>of</strong> rows <strong>of</strong> matrices in this space.<br />

EXAMPLES:<br />

sage: M = Mat(ZZ,200000,500000)<br />

sage: M.nrows()<br />

200000<br />

one()<br />

Returns the identity matrix in self.<br />

self must be a space <strong>of</strong> square matrices. The returned matrix is immutable. Please use copy if you want<br />

a modified copy.<br />

EXAMPLES:<br />

sage: MS1 = MatrixSpace(ZZ,4)<br />

sage: MS2 = MatrixSpace(QQ,3,4)<br />

sage: I = MS1.identity_matrix()<br />

sage: I<br />

[1 0 0 0]<br />

[0 1 0 0]<br />

[0 0 1 0]<br />

10 Chapter 1. Matrix <strong>Spaces</strong>

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

Saved successfully!

Ooh no, something went wrong!