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

[ 5 7]<br />

[ 9 11]<br />

dcols can be a tuple. But only the underlying set <strong>of</strong> indices matters.<br />

sage: A.delete_columns((2,0,2))<br />

[ 1 3]<br />

[ 5 7]<br />

[ 9 11]<br />

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

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

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

...<br />

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

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

[ 0 1 3]<br />

[ 4 5 7]<br />

[ 8 9 11]<br />

TESTS:<br />

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

sage: A.delete_columns(’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 />

delete_rows(drows, check=True)<br />

Return the matrix constructed from deleting the rows with indices in the drows list.<br />

INPUT:<br />

•drows - list <strong>of</strong> indices <strong>of</strong> rows to be deleted from self.<br />

•check - checks whether any index in drows is out <strong>of</strong> range. Defaults to True.<br />

SEE ALSO: The methods delete_columns() <strong>and</strong> matrix_from_rows() are related.<br />

EXAMPLES:<br />

sage: A = Matrix(4,3,range(12)); A<br />

[ 0 1 2]<br />

[ 3 4 5]<br />

[ 6 7 8]<br />

[ 9 10 11]<br />

sage: A.delete_rows([0,2])<br />

[ 3 4 5]<br />

[ 9 10 11]<br />

drows can be a tuple. But only the underlying set <strong>of</strong> indices matters.<br />

sage: A.delete_rows((2,0,2))<br />

[ 3 4 5]<br />

[ 9 10 11]<br />

102 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!