------ art_55911_23187295.1166798276342 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline Hi, Just a small correction... it is the number of *lines* from the left matrix that must match the number of *columns* from the right matrix. Kind Regards J. Augusto On 12/21/06, Vincent Fourmond <vincent.fourmond / 9online.fr> wrote: > > seepee wrote: > > On Thu, 21 Dec 2006 09:12:47 +0200, seepee wrote: > > > >> Does anyone know of a functional Matrix math class for ruby that could > >> multiply, add and substract 3x2 or larger matrices. > >> > >> The matrix.rb that is in Ruby API cannot multiply anything larger than > 2x2 > >> matrices, which makes it useless for 2D or 3D graphics (for instance). > >> > >> SP > > > > Problem: > > go to terminal, and type "irb" or "irb1.8" > > > >> require 'matrix' #or require >rubylibrarypath/matrix.rb > >> p Matrix[ [25, 93, 33], [0, -1, 66] ] * Matrix[ [1, 53, 33], [1, -21, > 77] > > Err... Have you done matrix computations for a long time ? You need > that the number of *columns* from the left matrix matches the number of > *lines* from the right matrix. If you try to multiply two 3x2 matrices, > it is rather encouraging that Matrix refuses it... > > Try transposing your matrix first, if that is what you need. Are you > dealing with transformation matrices (which are not real matrices) ? > > Vincent > > -- > Vincent Fourmond, PhD student > http://vincent.fourmond.neuf.fr/ > > ------ art_55911_23187295.1166798276342--