Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(86)

Side by Side Diff: chrome/test/data/dromaeo/tests/sunspider-math-spectral-norm.html

Issue 269054: Importing dromaeo performance tests to src/chrome/test/data.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 <html>
2 <head>
3 <script src="../htmlrunner.js"></script>
4 <script>
5 // The Great Computer Language Shootout
6 // http://shootout.alioth.debian.org/
7 //
8 // contributed by Ian Osgood
9
10 function A(i,j) {
11 return 1/((i+j)*(i+j+1)/2+i+1);
12 }
13
14 function Au(u,v) {
15 for (var i=0; i<u.length; ++i) {
16 var t = 0;
17 for (var j=0; j<u.length; ++j)
18 t += A(i,j) * u[j];
19 v[i] = t;
20 }
21 }
22
23 function Atu(u,v) {
24 for (var i=0; i<u.length; ++i) {
25 var t = 0;
26 for (var j=0; j<u.length; ++j)
27 t += A(j,i) * u[j];
28 v[i] = t;
29 }
30 }
31
32 function AtAu(u,v,w) {
33 Au(u,w);
34 Atu(w,v);
35 }
36
37 function spectralnorm(n) {
38 var i, u=[], v=[], w=[], vv=0, vBv=0;
39 for (i=0; i<n; ++i) {
40 u[i] = 1; v[i] = w[i] = 0;
41 }
42 for (i=0; i<10; ++i) {
43 AtAu(u,v,w);
44 AtAu(v,u,w);
45 }
46 for (i=0; i<n; ++i) {
47 vBv += u[i]*v[i];
48 vv += v[i]*v[i];
49 }
50 return Math.sqrt(vBv/vv);
51 }
52
53 window.onload = function(){ startTest("sunspider-math-spectral-norm", '');
54
55 test( "Spectral Norm", function(){
56 for (var i = 12; i <= 24; i *= 2)
57 spectralnorm(i);
58 });
59
60 endTest(); };
61 </script>
62 </head>
63 <body></body>
64 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698