Yo, > m.row() returns a new (copy) of the row of the matrix, so making that > immutable would be inconsistent with how copy works for matrices. > > sage: m = matrix.ones(10) > sage: m.set_immutable() > sage: copy(m).is_immutable() > False
I do not see why matrix.row(0) should return a *copy* of the row when the matrix is immutable. Depending on how matrices are implemented matrix.row(0) could very well be a O(1) operation giving me a pointer toward an internal data structure. Why not after all, since I can't modify what I have? Plus there is nothing of 'copy' in the row(i) semantic. Ideally, here, I would get a O(1) pointer toward internal data. As efficient as it gets. > At least you can do "v = m.row(0); v.set_immutable()". I take the rows of a matrix, and multiply each of them by a set of values. At first I wrote: values = [...] M.set_immutable() M = [set([r*x for x in values]) for r in M] But that does not work, because r is not immutable. Then I tried: values = [...] M = M.rows() for r in M: r.set_immutable() M = [set([r*x for x in values]) for r in M] But that does not work because multiplying an immutable row by anything is not immutable anymore. So now I write values = [...] M = [[r*x for x in values] for r in M] for r in M: for x in r: x.set_immutable() M = map(set,M) Easy, isn't it? Nathann -- 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.