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) ?
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
others in this thread have corrected the logical problem.
but let me point out a typical additional response - the included
Matrix library in ruby is NOT FAST. There are other libs that do this
on the C level, such as NArray, that will allow much better
performance for some graphical uses.
Cameron
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.