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 1 0]<br />

[0 0 1]<br />

sage: ith_to_zero_rotation_matrix((1,0,0), 2)<br />

[1 0 0]<br />

[0 1 0]<br />

[0 0 1]<br />

AUTHORS:<br />

Sebastien Labbe (April 2010)<br />

sage.matrix.constructor.jordan_block(eigenvalue, size, sparse=False)<br />

This function is available as jordan_block(...) <strong>and</strong> matrix.jordan_block(...).<br />

Returns the Jordan block for the given eigenvalue with given size.<br />

INPUT:<br />

•eigenvalue - eigenvalue for the diagonal entries <strong>of</strong> the block<br />

•size - size <strong>of</strong> the square matrix<br />

•sparse - (default: False) - if True, return a sparse matrix<br />

EXAMPLE:<br />

sage: jordan_block(5, 3)<br />

[5 1 0]<br />

[0 5 1]<br />

[0 0 5]<br />

TESTS:<br />

sage: jordan_block(6.2, ’junk’)<br />

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

...<br />

TypeError: size <strong>of</strong> Jordan block needs to be an integer, not junk<br />

sage: jordan_block(6.2, -1)<br />

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

...<br />

ValueError: size <strong>of</strong> Jordan block must be non-negative, not -1<br />

sage.matrix.constructor.matrix_method(func=None, name=None)<br />

Allows a function to be tab-completed on the global matrix constructor object.<br />

INPUT:<br />

•*function – a single argument. The function that is being decorated.<br />

•**kwds – a single optional keyword argument name=. The name <strong>of</strong> the corresponding<br />

method in the global matrix constructor object. If not given, it is derived from the function name.<br />

EXAMPLES:<br />

sage: from sage.matrix.constructor import matrix_method<br />

sage: def foo_matrix(n): return matrix.diagonal(range(n))<br />

sage: matrix_method(foo_matrix)<br />

<br />

sage: matrix.foo(5)<br />

[0 0 0 0 0]<br />

[0 1 0 0 0]<br />

[0 0 2 0 0]<br />

[0 0 0 3 0]<br />

38 Chapter 2. Matrix Constructor

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

Saved successfully!

Ooh no, something went wrong!