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

[0 0 0]<br />

[0 0 0]<br />

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

sage: m=matrix(0); m; m.parent()<br />

[]<br />

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

sage: m=matrix(0,2); m; m.parent()<br />

[]<br />

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

sage: m=matrix(2,0); m; m.parent()<br />

[]<br />

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

sage: m=matrix(0,[1]); m; m.parent()<br />

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

...<br />

ValueError: entries has the wrong length<br />

sage: m=matrix(1,0,[]); m; m.parent()<br />

[]<br />

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

sage: m=matrix(0,1,[]); m; m.parent()<br />

[]<br />

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

sage: m=matrix(0,[]); m; m.parent()<br />

[]<br />

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

sage: m=matrix(0,{}); m; m.parent()<br />

[]<br />

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

sage: m=matrix(0,{(1,1):2}); m; m.parent()<br />

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

...<br />

IndexError: invalid entries list<br />

sage: m=matrix(2,0,{(1,1):2}); m; m.parent()<br />

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

...<br />

IndexError: invalid entries list<br />

sage: import numpy<br />

sage: n=numpy.array([[numpy.complex(0,1),numpy.complex(0,2)],[3,4]],complex)<br />

sage: m=matrix(n); m; m.parent()<br />

[1.0*I 2.0*I]<br />

[ 3.0 4.0]<br />

Full MatrixSpace <strong>of</strong> 2 by 2 dense matrices over Complex Double Field<br />

sage: n=numpy.array([[1,2],[3,4]],’int32’)<br />

sage: m=matrix(n); m; m.parent()<br />

[1 2]<br />

[3 4]<br />

Full MatrixSpace <strong>of</strong> 2 by 2 dense matrices over Integer Ring<br />

sage: n = numpy.array([[1,2,3],[4,5,6],[7,8,9]],’float32’)<br />

sage: m=matrix(n); m; m.parent()<br />

[1.0 2.0 3.0]<br />

[4.0 5.0 6.0]<br />

[7.0 8.0 9.0]<br />

Full MatrixSpace <strong>of</strong> 3 by 3 dense matrices over Real Double Field<br />

sage: n=numpy.array([[1,2,3],[4,5,6],[7,8,9]],’float64’)<br />

sage: m=matrix(n); m; m.parent()<br />

[1.0 2.0 3.0]<br />

[4.0 5.0 6.0]<br />

[7.0 8.0 9.0]<br />

20 Chapter 2. Matrix Constructor

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

Saved successfully!

Ooh no, something went wrong!