(Before start, I am using Ruby 1.8.7, so I won't be able to use fancy stuff.)
As title says, I want to calculate the average of column or row. But, I can't even find the way to traverse/iterate Matrix form of array from online.
Let's say you have this
require 'mathn'
m = Matrix[[1,2,3],[4,5,6],[7,8,9]]
Somehow the way I iterate a simple 3x3 array doesn't work with Matrix form of array (Or may be just my code is weird)..What is the proper way to do this? Also, is there a syntax that calculate row and column average of matrix??