Permalink
Browse files

small changes in benchmarks

Ignore-this: a473483b8fa8cc8a67f0e8348a3522ff

darcs-hash:20110823163405-1b86b-f91d9a023ad2d0f246dbf19a6a188beb6834aea3
  • Loading branch information...
1 parent 23f6cfd commit 2f1c29c5c07c6f81cf15491743b7c5a3e433eaed balat at pps.jussieu.fr committed Aug 23, 2011
Showing with 1 addition and 99 deletions.
  1. +1 −1 benchmarks/Makefile
  2. +0 −49 benchmarks/sources/js/spectral_norm.js
  3. +0 −49 benchmarks/sources/ml/spectral_norm.ml
View
@@ -117,7 +117,7 @@ size.gpl: __run __missingsizes
-append unison \
-max 3 -ylabel Size -script \
-svg 7 650 150 \
- | perl -pe 'BEGIN{undef $$/;} s/e\nplot/e\nset key at 24.75,1.80\nplot/smg' \
+ | perl -pe 'BEGIN{undef $$/;} s/e\nplot/e\nset key at 23.75,1.80\nplot/smg' \
> $@
time-optim.svg: __run
@@ -1,49 +0,0 @@
-// The Great Computer Language Shootout
-// http://shootout.alioth.debian.org/
-//
-// contributed by Ian Osgood
-
-function A(i,j) {
- return 1/((i+j)*(i+j+1)/2+i+1);
-}
-
-function Au(u,v) {
- for (var i=0; i<u.length; ++i) {
- var t = 0;
- for (var j=0; j<u.length; ++j)
- t += A(i,j) * u[j];
- v[i] = t;
- }
-}
-
-function Atu(u,v) {
- for (var i=0; i<u.length; ++i) {
- var t = 0;
- for (var j=0; j<u.length; ++j)
- t += A(j,i) * u[j];
- v[i] = t;
- }
-}
-
-function AtAu(u,v,w) {
- Au(u,w);
- Atu(w,v);
-}
-
-function spectralnorm(n) {
- var i, u=[], v=[], w=[], vv=0, vBv=0;
- for (i=0; i<n; ++i) {
- u[i] = 1; v[i] = w[i] = 0;
- }
- for (i=0; i<10; ++i) {
- AtAu(u,v,w);
- AtAu(v,u,w);
- }
- for (i=0; i<n; ++i) {
- vBv += u[i]*v[i];
- vv += v[i]*v[i];
- }
- return Math.sqrt(vBv/vv);
-}
-
-spectralnorm(5500);
@@ -1,49 +0,0 @@
-(* The Computer Language Benchmarks Game
- * http://shootout.alioth.debian.org/
- *
- * Contributed by Sebastien Loisel
- * Cleanup by Troestler Christophe
- * Modified by Mauricio Fernandez
- *)
-
-let eval_A i j = 1. /. float((i+j)*(i+j+1)/2+i+1)
-
-let eval_A_times_u u v =
- let n = Array.length v - 1 in
- for i = 0 to n do
- let vi = ref 0. in
- for j = 0 to n do vi := !vi +. eval_A i j *. u.(j) done;
- v.(i) <- !vi
- done
-
-let eval_At_times_u u v =
- let n = Array.length v -1 in
- for i = 0 to n do
- let vi = ref 0. in
- for j = 0 to n do vi := !vi +. eval_A j i *. u.(j) done;
- v.(i) <- !vi
- done
-
-let eval_AtA_times_u u v =
- let w = Array.make (Array.length u) 0.0 in
- eval_A_times_u u w; eval_At_times_u w v
-
-
-let () =
-(*
- let n = try int_of_string(Array.get Sys.argv 1) with _ -> 2000 in
-*)
- let n = 5500 in
- let u = Array.make n 1.0 and v = Array.make n 0.0 in
- for i = 0 to 9 do
- eval_AtA_times_u u v; eval_AtA_times_u v u
- done;
-
- let vv = ref 0.0 and vBv = ref 0.0 in
- for i=0 to n-1 do
- vv := !vv +. v.(i) *. v.(i);
- vBv := !vBv +. u.(i) *. v.(i)
- done;
-(*
- Printf.printf "%0.9f\n" (sqrt(!vBv /. !vv))
-*)

0 comments on commit 2f1c29c

Please sign in to comment.