X-Git-Url: https://www.ginac.de/ginac.git//ginac.git?p=ginac.git;a=blobdiff_plain;f=check%2Ftime_toeplitz.cpp;h=813e5214fd741468156a2bfd2ee4da36d897c626;hp=20c9a13a2b0899c144ab47204021eba6684ccffe;hb=4f596b14ac1cdb03163c74e210cab493358ababf;hpb=da64e515abf7243bc4c84ca3631470931c4e6691 diff --git a/check/time_toeplitz.cpp b/check/time_toeplitz.cpp index 20c9a13a..813e5214 100644 --- a/check/time_toeplitz.cpp +++ b/check/time_toeplitz.cpp @@ -6,7 +6,7 @@ */ /* - * GiNaC Copyright (C) 1999-2005 Johannes Gutenberg University Mainz, Germany + * GiNaC Copyright (C) 1999-2008 Johannes Gutenberg University Mainz, Germany * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -23,13 +23,18 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "times.h" +#include +#include +#include "ginac.h" +#include "timer.h" +using namespace std; +using namespace GiNaC; 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 +42,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]]): @@ -68,16 +74,15 @@ unsigned time_toeplitz() unsigned result = 0; cout << "timing determinant of polyvariate symbolic Toeplitz matrices" << flush; - clog << "-------determinant of polyvariate symbolic Toeplitz matrices:" << endl; vector sizes; vector 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::iterator i=sizes.begin(); i!=sizes.end(); ++i) { int count = 1; @@ -92,20 +97,23 @@ unsigned time_toeplitz() cout << '.' << flush; } - if (!result) { - cout << " passed "; - clog << "(no output)" << endl; - } else { - cout << " failed "; - } // print the report: cout << endl << " dim: "; for (vector::iterator i=sizes.begin(); i!=sizes.end(); ++i) cout << '\t' << *i << 'x' << *i; cout << endl << " time/s:"; for (vector::iterator i=times.begin(); i!=times.end(); ++i) - cout << '\t' << int(1000*(*i))*0.001; + cout << '\t' << *i; cout << endl; return result; } + +extern void randomify_symbol_serials(); + +int main(int argc, char** argv) +{ + randomify_symbol_serials(); + cout << setprecision(2) << showpoint; + return time_toeplitz(); +}