Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env ruby
- require 'matrix'
- [16,64,256,257,512,111,229].each do |d|
- a = Matrix.build(d, d){ rand(2)-1 }
- b = Matrix.build(d, d){ rand(2)-1 }
- open('mat-%d' % d, 'w'){|f| f.write (a.to_a.flatten + b.to_a.flatten).join("\n") }
- c = a * b
- open('mat-%d-out' % d, 'w'){|f| f.write (1..d).map{|i| c[i,i] } }
- end
Add Comment
Please, Sign In to add comment