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

[2 1]<br />

[5 4]<br />

[0 7]<br />

matrix_from_rows(rows)<br />

Return the matrix constructed from self using rows with indices in the rows 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_rows([2,1])<br />

[6 7 0]<br />

[3 4 5]<br />

matrix_from_rows_<strong>and</strong>_columns(rows, columns)<br />

Return the matrix constructed from self from the given rows <strong>and</strong> columns.<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_rows_<strong>and</strong>_columns([1], [0,2])<br />

[3 5]<br />

sage: A.matrix_from_rows_<strong>and</strong>_columns([1,2], [1,2])<br />

[4 5]<br />

[7 0]<br />

Note that row <strong>and</strong> column indices can be reordered or repeated:<br />

sage: A.matrix_from_rows_<strong>and</strong>_columns([2,1], [2,1])<br />

[0 7]<br />

[5 4]<br />

For example here we take from row 1 columns 2 then 0 twice, <strong>and</strong> do this 3 times.<br />

sage: A.matrix_from_rows_<strong>and</strong>_columns([1,1,1],[2,0,0])<br />

[5 3 3]<br />

[5 3 3]<br />

[5 3 3]<br />

AUTHORS:<br />

•Jaap Spies (2006-02-18)<br />

•Didier Deshommes: some Pyrex speedups implemented<br />

matrix_over_field()<br />

Return copy <strong>of</strong> this matrix, but with entries viewed as elements <strong>of</strong> the fraction field <strong>of</strong> the base ring<br />

(assuming it is defined).<br />

EXAMPLES:<br />

sage: A = MatrixSpace(IntegerRing(),2)([1,2,3,4])<br />

sage: B = A.matrix_over_field()<br />

sage: B<br />

106 Chapter 6. Base class for matrices, part 1

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

Saved successfully!

Ooh no, something went wrong!