* Reworked timing output and increased some timing sizes.
authorRichard Kreckel <Richard.Kreckel@uni-mainz.de>
Fri, 18 Nov 2005 01:14:21 +0000 (01:14 +0000)
committerRichard Kreckel <Richard.Kreckel@uni-mainz.de>
Fri, 18 Nov 2005 01:14:21 +0000 (01:14 +0000)
25 files changed:
check/time_antipode.cpp
check/time_dennyfliegner.cpp
check/time_fateman_expand.cpp
check/time_gammaseries.cpp
check/time_lw_A.cpp
check/time_lw_B.cpp
check/time_lw_C.cpp
check/time_lw_D.cpp
check/time_lw_E.cpp
check/time_lw_F.cpp
check/time_lw_G.cpp
check/time_lw_H.cpp
check/time_lw_IJKL.cpp
check/time_lw_M1.cpp
check/time_lw_M2.cpp
check/time_lw_N.cpp
check/time_lw_O.cpp
check/time_lw_P.cpp
check/time_lw_Pprime.cpp
check/time_lw_Q.cpp
check/time_lw_Qprime.cpp
check/time_toeplitz.cpp
check/time_vandermonde.cpp
check/timer.cpp
check/times.cpp

index 670e6c2..50d43be 100644 (file)
@@ -496,7 +496,7 @@ unsigned time_antipode()
                } else {
                        cout << " failed ";
                }
-               cout << int(1000*jaeger_le_coultre.read())*0.001 << "s (total)" << endl;
+               cout << jaeger_le_coultre.read() << "s (total)" << endl;
        } else {
                cout << " disabled" << endl;
                clog << "(no output)" << endl;
index 8f558a2..b14d1b4 100644 (file)
@@ -64,10 +64,10 @@ unsigned time_dennyfliegner()
        vector<double> times;
        timer breitling;
        
-       sizes.push_back(50);
        sizes.push_back(100);
        sizes.push_back(200);
        sizes.push_back(400);
+       sizes.push_back(800);
        
        for (vector<unsigned>::iterator i=sizes.begin(); i!=sizes.end(); ++i) {
                breitling.start();
@@ -85,10 +85,10 @@ unsigned time_dennyfliegner()
        // print the report:
        cout << endl << "       size:  ";
        for (vector<unsigned>::iterator i=sizes.begin(); i!=sizes.end(); ++i)
-               cout << '\t' << (*i);
+               cout << '\t' << *i;
        cout << endl << "       time/s:";
        for (vector<double>::iterator i=times.begin(); i!=times.end(); ++i)
-               cout << '\t' << int(1000*(*i))*0.001;
+               cout << '\t' << *i;
        cout << endl;
        
        return result;
index b0a88e2..f78e821 100644 (file)
@@ -66,7 +66,7 @@ unsigned time_fateman_expand()
        } else {
                cout << " failed ";
        }
-       cout << int(1000*(time/count))*0.001 << 's' << endl;
+       cout << time/count << 's' << endl;
 
        return result;
 }
index dd04976..3715f83 100644 (file)
@@ -54,10 +54,10 @@ unsigned time_gammaseries()
        vector<double> times;
        timer omega;
 
-       sizes.push_back(10);
-       sizes.push_back(15);
        sizes.push_back(20);
        sizes.push_back(25);
+       sizes.push_back(30);
+       sizes.push_back(35);
 
        for (vector<unsigned>::iterator i=sizes.begin(); i!=sizes.end(); ++i) {
                omega.start();
@@ -75,10 +75,10 @@ unsigned time_gammaseries()
        // print the report:
        cout << endl << "       order: ";
        for (vector<unsigned>::iterator i=sizes.begin(); i!=sizes.end(); ++i)
-               cout << '\t' << (*i);
+               cout << '\t' << *i;
        cout << endl << "       time/s:";
        for (vector<double>::iterator i=times.begin(); i!=times.end(); ++i)
-               cout << '\t' << int(1000*(*i))*0.001;
+               cout << '\t' << *i;
        cout << endl;
        
        return result;
index 5df8ac6..8131455 100644 (file)
@@ -60,7 +60,7 @@ unsigned time_lw_A()
        } else {
                cout << " failed ";
        }
-       cout << int(1000*(time/count))*0.001 << 's' << endl;
+       cout << time/count << 's' << endl;
        
        return result;
 }
index eb83bda..6fe6138 100644 (file)
@@ -61,7 +61,7 @@ unsigned time_lw_B()
        } else {
                cout << " failed ";
        }
-       cout << int(1000*(time/count))*0.001 << 's' << endl;
+       cout << time/count << 's' << endl;
        
        return result;
 }
index c64343f..e6de171 100644 (file)
@@ -65,7 +65,7 @@ unsigned time_lw_C()
        } else {
                cout << " failed ";
        }
-       cout << int(1000*(time/count))*0.001 << 's' << endl;
+       cout << time/count << 's' << endl;
        
        return result;
 }
index 60e2eb6..55e2506 100644 (file)
@@ -65,7 +65,7 @@ unsigned time_lw_D()
        } else {
                cout << " failed ";
        }
-       cout << int(1000*(time/count))*0.001 << 's' << endl;
+       cout << time/count << 's' << endl;
        
        return result;
 }
index c2a6a81..5a49730 100644 (file)
@@ -65,7 +65,7 @@ unsigned time_lw_E()
        } else {
                cout << " failed ";
        }
-       cout << int(1000*(time/count))*0.001 << 's' << endl;
+       cout << time/count << 's' << endl;
        
        return result;
 }
index ad6be8b..8d8a893 100644 (file)
@@ -62,7 +62,7 @@ unsigned time_lw_F()
        } else {
                cout << " failed ";
        }
-       cout << int(1000*(time/count))*0.001 << 's' << endl;
+       cout << time/count << 's' << endl;
        
        return result;
 }
index 3b6483a..d0578b6 100644 (file)
@@ -65,7 +65,7 @@ unsigned time_lw_G()
        } else {
                cout << " failed ";
        }
-       cout << int(1000*(time/count))*0.001 << 's' << endl;
+       cout << time/count << 's' << endl;
        
        return result;
 }
index 1750616..efea576 100644 (file)
@@ -77,7 +77,7 @@ unsigned time_lw_H()
        } else {
                cout << " failed ";
        }
-       cout << int(1000*(time/count))*0.001 << 's' << endl;
+       cout << time/count << 's' << endl;
 
        return result;
 }
index 3572d1f..4d62fed 100644 (file)
@@ -45,7 +45,7 @@ static unsigned test(unsigned n)
        Hinv = H.inverse();
        cout << ". passed ";
        clog << "(no output)" << endl;
-       cout << int(1000*cartier.read())*0.001 << 's' << endl;
+       cout << cartier.read() << 's' << endl;
        
        // check result:
        name = (n==40?'J':(n==70?'L':'?'));
@@ -75,7 +75,7 @@ static unsigned test(unsigned n)
                cout << ". failed ";
                ++result;
        }
-       cout << int(1000*cartier.read())*0.001 << 's' << endl;
+       cout << cartier.read() << 's' << endl;
        return result;
 }
 
index 597a4a7..8ac2c25 100644 (file)
@@ -97,7 +97,7 @@ unsigned time_lw_M1()
        } else {
                cout << " failed ";
        }
-       cout << int(1000*(time/count))*0.001 << 's' << endl;
+       cout << time/count << 's' << endl;
        
        return result;
 }
index aa1178a..04218b7 100644 (file)
@@ -174,7 +174,7 @@ unsigned time_lw_M2()
                } else {
                        cout << " failed ";
                }
-               cout << int(1000*(time/count))*0.001 << 's' << endl;
+               cout << time/count << 's' << endl;
        } else {
                cout << " disabled" << endl;
                clog << "(no output)" << endl;
index 77e91a7..36f219d 100644 (file)
@@ -77,7 +77,7 @@ unsigned time_lw_N()
                } else {
                        cout << " failed ";
                }
-               cout << int(1000*(time/count))*0.001 << 's' << endl;
+               cout << time/count << 's' << endl;
        } else {
                cout << " disabled" << endl;
                clog << "(no output)" << endl;
index 254b39b..5ae917a 100644 (file)
@@ -148,7 +148,7 @@ unsigned time_lw_O()
        } else {
                cout << " failed ";
        }
-       cout << int(1000*(time/(3*count)))*0.001 << "s (average)" << endl;
+       cout << time/(3*count) << "s (average)" << endl;
 
        cout << "timing Lewis-Wester test O2 (Resultant)" << flush;
        clog << "-------Lewis-Wester test O2 (Resultant):" << endl;
@@ -163,7 +163,7 @@ unsigned time_lw_O()
                } else {
                        cout << " failed ";
                }
-               cout << int(1000*rolex.read())*0.001 << "s (combined)" << endl;
+               cout << rolex.read() << "s (combined)" << endl;
        } else {
                cout << " disabled" << endl;
                clog << "(no output)" << endl;
index 52a430d..e0270d2 100644 (file)
@@ -75,7 +75,7 @@ unsigned time_lw_P()
        } else {
                cout << " failed ";
        }
-       cout << int(1000*(time/count))*0.001 << 's' << endl;
+       cout << time/count << 's' << endl;
        
        return result;
 }
index 19b0559..9a5a04b 100644 (file)
@@ -88,7 +88,7 @@ unsigned time_lw_Pprime()
        } else {
                cout << " failed ";
        }
-       cout << int(1000*(time/count))*0.001 << 's' << endl;
+       cout << time/count << 's' << endl;
        
        return result;
 }
index 2a06769..7fb54f9 100644 (file)
@@ -79,7 +79,7 @@ unsigned time_lw_Q()
                } else {
                        cout << " failed ";
                }
-               cout << int(1000*(time/count))*0.001 << 's' << endl;
+               cout << time/count << 's' << endl;
        } else {
                cout << " disabled" << endl;
                clog << "(no output)" << endl;
index 4abedd1..28b30ca 100644 (file)
@@ -91,7 +91,7 @@ unsigned time_lw_Qprime()
                } else {
                        cout << " failed ";
                }
-               cout << int(1000*(time/count))*0.001 << 's' << endl;
+               cout << time/count << 's' << endl;
        } else {
                cout << " disabled" << endl;
                clog << "(no output)" << endl;
index 20c9a13..8c2008a 100644 (file)
@@ -29,7 +29,7 @@ static unsigned toeplitz_det(unsigned size)
 {
        unsigned result = 0;
        const symbol a("a"), b("b");
-       ex p[9] = {ex("a",lst(a,b)),
+       ex p[10] = {ex("a",lst(a,b)),
                   ex("b",lst(a,b)),
                   ex("a+b",lst(a,b)),
                   ex("a^2+a*b+b^2",lst(a,b)),
@@ -37,7 +37,8 @@ static unsigned toeplitz_det(unsigned size)
                   ex("a^4+a^3*b+a^2*b^2+a*b^3+b^4",lst(a,b)),
                   ex("a^5+a^4*b+a^3*b^2-a^2*b^3+a*b^4+b^5",lst(a,b)),
                   ex("a^6+a^5*b+a^4*b^2+a^3*b^3+a^2*b^4+a*b^5+b^6",lst(a,b)),
-                  ex("a^7+a^6*b+a^5*b^2+a^4*b^3-a^3*b^4+a^2*b^5+a*b^6+b^7",lst(a,b))
+                  ex("a^7+a^6*b+a^5*b^2+a^4*b^3-a^3*b^4+a^2*b^5+a*b^6+b^7",lst(a,b)),
+                  ex("a^8+a^7*b+a^6*b^2+a^5*b^3+a^4*b^4+a^3*b^5+a^2*b^6+a*b^7+b^8",lst(a,b))
        };
 
        // construct Toeplitz matrix (diagonal structure: [[x,y,z],[y,x,y],[z,y,x]]):
@@ -74,10 +75,10 @@ unsigned time_toeplitz()
        vector<double> times;
        timer longines;
 
-       sizes.push_back(6);
        sizes.push_back(7);
        sizes.push_back(8);
        sizes.push_back(9);
+       sizes.push_back(10);
 
        for (vector<unsigned>::iterator i=sizes.begin(); i!=sizes.end(); ++i) {
                int count = 1;
@@ -104,7 +105,7 @@ unsigned time_toeplitz()
                cout << '\t' << *i << 'x' << *i;
        cout << endl << "       time/s:";
        for (vector<double>::iterator i=times.begin(); i!=times.end(); ++i)
-               cout << '\t' << int(1000*(*i))*0.001;
+               cout << '\t' << *i;
        cout << endl;
 
        return result;
index 3516ef6..d4f9492 100644 (file)
@@ -72,10 +72,10 @@ unsigned time_vandermonde()
        vector<double> times;
        timer swatch;
        
-       sizes.push_back(6);
        sizes.push_back(8);
        sizes.push_back(10);
        sizes.push_back(12);
+       sizes.push_back(14);
        
        for (vector<unsigned>::iterator i=sizes.begin(); i!=sizes.end(); ++i) {
                int count = 1;
@@ -102,7 +102,7 @@ unsigned time_vandermonde()
                cout << '\t' << *i << 'x' << *i;
        cout << endl << "       time/s:";
        for (vector<double>::iterator i=times.begin(); i!=times.end(); ++i)
-               cout << '\t' << int(1000*(*i))*0.001;
+               cout << '\t' << *i;
        cout << endl;
        
        return result;
index b6c3a6b..0723b8a 100644 (file)
@@ -86,18 +86,15 @@ double timer::read()
 #ifdef HAVE_RUSAGE
        if (running())
                getrusage(RUSAGE_SELF, &used2);
-       elapsed = ((used2.ru_utime.tv_sec - used1.ru_utime.tv_sec) +
-                  (used2.ru_stime.tv_sec - used1.ru_stime.tv_sec) +
-                  (used2.ru_utime.tv_usec - used1.ru_utime.tv_usec) * 1e-6 +
-                  (used2.ru_stime.tv_usec - used1.ru_stime.tv_usec) * 1e-6);
+       return ((used2.ru_utime.tv_sec - used1.ru_utime.tv_sec) +
+               (used2.ru_stime.tv_sec - used1.ru_stime.tv_sec) +
+               (used2.ru_utime.tv_usec - used1.ru_utime.tv_usec) * 1e-6 +
+               (used2.ru_stime.tv_usec - used1.ru_stime.tv_usec) * 1e-6);
 #else
        if (running())
                used2 = clock();
-       elapsed = double(used2 - used1)/CLOCKS_PER_SEC;
+       return double(used2 - used1)/CLOCKS_PER_SEC;
 #endif
-       // Results more accurate than 10ms are pointless:
-       return elapsed;
-       return 0.01*int(elapsed*100+0.5);
 }
 
 bool timer::running()
index 8db2c0c..93d0e13 100644 (file)
  */
 void randomify_symbol_serials()
 {
-       srand((unsigned)time(NULL));
+       srand(time(NULL));
        const int m = rand() % 666;
        for (int s=0; s<m; ++s ) {
-               symbol* tmp = new symbol;
-               delete tmp;
+               symbol("dummy");
        }
 }
 
@@ -53,6 +52,9 @@ int main()
        randomify_symbol_serials();
 
        unsigned result = 0;
+
+       // For all timings:
+       cout << setprecision(2) << showpoint;
        
 #define TIME(which) \
 try { \