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

INPUT:<br />

•A - matrix window<br />

•cut<strong>of</strong>f - size at which algorithm reverts to naive Gaussian elimination <strong>and</strong> multiplication must be at least<br />

1.<br />

OUTPUT: The list <strong>of</strong> pivot columns<br />

EXAMPLE:<br />

sage: A = matrix(QQ, 7, [5, 0, 0, 0, 0, 0, -1, 0, 0, 1, 0, 0, 0, 0, 0, -1, 3, 1, 0, -1, 0, 0, -1<br />

sage: B = A.__copy__(); B._echelon_strassen(1); B<br />

[ 1 0 0 0 0 0 0]<br />

[ 0 1 0 -1 0 1 0]<br />

[ 0 0 1 0 0 0 0]<br />

[ 0 0 0 0 1 0 0]<br />

[ 0 0 0 0 0 0 1]<br />

[ 0 0 0 0 0 0 0]<br />

[ 0 0 0 0 0 0 0]<br />

sage: C = A.__copy__(); C._echelon_strassen(2); C == B<br />

True<br />

sage: C = A.__copy__(); C._echelon_strassen(4); C == B<br />

True<br />

sage: n = 32; A = matrix(Integers(389),n,range(n^2))<br />

sage: B = A.__copy__(); B._echelon_in_place_classical()<br />

sage: C = A.__copy__(); C._echelon_strassen(2)<br />

sage: B == C<br />

True<br />

TESTS:<br />

sage: A = matrix(Integers(7), 4, 4, [1,2,0,3,0,0,1,0,0,1,0,0,0,0,0,1])<br />

sage: B = A.__copy__(); B._echelon_in_place_classical()<br />

sage: C = A.__copy__(); C._echelon_strassen(2)<br />

sage: B == C<br />

True<br />

sage: A = matrix(Integers(7), 4, 4, [1,0,5,0,2,0,3,6,5,1,2,6,4,6,1,1])<br />

sage: B = A.__copy__(); B._echelon_in_place_classical()<br />

sage: C = A.__copy__(); C._echelon_strassen(2) #indirect doctest<br />

sage: B == C<br />

True<br />

AUTHORS:<br />

•Robert Bradshaw<br />

sage.matrix.strassen.strassen_window_multiply(C, A, B, cut<strong>of</strong>f )<br />

Multiplies the submatrices specified by A <strong>and</strong> B, places result in C. Assumes that A <strong>and</strong> B have compatible<br />

dimensions to be multiplied, <strong>and</strong> that C is the correct size to receive the product, <strong>and</strong> that they are all defined<br />

over the same ring.<br />

Uses strassen multiplication at high levels <strong>and</strong> then uses MatrixWindow methods at low levels. EXAMPLES:<br />

The following matrix dimensions are chosen especially to exercise the eight possible parity combinations that<br />

could occur while subdividing the matrix in the strassen recursion. The base case in both cases will be a (4x5)<br />

matrix times a (5x6) matrix.<br />

sage: A = MatrixSpace(Integers(2^65), 64, 83).r<strong>and</strong>om_element()<br />

sage: B = MatrixSpace(Integers(2^65), 83, 101).r<strong>and</strong>om_element()<br />

273

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

Saved successfully!

Ooh no, something went wrong!