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

[0|0]<br />

[3|0]<br />

sage: m.apply_map(lambda x: x+1)<br />

[1|1]<br />

[4|1]<br />

apply_morphism(phi)<br />

Apply the morphism phi to the coefficients <strong>of</strong> this sparse 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), sparse=True)<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: m.apply_morphism(phi).parent()<br />

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

augment(right, subdivide=False)<br />

Return the augmented matrix <strong>of</strong> the form:<br />

[self | right].<br />

EXAMPLES:<br />

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

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

sage: A<br />

[1 2]<br />

[3 4]<br />

sage: N = MatrixSpace(QQ, 2, 1, sparse=True)<br />

sage: B = N([9,8])<br />

sage: B<br />

[9]<br />

[8]<br />

sage: A.augment(B)<br />

[1 2 9]<br />

[3 4 8]<br />

sage: B.augment(A)<br />

[9 1 2]<br />

[8 3 4]<br />

A vector may be augmented to a matrix.<br />

sage: A = matrix(QQ, 3, 4, range(12), sparse=True)<br />

sage: v = vector(QQ, 3, range(3), sparse=True)<br />

sage: A.augment(v)<br />

[ 0 1 2 3 0]<br />

[ 4 5 6 7 1]<br />

[ 8 9 10 11 2]<br />

283

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

Saved successfully!

Ooh no, something went wrong!