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

[3 4 5]<br />

[6 7 8]<br />

sage: v = m.dense_rows(); v<br />

[(0, 1, 2), (3, 4, 5), (6, 7, 8)]<br />

sage: v is m.dense_rows()<br />

False<br />

sage: m.dense_rows(copy=False) is m.dense_rows(copy=False)<br />

True<br />

sage: m[0,0] = 10<br />

sage: m.dense_rows()<br />

[(10, 1, 2), (3, 4, 5), (6, 7, 8)]<br />

TESTS:<br />

Check that the returned rows are immutable as per trac ticket #14874:<br />

sage: m = Mat(ZZ,3,3)(range(9))<br />

sage: v = m.dense_rows()<br />

sage: map(lambda x: x.is_mutable(), v)<br />

[False, False, False]<br />

lift()<br />

Return lift <strong>of</strong> self to the covering ring <strong>of</strong> the base ring R, which is by definition the ring returned by calling<br />

cover_ring() on R, or just R itself if the cover_ring method is not defined.<br />

EXAMPLES:<br />

sage: M = Matrix(Integers(7), 2, 2, [5, 9, 13, 15]) ; M<br />

[5 2]<br />

[6 1]<br />

sage: M.lift()<br />

[5 2]<br />

[6 1]<br />

sage: parent(M.lift())<br />

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

The field QQ doesn’t have a cover_ring method:<br />

sage: hasattr(QQ, ’cover_ring’)<br />

False<br />

So lifting a matrix over QQ gives back the same exact matrix.<br />

sage: B = matrix(QQ, 2, [1..4])<br />

sage: B.lift()<br />

[1 2]<br />

[3 4]<br />

sage: B.lift() is B<br />

True<br />

matrix_from_columns(columns)<br />

Return the matrix constructed from self using columns with indices in the columns list.<br />

EXAMPLES:<br />

sage: M = MatrixSpace(Integers(8),3,3)<br />

sage: A = M(range(9)); A<br />

[0 1 2]<br />

[3 4 5]<br />

[6 7 0]<br />

sage: A.matrix_from_columns([2,1])<br />

105

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

Saved successfully!

Ooh no, something went wrong!