X-Git-Url: https://www.ginac.de/ginac.git//ginac.git?a=blobdiff_plain;f=check%2Ftime_dennyfliegner.cpp;h=d81ba91930551ecde72eb3931c5d2ab220adfd00;hb=312b062f7f49207a16776c19d3a1bfb4a49c2f3b;hp=23c7a95351088ae9fe746db847624db8b835ff8d;hpb=f4ea690a3f118bf364190f0ef3c3f6d2ccdf6206;p=ginac.git diff --git a/check/time_dennyfliegner.cpp b/check/time_dennyfliegner.cpp index 23c7a953..d81ba919 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-2001 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,71 +26,76 @@ #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(40); - sizes.push_back(60); - sizes.push_back(100); - sizes.push_back(150); - - for (vector::iterator i=sizes.begin(); i!=sizes.end(); ++i) { - rolex.start(); - result += expand_subs(*i); cout << '.' << flush; - times.push_back(rolex.read()); - } - - 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' << (*i); - } - 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; }