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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

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

TESTS:<br />

sage: m = matrix([])<br />

sage: m.apply_map(lambda x: x*x) == m<br />

True<br />

sage: m.apply_map(lambda x: x*x, sparse=True).parent()<br />

Full MatrixSpace <strong>of</strong> 0 by 0 sparse matrices over Integer Ring<br />

apply_morphism(phi)<br />

Apply the morphism phi to the coefficients <strong>of</strong> this dense matrix.<br />

The resulting matrix is over the codomain <strong>of</strong> phi.<br />

INPUT:<br />

•phi - a morphism, so phi is callable <strong>and</strong> phi.domain() <strong>and</strong> phi.codomain() are defined. The codomain<br />

must be a ring.<br />

OUTPUT: a matrix over the codomain <strong>of</strong> phi<br />

EXAMPLES:<br />

sage: m = matrix(ZZ, 3, range(9))<br />

sage: phi = ZZ.hom(GF(5))<br />

sage: m.apply_morphism(phi)<br />

[0 1 2]<br />

[3 4 0]<br />

[1 2 3]<br />

sage: parent(m.apply_morphism(phi))<br />

Full MatrixSpace <strong>of</strong> 3 by 3 dense matrices over Finite Field <strong>of</strong> size 5<br />

We apply a morphism to a matrix over a polynomial ring:<br />

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

sage: m = matrix(2, [x,x^2 + y, 2/3*y^2-x, x]); m<br />

[ x x^2 + y]<br />

[2/3*y^2 - x x]<br />

sage: phi = R.hom([y,x])<br />

sage: m.apply_morphism(phi)<br />

[ y y^2 + x]<br />

[2/3*x^2 - y y]<br />

transpose()<br />

Returns the transpose <strong>of</strong> self, without changing self.<br />

EXAMPLES: We create a matrix, compute its transpose, <strong>and</strong> note that the original matrix is not changed.<br />

sage: M = MatrixSpace(QQ, 2)<br />

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

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

sage: print B<br />

[1 3]<br />

[2 4]<br />

sage: print A<br />

[1 2]<br />

[3 4]<br />

.T is a convenient shortcut for the transpose:<br />

279

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

Saved successfully!

Ooh no, something went wrong!