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

The default is to check whether the any index in drows is out <strong>of</strong> range.<br />

sage: A.delete_rows([-1,2,4])<br />

Traceback (most recent call last):<br />

...<br />

IndexError: [4, -1] contains invalid indices.<br />

sage: A.delete_rows([-1,2,4], check=False)<br />

[ 0 1 2]<br />

[ 3 4 5]<br />

[ 9 10 11]<br />

TESTS:<br />

The list <strong>of</strong> indices is checked.<br />

sage: A.delete_rows(’junk’)<br />

Traceback (most recent call last):<br />

...<br />

TypeError: The argument must be a list or a tuple, not junk<br />

AUTHORS:<br />

• Wai Yan Pong (2012-03-05)<br />

dense_columns(copy=True)<br />

Return list <strong>of</strong> the dense columns <strong>of</strong> self.<br />

INPUT:<br />

•copy - (default: True) if True, return a copy so you can modify it safely<br />

EXAMPLES:<br />

An example over the integers:<br />

sage: a = matrix(3,3,range(9)); a<br />

[0 1 2]<br />

[3 4 5]<br />

[6 7 8]<br />

sage: a.dense_columns()<br />

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

We do an example over a polynomial ring:<br />

sage: R. = QQ[ ]<br />

sage: a = matrix(R, 2, [x,x^2, 2/3*x,1+x^5]); a<br />

[ x x^2]<br />

[ 2/3*x x^5 + 1]<br />

sage: a.dense_columns()<br />

[(x, 2/3*x), (x^2, x^5 + 1)]<br />

sage: a = matrix(R, 2, [x,x^2, 2/3*x,1+x^5], sparse=True)<br />

sage: c = a.dense_columns(); c<br />

[(x, 2/3*x), (x^2, x^5 + 1)]<br />

sage: parent(c[1])<br />

Ambient free module <strong>of</strong> rank 2 over the principal ideal domain Univariate Polynomial Ring in<br />

TESTS:<br />

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

103

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

Saved successfully!

Ooh no, something went wrong!