Matrix multiplication: Difference between revisions

→‎{{header|Ruby}}: this actually works
(→‎{{header|Ruby}}: this actually works)
Line 4,311:
<lang ruby>def matrix_mult(a, b)
a.map do |ar|
b.transpose.map { |bc| ar.zip(bc).map{ |x| x.inject(&:*) }.inject(&:+) }
end
end</lang>