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

subdivide(row_lines=None, col_lines=None)<br />

Divides self into logical submatrices which can then be queried <strong>and</strong> extracted. If a subdivision already<br />

exists, this method forgets the previous subdivision <strong>and</strong> flushes the cache.<br />

INPUT:<br />

•row_lines - None, an integer, or a list <strong>of</strong> integers<br />

•col_lines - None, an integer, or a list <strong>of</strong> integers<br />

OUTPUT: changes self<br />

Note: One may also pass a tuple into the first argument which will be interpreted as (row_lines, col_lines)<br />

EXAMPLES:<br />

sage: M = matrix(5, 5, prime_range(100))<br />

sage: M.subdivide(2,3); M<br />

[ 2 3 5| 7 11]<br />

[13 17 19|23 29]<br />

[--------+-----]<br />

[31 37 41|43 47]<br />

[53 59 61|67 71]<br />

[73 79 83|89 97]<br />

sage: M.subdivision(0,0)<br />

[ 2 3 5]<br />

[13 17 19]<br />

sage: M.subdivision(1,0)<br />

[31 37 41]<br />

[53 59 61]<br />

[73 79 83]<br />

sage: M.subdivision_entry(1,0,0,0)<br />

31<br />

sage: M.subdivisions()<br />

([2], [3])<br />

sage: M.subdivide(None, [1,3]); M<br />

[ 2| 3 5| 7 11]<br />

[13|17 19|23 29]<br />

[31|37 41|43 47]<br />

[53|59 61|67 71]<br />

[73|79 83|89 97]<br />

Degenerate cases work too.<br />

sage: M.subdivide([2,5], [0,1,3]); M<br />

[| 2| 3 5| 7 11]<br />

[|13|17 19|23 29]<br />

[+--+-----+-----]<br />

[|31|37 41|43 47]<br />

[|53|59 61|67 71]<br />

[|73|79 83|89 97]<br />

[+--+-----+-----]<br />

sage: M.subdivision(0,0)<br />

[]<br />

sage: M.subdivision(0,1)<br />

[ 2]<br />

[13]<br />

sage: M.subdivide([2,2,3], [0,0,1,1]); M<br />

[|| 2|| 3 5 7 11]<br />

257

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

Saved successfully!

Ooh no, something went wrong!