Ask Your Question

Revision history [back]

As you note, using mat[m:,:] can give the wrong size matrix. This is perhaps a bug.

sage: identity_matrix(RDF, 4)[4:,:].nrows()
0
sage: identity_matrix(RDF, 4)[4:,:].ncols()
0

If you use the submatrix method instead, you will get matrices of the correct size:

sage: identity_matrix(RDF, 4).submatrix(4,0,0,4).nrows()
0
sage: identity_matrix(RDF, 4).submatrix(4,0,0,4).ncols()
4
sage: identity_matrix(RDF, 4).submatrix(4,0,0,4) * vector([1,2,3,4])
()