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: M = M.change_ring(ZZ)<br />

sage: M.nullity()<br />

0<br />

sage: A = M.transpose()<br />

sage: A.nullity()<br />

1<br />

matrix_window(row=0, col=0, nrows=-1, ncols=-1, check=1)<br />

Return the requested matrix window.<br />

EXAMPLES:<br />

sage: A = matrix(QQ, 3, range(9))<br />

sage: A.matrix_window(1,1, 2, 1)<br />

Matrix window <strong>of</strong> size 2 x 1 at (1,1):<br />

[0 1 2]<br />

[3 4 5]<br />

[6 7 8]<br />

We test the optional check flag.<br />

sage: matrix([1]).matrix_window(0,1,1,1, check=False)<br />

Matrix window <strong>of</strong> size 1 x 1 at (0,1):<br />

[1]<br />

sage: matrix([1]).matrix_window(0,1,1,1)<br />

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

...<br />

IndexError: matrix window index out <strong>of</strong> range<br />

Another test <strong>of</strong> bounds checking:<br />

sage: matrix([1]).matrix_window(1,1,1,1)<br />

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

...<br />

IndexError: matrix window index out <strong>of</strong> range<br />

maxspin(v)<br />

Computes the largest integer n such that the list <strong>of</strong> vectors S = [v, v∗A, ..., v∗A n ] are linearly independent,<br />

<strong>and</strong> returns that list.<br />

INPUT:<br />

•self - Matrix<br />

•v - Vector<br />

OUTPUT:<br />

•list - list <strong>of</strong> Vectors<br />

ALGORITHM: The current implementation just adds vectors to a vector space until the dimension doesn’t<br />

grow. This could be optimized by directly using matrices <strong>and</strong> doing an efficient Echelon form. Also, when<br />

the base is Q, maybe we could simultaneously keep track <strong>of</strong> what is going on in the reduction modulo p,<br />

which might make things much faster.<br />

EXAMPLES:<br />

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

[0 1 2]<br />

[3 4 5]<br />

[6 7 8]<br />

sage: v = (QQ^3).0<br />

213

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

Saved successfully!

Ooh no, something went wrong!