Skip to content

Instantly share code, notes, and snippets.

@sahidursuman
Forked from d7om/matrix.rb
Created May 15, 2018 06:31
Show Gist options
  • Save sahidursuman/3619abe120217e4688ddc8c777cfc348 to your computer and use it in GitHub Desktop.
Save sahidursuman/3619abe120217e4688ddc8c777cfc348 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