From: Richard Kreckel Date: Fri, 17 Feb 2017 22:32:19 +0000 (+0100) Subject: checks: prefer initializer lists over push_back on vectors. X-Git-Tag: release_1-7-3~21 X-Git-Url: https://ginac.de/ginac.git//ginac.git?a=commitdiff_plain;h=26e9e289dd5e4f0790ee687d56db41b95dfe98f7;hp=a528cac19001a5beba9d54832b341ed84dc5bd53;p=ginac.git checks: prefer initializer lists over push_back on vectors. --- diff --git a/check/time_dennyfliegner.cpp b/check/time_dennyfliegner.cpp index 813c35f6..e8905113 100644 --- a/check/time_dennyfliegner.cpp +++ b/check/time_dennyfliegner.cpp @@ -66,15 +66,10 @@ unsigned time_dennyfliegner() cout << "timing commutative expansion and substitution" << flush; - vector sizes; + vector sizes = {100, 200, 400, 800}; vector times; timer breitling; - sizes.push_back(100); - sizes.push_back(200); - sizes.push_back(400); - sizes.push_back(800); - for (vector::iterator i=sizes.begin(); i!=sizes.end(); ++i) { breitling.start(); result += expand_subs(*i); diff --git a/check/time_gammaseries.cpp b/check/time_gammaseries.cpp index cb5846ca..90038302 100644 --- a/check/time_gammaseries.cpp +++ b/check/time_gammaseries.cpp @@ -55,15 +55,10 @@ unsigned time_gammaseries() cout << "timing Laurent series expansion of Gamma function" << flush; - vector sizes; + vector sizes = {20, 25, 30, 35}; vector times; timer omega; - sizes.push_back(20); - sizes.push_back(25); - sizes.push_back(30); - sizes.push_back(35); - for (vector::iterator i=sizes.begin(); i!=sizes.end(); ++i) { omega.start(); result += tgammaseries(*i); diff --git a/check/time_toeplitz.cpp b/check/time_toeplitz.cpp index ddb5746e..d5f64c09 100644 --- a/check/time_toeplitz.cpp +++ b/check/time_toeplitz.cpp @@ -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 sizes; + vector sizes = {7, 8, 9, 10}; vector times; timer longines; - sizes.push_back(7); - sizes.push_back(8); - sizes.push_back(9); - sizes.push_back(10); - for (vector::iterator i=sizes.begin(); i!=sizes.end(); ++i) { int count = 1; longines.start(); diff --git a/check/time_vandermonde.cpp b/check/time_vandermonde.cpp index 1ed4f36e..5a8263ed 100644 --- a/check/time_vandermonde.cpp +++ b/check/time_vandermonde.cpp @@ -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 sizes; + vector sizes = {8, 10, 12, 14}; vector times; timer swatch; - sizes.push_back(8); - sizes.push_back(10); - sizes.push_back(12); - sizes.push_back(14); - for (vector::iterator i=sizes.begin(); i!=sizes.end(); ++i) { int count = 1; swatch.start();