Roll leveldb 3f7758:803d69 (v1.17 -> v1.18)
[chromium-blink-merge.git] / chrome / test / data / dromaeo / tests / sunspider-math-spectral-norm.html
blobf44a906d47e97d6c2ce7dd7a6495f7e211821d27
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
10 function A(i,j) {
11 return 1/((i+j)*(i+j+1)/2+i+1);
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;
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;
32 function AtAu(u,v,w) {
33 Au(u,w);
34 Atu(w,v);
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;
42 for (i=0; i<10; ++i) {
43 AtAu(u,v,w);
44 AtAu(v,u,w);
46 for (i=0; i<n; ++i) {
47 vBv += u[i]*v[i];
48 vv += v[i]*v[i];
50 return Math.sqrt(vBv/vv);
53 window.onload = function(){ startTest("sunspider-math-spectral-norm", 'e740809d');
55 test( "Spectral Norm", function(){
56 for (var i = 12; i <= 24; i *= 2)
57 spectralnorm(i);
58 });
60 endTest(); };
61 </script>
62 </head>
63 <body></body>
64 </html>