From: Dave Baldwin Date: 2008-10-09T18:51:22+09:00 Subject: Bug in Vector class? --Apple-Mail-11-424883843 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes require 'matrix' m = Matrix.identity(4) v = Vector[5, 6, 7, 1] puts m * v gives the expected answer of [5, 6, 7, 1] but puts v * m gives ExceptionForMatrix::ErrDimensionMismatch: Matrix dimension mismatch because the Vector#* method promotes self to a column vector when the argument is found to be a Matrix. I think it should be promoting self to a row vector and making this change removes the exception and gives the correct result. The updated method is: def *(x) case x when Numeric els = @elements.collect{|e| e * x} Vector.elements(els, false) when Matrix Matrix.row_vector(self) * x else s, x = x.coerce(self) s * x end end Dave. --Apple-Mail-11-424883843--