Fix for JRUBY-2882. Handle error messages related to constructors better
[jruby.git] / bench / shootout / matrix.ruby-2.ruby
blobf4a312281c9abd72b7cb7607897a0f15bba08e01
1 #!/usr/bin/ruby
2 # -*- mode: ruby -*-
3 # $Id: matrix.ruby-2.ruby,v 1.1 2005-03-23 06:11:41 bfulgham Exp $
4 # http://shootout.alioth.debian.org/
6 # Contributed by Christopher Williams
8 n = (ARGV[0] || 60).to_i
9 size = 30
10 require 'matrix'
11 n = (ARGV[0] || 600).to_i
12 size = 30
14 def mkmatrix(rows,cols)
15 count = 0
16 the_rows = Array.new(rows) do |i|
17 Array.new(cols) {|j| count +=1 }
18 end
19 Matrix[*the_rows]
20 end
22 m1 = mkmatrix(size,size)
23 m2 = mkmatrix(size,size)
24 mm = []
25 n.times do
26 mm = m1 * m2
27 end
28 puts "#{mm[0,0]} #{mm[2,3]} #{mm[3,2]} #{mm[4,4]}"