checks: prefer initializer lists over push_back on vectors.
authorRichard Kreckel <kreckel@ginac.de>
Fri, 17 Feb 2017 22:32:19 +0000 (23:32 +0100)
committerRichard Kreckel <kreckel@ginac.de>
Fri, 17 Feb 2017 22:32:19 +0000 (23:32 +0100)
check/time_dennyfliegner.cpp
check/time_gammaseries.cpp
check/time_toeplitz.cpp
check/time_vandermonde.cpp

index 813c35f..e890511 100644 (file)
@@ -66,15 +66,10 @@ unsigned time_dennyfliegner()
        
        cout << "timing commutative expansion and substitution" << flush;
        
-       vector<unsigned> sizes;
+       vector<unsigned> sizes = {100, 200, 400, 800};
        vector<double> times;
        timer breitling;
        
-       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();
                result += expand_subs(*i);
index cb5846c..9003830 100644 (file)
@@ -55,15 +55,10 @@ unsigned time_gammaseries()
 
        cout << "timing Laurent series expansion of Gamma function" << flush;
 
-       vector<unsigned> sizes;
+       vector<unsigned> sizes = {20, 25, 30, 35};
        vector<double> times;
        timer omega;
 
-       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();
                result += tgammaseries(*i);
index ddb5746..d5f64c0 100644 (file)
@@ -61,7 +61,7 @@ static unsigned toeplitz_det(unsigned size)
 
        // dirty consistency check of result:
        if (!tdet.subs(a==0).subs(b==0).is_zero()) {
-               clog << "Determaint of Toeplitz matrix " << endl
+               clog << "Determinant of Toeplitz matrix " << endl
                     << "M==" << M << endl
                     << "was miscalculated: det(M)==" << tdet << endl;
                ++result;
@@ -76,15 +76,10 @@ unsigned time_toeplitz()
 
        cout << "timing determinant of polyvariate symbolic Toeplitz matrices" << flush;
 
-       vector<unsigned> sizes;
+       vector<unsigned> sizes = {7, 8, 9, 10};
        vector<double> times;
        timer longines;
 
-       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;
                longines.start();
index 1ed4f36..5a8263e 100644 (file)
@@ -58,7 +58,7 @@ static unsigned vandermonde_det(unsigned size)
                        vanddet *= M(i,1) - M(j,1);
 
        if (expand(det - vanddet) != 0) {
-               clog << "Determaint of Vandermonde matrix " << endl
+               clog << "Determinant of Vandermonde matrix " << endl
                     << "M==" << M << endl
                     << "was miscalculated: det(M)==" << det << endl;
                ++result;
@@ -73,15 +73,10 @@ unsigned time_vandermonde()
        
        cout << "timing determinant of univariate symbolic Vandermonde matrices" << flush;
        
-       vector<unsigned> sizes;
+       vector<unsigned> sizes = {8, 10, 12, 14};
        vector<double> times;
        timer swatch;
        
-       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;
                swatch.start();