From: "M. Edward (Ed) Borasky" Date: 2006-08-07T00:46:27+09:00 Subject: Re: Resubmitting legacy RCR 161 Dave Burt wrote: > M. Edward (Ed) Borasky wrote: > >> Some time back, RCR 161 was submitted to add a []= method to the Matrix >> class defined in "matrix.rb". Apparently, this was imported from an >> older database and needs to be resubmitted. Can "anyone" (for example, >> me) do that, or does it have to be the original submitter? >> > > The problem with this RCR, if I recall correctly, is that Matrix objects > are immutable, and []= is a mutation operation. > > There's room for methods that return a copy of the matrix modified in a > given way, but you can't change self. > > Cheers, > Dave > I guess I need to define my own "Matrix" class then. Making a copy of a 200x200 matrix to change one element, or in my case the whole upper triangle, is not going to work. I ended up doing "a = m.to_a", changing the upper triangle in "a", and then doing "m = Matrix.rows(a)". Until I looked at the code, I thought Matrix was either inheriting from or mixing in Array. Still, at least one other person -- the person who filed RCR 161 -- thought that "m[i, j] = -1" was something a "Matrix" object like "m" should know how to do. It's such a common operation in matrix computations that its non-existence seems more like an oversight than a design feature or a bug to me. And it violates the principle of being able to write FORTRAN code in any language. :)