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: F. = FiniteField(5^2)<br />

sage: A = matrix(F, 3, 4, [[ 1, a, 1+a, a^3+a^5],<br />

... [ a, a^4, a+a^4, a^4+a^8],<br />

... [a^2, a^6, a^2+a^6, a^5+a^10]])<br />

sage: P = A.right_kernel_matrix(algorithm=’default’, basis=’pivot’); P<br />

[ 4 4 1 0]<br />

[ a + 2 3*a + 3 0 1]<br />

sage: A*P.transpose() == zero_matrix(F, 3, 2)<br />

True<br />

sage: E = A.right_kernel_matrix(algorithm=’default’, basis=’echelon’); E<br />

[ 1 0 3*a + 4 2*a + 2]<br />

[ 0 1 2*a 3*a + 3]<br />

sage: A*E.transpose() == zero_matrix(F, 3, 2)<br />

True<br />

This general code can be requested for matrices over any field with the algorithm keyword ‘generic’.<br />

Normally, matrices over the rationals would be h<strong>and</strong>led by specific routines from the IML library. The<br />

default format is an echelon basis, but a pivot basis may be requested, which is identical to the computed<br />

basis.<br />

sage: A = matrix(QQ, 3, 4, [[1,3,-2,4],<br />

... [2,0,2,2],<br />

... [-1,1,-2,0]])<br />

sage: G = A.right_kernel_matrix(algorithm=’generic’); G<br />

[ 1 0 -1/2 -1/2]<br />

[ 0 1 1/2 -1/2]<br />

sage: A*G.transpose() == zero_matrix(QQ, 3, 2)<br />

True<br />

sage: C = A.right_kernel_matrix(algorithm=’generic’, basis=’computed’); C<br />

[-1 1 1 0]<br />

[-1 -1 0 1]<br />

sage: A*C.transpose() == zero_matrix(QQ, 3, 2)<br />

True<br />

We test that the generic code is called for matrices over fields, lacking any more specific routine.<br />

sage: F. = FiniteField(5^2)<br />

sage: A = matrix(F, 3, 4, [[ 1, a, 1+a, a^3+a^5],<br />

... [ a, a^4, a+a^4, a^4+a^8],<br />

... [a^2, a^6, a^2+a^6, a^5+a^10]])<br />

sage: set_verbose(1)<br />

sage: A.right_kernel(algorithm=’default’)<br />

verbose ...<br />

verbose 1 () computing right kernel matrix over an arbitrary field for 3x4 matrix<br />

...<br />

...<br />

Vector space <strong>of</strong> degree 4 <strong>and</strong> dimension 2 over Finite Field in a <strong>of</strong> size 5^2<br />

Basis matrix:<br />

[ 1 0 3*a + 4 2*a + 2]<br />

[ 0 1 2*a 3*a + 3]<br />

sage: set_verbose(0)<br />

Over the Integers:<br />

Either the IML or PARI libraries are used to provide a set <strong>of</strong> basis vectors. The algorithm keyword can<br />

be used to select either, or when set to ‘default’ a heuristic will choose between the two. Results can be<br />

returned in the ‘compute’ format, straight out <strong>of</strong> the libraries. Unique to the integers, the basis vectors can<br />

be returned as an LLL basis. Note the similarities <strong>and</strong> differences in the results. The ‘pivot’ format is not<br />

245

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

Saved successfully!

Ooh no, something went wrong!