Am Samstag, 20. Juni 2015 23:21:21 UTC+2 schrieb Nils Bruin: > > On Saturday, June 20, 2015 at 11:55:02 AM UTC-7, Martin R wrote: >> >> Yes, that's quite clear. _matrix_constructor determines nrows (2) and >> ncols (3) and the ring (Symbolic Ring) and calls >> matrix_space.MatrixSpace(ring, nrows, ncols)(entries). This fails, since >> entries is a single element. But the bug is, I'd say, that >> _matrix_constructor calls MatrixSpace with a single element. >> > > What is the bug here? Do you think matrix(2,3,1) should succeed? Do you > think it should produce a different error message? >
No, I think that matrix(nrows, ncols, element) sould fail, unless element is callable or iterable. > The following behaviour seems quite reasonable to me: > > sage: MatrixSpace(ZZ,2,2)(5) > [5 0] > [0 5] > sage: MatrixSpace(ZZ,2,3)(5) > TypeError: nonzero scalar matrix must be square > > Although: > > sage: MatrixSpace(ZZ,2,3)(0) > [0 0 0] > [0 0 0] > > suggests this should perhaps be a ValueError > > I wouldn't mind if the latter would not work, since the following does: > > sage: MatrixSpace(ZZ,2,3).zero() > [0 0 0] > [0 0 0] > > Yes, these are all fine. But as far as I understand, MatrixSpace(ring, nrows, ncols) is not calling _matrix_constructor. So, I think that matrix(2,2,5) should fail and MatrixSpace(ZZ, 2, 2)(5) should succeed. Martin -- You received this message because you are subscribed to the Google Groups "sage-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+unsubscr...@googlegroups.com. To post to this group, send email to sage-devel@googlegroups.com. Visit this group at http://groups.google.com/group/sage-devel. For more options, visit https://groups.google.com/d/optout.