Skip to content

Instantly share code, notes, and snippets.

@d7om
Forked from ecleel/matrix.rb
Created May 30, 2012 19:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save d7om/2838551 to your computer and use it in GitHub Desktop.
Save d7om/2838551 to your computer and use it in GitHub Desktop.
Example of how use matrix class in ruby
require 'matrix'
require 'pp'
# This is how you can define new matrix
a = Matrix[ [1,2], [3,4]]
b = Matrix[ [4,3], [2,1]]
pp a
pp b
pp a * b
pp a / b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment