]> www.ginac.de Git - ginac.git/commitdiff
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 813c35f6cf829fb3f3d4ebdb4b7b7bf6bb0f74f2..e890511362682a6f40caa63b03e8f35a5aab1d25 100644 (file)
@@ -66,15 +66,10 @@ unsigned time_dennyfliegner()
        
        cout << "timing commutative expansion and substitution" << flush;
        
        
        cout << "timing commutative expansion and substitution" << flush;
        
-       vector<unsigned> sizes;
+       vector<unsigned> sizes = {100, 200, 400, 800};
        vector<double> times;
        timer breitling;
        
        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);
        for (vector<unsigned>::iterator i=sizes.begin(); i!=sizes.end(); ++i) {
                breitling.start();
                result += expand_subs(*i);
index cb5846ca51edaf54c50cd6c829070913963ba8b4..9003830216cd4b2efe67dd2f0214e4458cfd2751 100644 (file)
@@ -55,15 +55,10 @@ unsigned time_gammaseries()
 
        cout << "timing Laurent series expansion of Gamma function" << flush;
 
 
        cout << "timing Laurent series expansion of Gamma function" << flush;
 
-       vector<unsigned> sizes;
+       vector<unsigned> sizes = {20, 25, 30, 35};
        vector<double> times;
        timer omega;
 
        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);
        for (vector<unsigned>::iterator i=sizes.begin(); i!=sizes.end(); ++i) {
                omega.start();
                result += tgammaseries(*i);
index ddb5746ecb8e210cd4057ecc4e14f4e6ecabb9d9..d5f64c0989a32dab7bb53e53f03fc9ca217cdd35 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()) {
 
        // 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;
                     << "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;
 
 
        cout << "timing determinant of polyvariate symbolic Toeplitz matrices" << flush;
 
-       vector<unsigned> sizes;
+       vector<unsigned> sizes = {7, 8, 9, 10};
        vector<double> times;
        timer longines;
 
        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();
        for (vector<unsigned>::iterator i=sizes.begin(); i!=sizes.end(); ++i) {
                int count = 1;
                longines.start();
index 1ed4f36e59d493a3ac2bc6e007daa2049389e8b3..5a8263edef07fa08572b27c9e0dcf96868928162 100644 (file)
@@ -58,7 +58,7 @@ static unsigned vandermonde_det(unsigned size)
                        vanddet *= M(i,1) - M(j,1);
 
        if (expand(det - vanddet) != 0) {
                        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;
                     << "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;
        
        
        cout << "timing determinant of univariate symbolic Vandermonde matrices" << flush;
        
-       vector<unsigned> sizes;
+       vector<unsigned> sizes = {8, 10, 12, 14};
        vector<double> times;
        timer swatch;
        
        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();
        for (vector<unsigned>::iterator i=sizes.begin(); i!=sizes.end(); ++i) {
                int count = 1;
                swatch.start();