/mobile Handheld Friendly website
x64 Ubuntu : Intel® Q6600® one core |
Each table row shows performance measurements for this Ruby 2.0 program with a particular command-line input value N.
| N | CPU secs | Elapsed secs | Memory KB | Code B | ≈ CPU Load |
|---|---|---|---|---|---|
| 500 | 3.34 | 3.34 | 6,136 | 292 | 1% 0% 0% 100% |
| 3,000 | 116.10 | 116.13 | 6,144 | 292 | 0% 0% 0% 100% |
| 5,500 | 394.71 | 394.79 | 6,396 | 292 | 0% 0% 0% 100% |
Read the ↓ make, command line, and program output logs to see how this program was run.
Read spectral-norm benchmark to see what this program should do.
ruby 2.0.0p0 (2013-02-24 revision 39474) [x86_64-linux]
# The Computer Language Benchmarks Game # http://benchmarksgame.alioth.debian.org # Contributed by Sokolov Yura def eval_A(i,j) return 1.0/((i+j)*(i+j+1)/2+i+1) end def eval_A_times_u(u) v, i = nil, nil (0..u.length-1).collect { |i| v = 0 for j in 0..u.length-1 v += eval_A(i,j)*u[j] end v } end def eval_At_times_u(u) v, i = nil, nil (0..u.length-1).collect{|i| v = 0 for j in 0..u.length-1 v += eval_A(j,i)*u[j] end v } end def eval_AtA_times_u(u) return eval_At_times_u(eval_A_times_u(u)) end n = ARGV[0].to_i u=[1]*n for i in 1..10 v=eval_AtA_times_u(u) u=eval_AtA_times_u(v) end vBv=0 vv=0 for i in 0..n-1 vBv += u[i]*v[i] vv += v[i]*v[i] end print "%0.9f" % (Math.sqrt(vBv/vv)), "\n"
Mon, 25 Feb 2013 11:19:05 GMT COMMAND LINE: /usr/local/src/ruby-2.0.0-p0/ruby spectralnorm.yarv 5500 PROGRAM OUTPUT: 1.274224153