require 'matrix'

class Matrix
  def element_wise( operator, other )
    Matrix.build(row_size, column_size) do |row, col|
      self[row, col].send(operator, other[row, col])
    end
  end
end

m1, m2 = Matrix[[3,1,4],[1,5,9]], Matrix[[2,7,1],[8,2,2]]
puts 

[:+,:-,:*,:/, :fdiv,:**,:%].each do |op|
  puts  % [op, m1.element_wise(op, m2)]
end