On Tuesday, April 16, 2019 at 8:30:13 PM UTC-7, Nils Bruin wrote: > > On Tuesday, April 16, 2019 at 8:06:06 PM UTC-7, Brian Fitzpatrick wrote: >> >> >> Is this a bug? >> >> Looks like it. The problem seems to be that "sparse matrices over SR" > aren't special cased the way dense matrices are (and a diagonal matrix is > constructed as sparse: > > sage: D=diagonal_matrix([1, 2, 3]) > sage: Ds=D.change_ring(SR) > sage: M=matrix(3, [1, 0, 0, 0, 2, 0, 0, 0, 3]) > sage: Ms=M.change_ring(SR) > sage: parent(Ds) > Full MatrixSpace of 3 by 3 sparse matrices over Symbolic Ring > sage: parent(Ms) > Full MatrixSpace of 3 by 3 dense matrices over Symbolic Ring > sage: type(Ds) > <type 'sage.matrix.matrix_generic_sparse.Matrix_generic_sparse'> > sage: type(Ms) > <type 'sage.matrix.matrix_symbolic_dense.Matrix_symbolic_dense'> > > It means that Ds.exp ends up being the same method as D.exp (which > consists of D.change_ring(SR).exp() ), hence the infinite recursion. > Ms.exp, on the other hand is indeed a different method than M.exp. > > Yes, this is a bug. It's worth reporting. Be prepared to work around for > the near future though. I don't expect it to be a very high priority bug > (sparse matrices over SR are probably not so necessary). >
I think it's any sparse matrix, not just sparse matrices over SR. sage: m = matrix(3, [1, 0, 0, 0, 2, 0, 0, 0, 3], sparse=True) sage: exp(m) # hits the bug Same with m = matrix(QQ, 3, ..., sparse=True) or m = matrix(ZZ, 3, ..., sparse=True). -- John -- 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 [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/sage-devel. For more options, visit https://groups.google.com/d/optout.
