X-Git-Url: https://www.ginac.de/ginac.git//ginac.git?p=ginac.git;a=blobdiff_plain;f=check%2Ftime_dennyfliegner.cpp;h=ea3b7be5abe9b812175a596ee8fbfccc16b23b77;hp=591e7a4f6f4719bf853e3e12c33c0cee272f7786;hb=1d07d8ac9fb47c51aa19a84df6c8c5fee5dd5105;hpb=fdf2f2da4e2b00870cd05c2ac9121de53e56ce3b;ds=sidebyside diff --git a/check/time_dennyfliegner.cpp b/check/time_dennyfliegner.cpp index 591e7a4f..ea3b7be5 100644 --- a/check/time_dennyfliegner.cpp +++ b/check/time_dennyfliegner.cpp @@ -7,7 +7,7 @@ * after which e should be just a1^2. */ /* - * GiNaC Copyright (C) 1999-2000 Johannes Gutenberg University Mainz, Germany + * GiNaC Copyright (C) 1999-2003 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 @@ -26,70 +26,70 @@ #include "times.h" -#define VECSIZE 200 - static unsigned expand_subs(unsigned size) { - unsigned result = 0; - symbol a1("a1"); - symbol a[VECSIZE]; - ex e, aux; - - a[1] = a1; - for (unsigned i=0; i a; + ex e; + for (unsigned i=0; i sizes; - vector times; - timer rolex; - - sizes.push_back(25); - sizes.push_back(50); - sizes.push_back(100); - sizes.push_back(200); - - for (vector::iterator i=sizes.begin(); i!=sizes.end(); ++i) { - rolex.start(); - result += expand_subs(*i); - times.push_back(rolex.read()); - cout << '.' << flush; - } - - if (!result) { - cout << " passed "; - clog << "(no output)" << endl; - } else { - cout << " failed "; - } - // print the report: - cout << endl << " size: "; - for (vector::iterator i=sizes.begin(); i!=sizes.end(); ++i) - cout << '\t' << (*i); - cout << endl << " time/s:"; - for (vector::iterator i=times.begin(); i!=times.end(); ++i) - cout << '\t' << int(1000*(*i))*0.001; - cout << endl; - - return result; + unsigned result = 0; + + cout << "timing commutative expansion and substitution" << flush; + clog << "-------commutative expansion and substitution:" << endl; + + vector sizes; + vector times; + timer breitling; + + sizes.push_back(25); + sizes.push_back(50); + sizes.push_back(100); + sizes.push_back(200); + + for (vector::iterator i=sizes.begin(); i!=sizes.end(); ++i) { + breitling.start(); + result += expand_subs(*i); + times.push_back(breitling.read()); + cout << '.' << flush; + } + + if (!result) { + cout << " passed "; + clog << "(no output)" << endl; + } else { + cout << " failed "; + } + // print the report: + cout << endl << " size: "; + for (vector::iterator i=sizes.begin(); i!=sizes.end(); ++i) + cout << '\t' << (*i); + cout << endl << " time/s:"; + for (vector::iterator i=times.begin(); i!=times.end(); ++i) + cout << '\t' << int(1000*(*i))*0.001; + cout << endl; + + return result; }