id summary reporter owner description type status priority milestone component resolution keywords cc merged author reviewer upstream work_issues branch commit dependencies stopgaps
10793 "Matrices can be ""constructed"" from matrices of wrong dimensions" Volker Braun Jason Grout William Stein "Let's make a matrix and use it to define a morphism:
{{{
sage: projection = matrix(ZZ,[[1,0,0],[0,1,0]])
sage: projection
[1 0 0]
[0 1 0]
sage: H = Hom(ZZ^3, ZZ^2)
sage: H(projection)
Free module morphism defined by the matrix
[1 0]
[0 0]
[1 0]
Domain: Ambient free module of rank 3 over the principal ideal domain ...
Codomain: Ambient free module of rank 2 over the principal ideal domain ...
}}}
As we see, the matrix of the morphism is very unlikely to be what it should be. Here is the source of the problem:
{{{
sage: projection.parent()
Full MatrixSpace of 2 by 3 dense matrices over Integer Ring
sage: M = MatrixSpace(ZZ, 3 , 2)
sage: M
Full MatrixSpace of 3 by 2 dense matrices over Integer Ring
sage: M(projection)
[1 0]
[0 0]
[1 0]
}}}
So the matrix space converts the input to the matrix no matter what (same with `matrix` command, but inside morphisms matrix spaces are used). I suppose this will work any time the number of entries in the original and in the destination is matching. I think that if one really wants to do it, then this one is very welcome to insert an explicit conversion of a matrix to a list and then back to a matrix, but the above should raise exceptions.
Apply trac_10793_bug_in_matrix_construction.patch, trac_10793_fixing_existing_bugs.patch
" defect closed critical sage-4.7.2 linear algebra fixed sd31 Rob Beezer Karl-Dieter Crisman sage-4.7.2.alpha2 Andrey Novoseltsev Volker Braun N/A #11200, #11552