Bug 449371 Firefox/Thunderbird crashes at exit [@ gdk_display_x11_finalize], p=Brian...
[wine-gecko.git] / testing / performance / talos / page_load_test / jss / real-spectral-norm-2.html
blob5724cb2edc1872bf52f6e55c8293f31ba01d976d
1 <html><head>
2 <!-- MOZ_INSERT_CONTENT_HOOK -->
3 <script src = runner.js></script>
4 <script>
5 var onlyName = 'Spectral Norm', onlyNum = 16;
6 function thisTest() {
8 // The Great Computer Language Shootout
9 // http://shootout.alioth.debian.org/
11 // contributed by Ian Osgood
13 function A(i,j) {
14 return 1/((i+j)*(i+j+1)/2+i+1);
17 function Au(u,v) {
18 for (var i=0; i<u.length; ++i) {
19 var t = 0;
20 for (var j=0; j<u.length; ++j)
21 t += A(i,j) * u[j];
22 v[i] = t;
26 function Atu(u,v) {
27 for (var i=0; i<u.length; ++i) {
28 var t = 0;
29 for (var j=0; j<u.length; ++j)
30 t += A(j,i) * u[j];
31 v[i] = t;
35 function AtAu(u,v,w) {
36 Au(u,w);
37 Atu(w,v);
40 function spectralnorm(n) {
41 var i, u=[], v=[], w=[], vv=0, vBv=0;
42 for (i=0; i<n; ++i) {
43 u[i] = 1; v[i] = w[i] = 0;
45 for (i=0; i<10; ++i) {
46 AtAu(u,v,w);
47 AtAu(v,u,w);
49 for (i=0; i<n; ++i) {
50 vBv += u[i]*v[i];
51 vv += v[i]*v[i];
53 return Math.sqrt(vBv/vv);
56 startTest("real-spectral-norm");
58 for ( var i = 8; i <= 64; i *= 2 ) (function(i){
59 test( "Spectral Norm", i, function(){
60 spectralnorm(i);
61 });
62 })(i);
64 endTest();
66 </script>
67 <body onload="thisTest()"></body></html>