daily pastebin goal
52%
SHARE
TWEET

Untitled

a guest Jan 12th, 2018 45 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/usr/bin/env ruby
  2. require 'matrix'
  3.  
  4. [16,64,256,257,512,111,229].each do |d|
  5.   a = Matrix.build(d, d){ rand(2)-1 }
  6.   b = Matrix.build(d, d){ rand(2)-1 }
  7.   open('mat-%d' % d, 'w'){|f| f.write (a.to_a.flatten + b.to_a.flatten).join("\n") }
  8.   c = a * b
  9.   open('mat-%d-out' % d, 'w'){|f| f.write (1..d).map{|i| c[i,i] } }
  10. end
RAW Paste Data
Top