From: Alexei Sheplyakov Date: Thu, 28 Feb 2008 07:11:50 +0000 (+0300) Subject: check: indicate the test failures with non-zero exit code; split test programs. X-Git-Tag: release_1-5-0~115 X-Git-Url: https://www.ginac.de/ginac.git//ginac.git?p=ginac.git;a=commitdiff_plain;h=c3c748381bda4f81b68e50db2eed440c19f24b85 check: indicate the test failures with non-zero exit code; split test programs. IMNSHO parsing the output of test programs in order to check if the tests passed is a bad idea (and it causes *real* problems, see e.g. http://www.ginac.de/pipermail/ginac-list/2008-February/001345.html). It's much simpler and cleaner to indicate the failure in a genuine *NIX way: exit with nonzero code. --- diff --git a/check/Makefile.am b/check/Makefile.am index b7c9d0fb..d7f372b1 100644 --- a/check/Makefile.am +++ b/check/Makefile.am @@ -1,31 +1,218 @@ ## Process this file with automake to produce Makefile.in -TESTS = run_exams run_checks run_times -check_PROGRAMS = exams checks times -TESTS_ENVIRONMENT = EXEEXT=$(EXEEXT) srcdir=$(srcdir) - -checks_SOURCES = check_numeric.cpp check_inifcns.cpp check_matrices.cpp \ - check_lsolve.cpp genex.cpp checks.cpp checks.h -checks_LDADD = ../ginac/libginac.la - -exams_SOURCES = exam_paranoia.cpp exam_numeric.cpp exam_powerlaws.cpp \ - exam_inifcns.cpp exam_inifcns_nstdsums.cpp exam_inifcns_nstdsums.h \ - exam_differentiation.cpp exam_polygcd.cpp exam_normalization.cpp \ - exam_pseries.cpp exam_matrices.cpp exam_lsolve.cpp exam_indexed.cpp \ - exam_color.cpp exam_clifford.cpp exam_archive.cpp exam_structure.cpp \ - exam_hashmap.cpp exam_misc.cpp exams.cpp exams.h -exams_LDADD = ../ginac/libginac.la - -times_SOURCES = time_dennyfliegner.cpp time_gammaseries.cpp \ - time_vandermonde.cpp time_toeplitz.cpp time_hashmap.cpp time_lw_A.cpp \ - time_lw_B.cpp time_lw_C.cpp time_lw_D.cpp time_lw_E.cpp time_lw_F.cpp \ - time_lw_G.cpp time_lw_H.cpp time_lw_IJKL.cpp time_lw_M1.cpp time_lw_M2.cpp \ - time_lw_N.cpp time_lw_O.cpp time_lw_P.cpp time_lw_Pprime.cpp time_lw_Q.cpp \ - time_lw_Qprime.cpp time_antipode.cpp time_fateman_expand.cpp timer.cpp \ - timer.h times.cpp times.h -times_LDADD = ../ginac/libginac.la - -INCLUDES = -I$(srcdir)/../ginac -I../ginac - -CLEANFILES = exams.out checks.out times.out exam.gar -EXTRA_DIST = exams.ref checks.ref times.ref run_exams run_checks run_times +CHECKS = check_numeric \ + check_inifcns \ + check_matrices \ + check_lsolve + +EXAMS = exam_paranoia \ + exam_numeric \ + exam_powerlaws \ + exam_inifcns \ + exam_inifcns_nstdsums \ + exam_differentiation \ + exam_polygcd \ + exam_normalization \ + exam_pseries \ + exam_matrices \ + exam_lsolve \ + exam_indexed \ + exam_color \ + exam_clifford \ + exam_archive \ + exam_structure \ + exam_hashmap \ + exam_misc + +TIMES = time_dennyfliegner \ + time_gammaseries \ + time_vandermonde \ + time_toeplitz \ + time_hashmap \ + time_lw_A \ + time_lw_B \ + time_lw_C \ + time_lw_D \ + time_lw_E \ + time_lw_F \ + time_lw_G \ + time_lw_H \ + time_lw_IJKL \ + time_lw_M1 \ + time_lw_M2 \ + time_lw_N \ + time_lw_O \ + time_lw_P \ + time_lw_Pprime \ + time_lw_Q \ + time_lw_Qprime \ + time_antipode \ + time_fateman_expand + +TESTS = $(CHECKS) $(EXAMS) $(TIMES) +check_PROGRAMS = $(CHECKS) $(EXAMS) $(TIMES) + +check_numeric_SOURCES = check_numeric.cpp +check_numeric_LDADD = ../ginac/libginac.la + +check_inifcns_SOURCES = check_inifcns.cpp +check_inifcns_LDADD = ../ginac/libginac.la + +check_matrices_SOURCES = check_matrices.cpp genex.cpp +check_matrices_LDADD = ../ginac/libginac.la + +check_lsolve_SOURCES = check_lsolve.cpp genex.cpp +check_lsolve_LDADD = ../ginac/libginac.la + +exam_paranoia_SOURCES = exam_paranoia.cpp +exam_paranoia_LDADD = ../ginac/libginac.la + +exam_numeric_SOURCES = exam_numeric.cpp +exam_numeric_LDADD = ../ginac/libginac.la + +exam_powerlaws_SOURCES = exam_powerlaws.cpp +exam_powerlaws_LDADD = ../ginac/libginac.la + +exam_inifcns_SOURCES = exam_inifcns.cpp +exam_inifcns_LDADD = ../ginac/libginac.la + +exam_inifcns_nstdsums_SOURCES = exam_inifcns_nstdsums.cpp \ + exam_inifcns_nstdsums.h +exam_inifcns_nstdsums_LDADD = ../ginac/libginac.la + +exam_differentiation_SOURCES = exam_differentiation.cpp +exam_differentiation_LDADD = ../ginac/libginac.la + +exam_polygcd_SOURCES = exam_polygcd.cpp +exam_polygcd_LDADD = ../ginac/libginac.la + +exam_normalization_SOURCES = exam_normalization.cpp +exam_normalization_LDADD = ../ginac/libginac.la + +exam_pseries_SOURCES = exam_pseries.cpp +exam_pseries_LDADD = ../ginac/libginac.la + +exam_matrices_SOURCES = exam_matrices.cpp +exam_matrices_LDADD = ../ginac/libginac.la + +exam_lsolve_SOURCES = exam_lsolve.cpp +exam_lsolve_LDADD = ../ginac/libginac.la + +exam_indexed_SOURCES = exam_indexed.cpp +exam_indexed_LDADD = ../ginac/libginac.la + +exam_color_SOURCES = exam_color.cpp +exam_color_LDADD = ../ginac/libginac.la + +exam_clifford_SOURCES = exam_clifford.cpp +exam_clifford_LDADD = ../ginac/libginac.la + +exam_archive_SOURCES = exam_archive.cpp +exam_archive_LDADD = ../ginac/libginac.la + +exam_structure_SOURCES = exam_structure.cpp +exam_structure_LDADD = ../ginac/libginac.la + +exam_hashmap_SOURCES = exam_hashmap.cpp +exam_hashmap_LDADD = ../ginac/libginac.la + +exam_misc_SOURCES = exam_misc.cpp +exam_misc_LDADD = ../ginac/libginac.la + + +time_dennyfliegner_SOURCES = time_dennyfliegner.cpp \ + randomize_serials.cpp timer.cpp timer.h +time_dennyfliegner_LDADD = ../ginac/libginac.la + +time_gammaseries_SOURCES = time_gammaseries.cpp \ + randomize_serials.cpp timer.cpp timer.h +time_gammaseries_LDADD = ../ginac/libginac.la + +time_vandermonde_SOURCES = time_vandermonde.cpp \ + randomize_serials.cpp timer.cpp timer.h +time_vandermonde_LDADD = ../ginac/libginac.la + +time_toeplitz_SOURCES = time_toeplitz.cpp \ + randomize_serials.cpp timer.cpp timer.h +time_toeplitz_LDADD = ../ginac/libginac.la +time_hashmap_SOURCES = time_hashmap.cpp \ + randomize_serials.cpp timer.cpp timer.h +time_hashmap_LDADD = ../ginac/libginac.la + +time_lw_A_SOURCES = time_lw_A.cpp \ + randomize_serials.cpp timer.cpp timer.h +time_lw_A_LDADD = ../ginac/libginac.la + +time_lw_B_SOURCES = time_lw_B.cpp \ + randomize_serials.cpp timer.cpp timer.h +time_lw_B_LDADD = ../ginac/libginac.la + +time_lw_C_SOURCES = time_lw_C.cpp \ + randomize_serials.cpp timer.cpp timer.h +time_lw_C_LDADD = ../ginac/libginac.la + +time_lw_D_SOURCES = time_lw_D.cpp \ + randomize_serials.cpp timer.cpp timer.h +time_lw_D_LDADD = ../ginac/libginac.la + +time_lw_E_SOURCES = time_lw_E.cpp \ + randomize_serials.cpp timer.cpp timer.h +time_lw_E_LDADD = ../ginac/libginac.la + +time_lw_F_SOURCES = time_lw_F.cpp \ + randomize_serials.cpp timer.cpp timer.h +time_lw_F_LDADD = ../ginac/libginac.la + +time_lw_G_SOURCES = time_lw_G.cpp \ + randomize_serials.cpp timer.cpp timer.h +time_lw_G_LDADD = ../ginac/libginac.la + +time_lw_H_SOURCES = time_lw_H.cpp \ + randomize_serials.cpp timer.cpp timer.h +time_lw_H_LDADD = ../ginac/libginac.la + +time_lw_IJKL_SOURCES = time_lw_IJKL.cpp \ + randomize_serials.cpp timer.cpp timer.h +time_lw_IJKL_LDADD = ../ginac/libginac.la + +time_lw_M1_SOURCES = time_lw_M1.cpp \ + randomize_serials.cpp timer.cpp timer.h +time_lw_M1_LDADD = ../ginac/libginac.la + +time_lw_M2_SOURCES = time_lw_M2.cpp \ + randomize_serials.cpp timer.cpp timer.h +time_lw_M2_LDADD = ../ginac/libginac.la + +time_lw_N_SOURCES = time_lw_N.cpp \ + randomize_serials.cpp timer.cpp timer.h +time_lw_N_LDADD = ../ginac/libginac.la + +time_lw_O_SOURCES = time_lw_O.cpp \ + randomize_serials.cpp timer.cpp timer.h +time_lw_O_LDADD = ../ginac/libginac.la + +time_lw_P_SOURCES = time_lw_P.cpp \ + randomize_serials.cpp timer.cpp timer.h +time_lw_P_LDADD = ../ginac/libginac.la + +time_lw_Pprime_SOURCES = time_lw_Pprime.cpp \ + randomize_serials.cpp timer.cpp timer.h +time_lw_Pprime_LDADD = ../ginac/libginac.la + +time_lw_Q_SOURCES = time_lw_Q.cpp \ + randomize_serials.cpp timer.cpp timer.h +time_lw_Q_LDADD = ../ginac/libginac.la + +time_lw_Qprime_SOURCES = time_lw_Qprime.cpp \ + randomize_serials.cpp timer.cpp timer.h +time_lw_Qprime_LDADD = ../ginac/libginac.la + +time_antipode_SOURCES = time_antipode.cpp \ + randomize_serials.cpp timer.cpp timer.h +time_antipode_LDADD = ../ginac/libginac.la + +time_fateman_expand_SOURCES = time_fateman_expand.cpp \ + randomize_serials.cpp timer.cpp timer.h +time_fateman_expand_LDADD = ../ginac/libginac.la + +AM_CPPFLAGS = -I$(srcdir)/../ginac -I../ginac diff --git a/check/check_inifcns.cpp b/check/check_inifcns.cpp index 2b10178f..293fd8b1 100644 --- a/check/check_inifcns.cpp +++ b/check/check_inifcns.cpp @@ -21,7 +21,11 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "checks.h" +#include +#include // rand() +#include "ginac.h" +using namespace std; +using namespace GiNaC; /* Some tests on the sine trigonometric function. */ static unsigned inifcns_check_sin() @@ -195,19 +199,16 @@ unsigned check_inifcns() unsigned result = 0; cout << "checking consistency of symbolic functions" << flush; - clog << "---------consistency of symbolic functions:" << endl; result += inifcns_check_sin(); cout << '.' << flush; result += inifcns_check_cos(); cout << '.' << flush; result += inifcns_check_tan(); cout << '.' << flush; result += inifcns_check_Li2(); cout << '.' << flush; - if (!result) { - cout << " passed " << endl; - clog << "(no output)" << endl; - } else { - cout << " failed " << endl; - } - return result; } + +int main(int argc, char** argv) +{ + return check_inifcns(); +} diff --git a/check/check_lsolve.cpp b/check/check_lsolve.cpp index 02a1df5c..5f3c78a0 100644 --- a/check/check_lsolve.cpp +++ b/check/check_lsolve.cpp @@ -22,8 +22,15 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "checks.h" +#include #include +#include // rand() +#include "ginac.h" +using namespace std; +using namespace GiNaC; + +extern const ex +dense_univariate_poly(const symbol & x, unsigned degree); static unsigned check_matrix_solve(unsigned m, unsigned n, unsigned p, unsigned degree) @@ -161,7 +168,6 @@ unsigned check_lsolve() unsigned result = 0; cout << "checking linear solve" << flush; - clog << "---------linear solve:" << endl; // solve some numeric linear systems for (unsigned n=1; n<14; ++n) @@ -191,12 +197,10 @@ unsigned check_lsolve() result += check_inifcns_lsolve(5); cout << '.' << flush; result += check_inifcns_lsolve(6); cout << '.' << flush; - if (!result) { - cout << " passed " << endl; - clog << "(no output)" << endl; - } else { - cout << " failed " << endl; - } - return result; } + +int main(int argc, char** argv) +{ + return check_lsolve(); +} diff --git a/check/check_matrices.cpp b/check/check_matrices.cpp index 38c87f48..1b310d4f 100644 --- a/check/check_matrices.cpp +++ b/check/check_matrices.cpp @@ -22,7 +22,18 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "checks.h" +#include +#include // rand(), RAND_MAX +#include "ginac.h" +using namespace std; +using namespace GiNaC; + +extern const ex +sparse_tree(const symbol & x, const symbol & y, const symbol & z, + int level, bool trig = false, bool rational = true, + bool complex = false); +extern const ex +dense_univariate_poly(const symbol & x, unsigned degree); /* determinants of some sparse symbolic matrices with coefficients in * an integral domain. */ @@ -200,7 +211,6 @@ unsigned check_matrices() unsigned result = 0; cout << "checking symbolic matrix manipulations" << flush; - clog << "---------symbolic matrix manipulations:" << endl; result += integdom_matrix_determinants(); cout << '.' << flush; result += rational_matrix_determinants(); cout << '.' << flush; @@ -208,12 +218,10 @@ unsigned check_matrices() result += compare_matrix_determinants(); cout << '.' << flush; result += symbolic_matrix_inverse(); cout << '.' << flush; - if (!result) { - cout << " passed " << endl; - clog << "(no output)" << endl; - } else { - cout << " failed " << endl; - } - return result; } + +int main(int argc, char** argv) +{ + return check_matrices(); +} diff --git a/check/check_numeric.cpp b/check/check_numeric.cpp index ec1eaf28..ce79a274 100644 --- a/check/check_numeric.cpp +++ b/check/check_numeric.cpp @@ -21,7 +21,11 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "checks.h" +#include +#include // rand() +#include "ginac.h" +using namespace std; +using namespace GiNaC; /* Simple and maybe somewhat pointless consistency tests of assorted tests and * conversions. */ @@ -115,12 +119,10 @@ unsigned check_numeric() result += check_numeric1(); cout << '.' << flush; result += check_numeric2(); cout << '.' << flush; - if (!result) { - cout << " passed " << endl; - clog << "(no output)" << endl; - } else { - cout << " failed " << endl; - } - return result; } + +int main(int argc, char** argv) +{ + return check_numeric(); +} diff --git a/check/checks.cpp b/check/checks.cpp deleted file mode 100644 index 3f063ac5..00000000 --- a/check/checks.cpp +++ /dev/null @@ -1,60 +0,0 @@ -/** @file checks.cpp - * - * Main program that calls the individual tests. */ - -/* - * GiNaC Copyright (C) 1999-2007 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 - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include -#include - -#include "checks.h" - -int main() -{ - unsigned result = 0; - - srand((unsigned)time(NULL)); - -#define CHECK(which) \ -try { \ - for (int i=0; i<1; ++i) \ - result += check_ ## which (); \ -} catch (const exception &e) { \ - cout << "Error: caught exception " << e.what() << endl; \ - ++result; \ -} - - CHECK(numeric) - CHECK(inifcns) - CHECK(matrices) - CHECK(lsolve) - - if (result) { - cout << "Error: something went wrong. "; - if (result == 1) { - cout << "(one failure)" << endl; - } else { - cout << "(" << result << " individual failures)" << endl; - } - cout << "please check checks.out against check.ref for more details." - << endl << "happy debugging!" << endl; - } - - return result; -} diff --git a/check/checks.h b/check/checks.h deleted file mode 100644 index 61e043f2..00000000 --- a/check/checks.h +++ /dev/null @@ -1,47 +0,0 @@ -/** @file checks.h - * - * Prototypes for all individual checks. */ - -/* - * GiNaC Copyright (C) 1999-2007 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 - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef CHECKS_H -#define CHECKS_H - -#include - -#include "config.h" -#include "ginac.h" -using namespace std; -using namespace GiNaC; - -// prototypes for the expression generating functions in: -const ex dense_univariate_poly(const symbol & x, unsigned degree); -const ex dense_bivariate_poly(const symbol & x1, const symbol & x2, - unsigned degree); -const ex sparse_tree(const symbol & x, const symbol & y, const symbol & z, - int level, - bool trig = false, bool rational = true, bool complex = false); - -// prototypes for all individual checks should be unsigned fcn(): -unsigned check_numeric(); -unsigned check_inifcns(); -unsigned check_matrices(); -unsigned check_lsolve(); - -#endif // ndef CHECKS_H diff --git a/check/checks.ref b/check/checks.ref deleted file mode 100644 index a109f51b..00000000 --- a/check/checks.ref +++ /dev/null @@ -1,8 +0,0 @@ ----------consistency of numeric types: -(no output) ----------consistency of symbolic functions: -(no output) ----------symbolic matrix manipulations: -(no output) ----------linear solve: -(no output) diff --git a/check/exam_archive.cpp b/check/exam_archive.cpp index a2e19c44..0fcb6167 100644 --- a/check/exam_archive.cpp +++ b/check/exam_archive.cpp @@ -20,16 +20,17 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "exams.h" - +#include #include +#include "ginac.h" +using namespace std; +using namespace GiNaC; unsigned exam_archive() { unsigned result = 0; cout << "examining archiving system" << flush; - clog << "----------archiving system:" << endl; symbol x("x"), y("y"), mu("mu"), dim("dim", "\\Delta"); ex e, f; @@ -70,14 +71,10 @@ unsigned exam_archive() ++result; } - cout << '.' << flush; - - if (!result) { - cout << " passed " << endl; - clog << "(no output)" << endl; - } else { - cout << " failed " << endl; - } - return result; } + +int main(int argc, char** argv) +{ + return exam_archive(); +} diff --git a/check/exam_clifford.cpp b/check/exam_clifford.cpp index 006c0769..4dbfacf9 100644 --- a/check/exam_clifford.cpp +++ b/check/exam_clifford.cpp @@ -20,7 +20,10 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "exams.h" +#include +#include "ginac.h" +using namespace std; +using namespace GiNaC; const numeric half(1, 2); @@ -539,7 +542,6 @@ unsigned exam_clifford() unsigned result = 0; cout << "examining clifford objects" << flush; - clog << "----------clifford objects:" << endl; result += clifford_check1(); cout << '.' << flush; result += clifford_check2(); cout << '.' << flush; @@ -600,12 +602,10 @@ unsigned exam_clifford() result += clifford_check7(indexed(-2*minkmetric(), sy_symm(), xi, chi), dim); cout << '.' << flush; result += clifford_check7(-2*delta_tensor(xi, chi), dim); cout << '.' << flush; - if (!result) { - cout << " passed " << endl; - clog << "(no output)" << endl; - } else { - cout << " failed " << endl; - } - return result; } + +int main(int argc, char** argv) +{ + return exam_clifford(); +} diff --git a/check/exam_color.cpp b/check/exam_color.cpp index f2342a39..382f6d3f 100644 --- a/check/exam_color.cpp +++ b/check/exam_color.cpp @@ -20,7 +20,10 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "exams.h" +#include +#include "ginac.h" +using namespace std; +using namespace GiNaC; static unsigned check_equal(const ex &e1, const ex &e2) { @@ -145,18 +148,15 @@ unsigned exam_color() unsigned result = 0; cout << "examining color objects" << flush; - clog << "----------color objects:" << endl; result += color_check1(); cout << '.' << flush; result += color_check2(); cout << '.' << flush; result += color_check3(); cout << '.' << flush; - if (!result) { - cout << " passed " << endl; - clog << "(no output)" << endl; - } else { - cout << " failed " << endl; - } - return result; } + +int main(int argc, char** argv) +{ + return exam_color(); +} diff --git a/check/exam_differentiation.cpp b/check/exam_differentiation.cpp index 1eb5dfcb..f2d6dbb3 100644 --- a/check/exam_differentiation.cpp +++ b/check/exam_differentiation.cpp @@ -20,7 +20,10 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "exams.h" +#include +#include "ginac.h" +using namespace std; +using namespace GiNaC; static unsigned check_diff(const ex &e, const symbol &x, const ex &d, unsigned nth=1) @@ -260,7 +263,6 @@ unsigned exam_differentiation() unsigned result = 0; cout << "examining symbolic differentiation" << flush; - clog << "----------symbolic differentiation:" << endl; result += exam_differentiation1(); cout << '.' << flush; result += exam_differentiation2(); cout << '.' << flush; @@ -270,11 +272,10 @@ unsigned exam_differentiation() result += exam_differentiation6(); cout << '.' << flush; result += exam_differentiation7(); cout << '.' << flush; - if (!result) { - cout << " passed " << endl; - clog << "(no output)" << endl; - } else { - cout << " failed " << endl; - } return result; } + +int main(int argc, char** argv) +{ + return exam_differentiation(); +} diff --git a/check/exam_hashmap.cpp b/check/exam_hashmap.cpp index ae6a324a..289c2264 100644 --- a/check/exam_hashmap.cpp +++ b/check/exam_hashmap.cpp @@ -20,7 +20,10 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "exams.h" +#include +#include "ginac.h" +using namespace std; +using namespace GiNaC; unsigned exam_hashmap() { @@ -28,7 +31,6 @@ unsigned exam_hashmap() unsigned N = 100; cout << "examining hash maps" << flush; - clog << "----------hash maps:" << endl; // Create empty container exhashmap M1; @@ -279,15 +281,12 @@ unsigned exam_hashmap() clog << "count(4*x^y) returns " << n << " instead of 1" << endl; ++result; } - cout << '.' << flush; - if (!result) { - cout << " passed " << endl; - clog << "(no output)" << endl; - } else { - cout << " failed " << endl; - } - return result; } + +int main(int argc, char** argv) +{ + return exam_hashmap(); +} diff --git a/check/exam_indexed.cpp b/check/exam_indexed.cpp index 06bdbaa4..722f53f9 100644 --- a/check/exam_indexed.cpp +++ b/check/exam_indexed.cpp @@ -20,7 +20,10 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "exams.h" +#include +#include "ginac.h" +using namespace std; +using namespace GiNaC; static unsigned check_equal(const ex &e1, const ex &e2) { @@ -392,7 +395,6 @@ unsigned exam_indexed() unsigned result = 0; cout << "examining indexed objects" << flush; - clog << "----------indexed objects:" << endl; result += delta_check(); cout << '.' << flush; result += metric_check(); cout << '.' << flush; @@ -403,12 +405,10 @@ unsigned exam_indexed() result += spinor_check(); cout << '.' << flush; result += dummy_check(); cout << '.' << flush; - if (!result) { - cout << " passed " << endl; - clog << "(no output)" << endl; - } else { - cout << " failed " << endl; - } - return result; } + +int main(int argc, char** argv) +{ + return exam_indexed(); +} diff --git a/check/exam_inifcns.cpp b/check/exam_inifcns.cpp index e0d595a8..0b3c6145 100644 --- a/check/exam_inifcns.cpp +++ b/check/exam_inifcns.cpp @@ -21,7 +21,10 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "exams.h" +#include +#include "ginac.h" +using namespace std; +using namespace GiNaC; /* Assorted tests on other transcendental functions. */ static unsigned inifcns_consist_trans() @@ -217,19 +220,16 @@ unsigned exam_inifcns() unsigned result = 0; cout << "examining consistency of symbolic functions" << flush; - clog << "----------consistency of symbolic functions:" << endl; result += inifcns_consist_trans(); cout << '.' << flush; result += inifcns_consist_gamma(); cout << '.' << flush; result += inifcns_consist_psi(); cout << '.' << flush; result += inifcns_consist_zeta(); cout << '.' << flush; - if (!result) { - cout << " passed " << endl; - clog << "(no output)" << endl; - } else { - cout << " failed " << endl; - } - return result; } + +int main(int argc, char** argv) +{ + return exam_inifcns(); +} diff --git a/check/exam_inifcns_nstdsums.cpp b/check/exam_inifcns_nstdsums.cpp index 68b11b45..86c1e452 100644 --- a/check/exam_inifcns_nstdsums.cpp +++ b/check/exam_inifcns_nstdsums.cpp @@ -21,9 +21,12 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "exams.h" - +#include #include +#include "ginac.h" +using namespace std; +using namespace GiNaC; + //////////////////////////////////////////////////////////////////////////////// @@ -292,19 +295,16 @@ unsigned exam_inifcns_nstdsums(void) unsigned result = 0; cout << "examining consistency of nestedsums functions" << flush; - clog << "----------consistency of nestedsums functions:" << endl; result += inifcns_test_zeta(); result += inifcns_test_S(); result += inifcns_test_HLi(); result += inifcns_test_LiG(); - if (!result) { - cout << " passed " << endl; - clog << "(no output)" << endl; - } else { - cout << " failed " << endl; - } - return result; } + +int main(int argc, char** argv) +{ + return exam_inifcns_nstdsums(); +} diff --git a/check/exam_lsolve.cpp b/check/exam_lsolve.cpp index 7df0fc40..67aae4e8 100644 --- a/check/exam_lsolve.cpp +++ b/check/exam_lsolve.cpp @@ -20,7 +20,10 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "exams.h" +#include +#include "ginac.h" +using namespace std; +using namespace GiNaC; static unsigned exam_lsolve1() { @@ -188,7 +191,6 @@ unsigned exam_lsolve() unsigned result = 0; cout << "examining linear solve" << flush; - clog << "----------linear solve:" << endl; result += exam_lsolve1(); cout << '.' << flush; result += exam_lsolve2a(); cout << '.' << flush; @@ -197,12 +199,10 @@ unsigned exam_lsolve() result += exam_lsolve2S(); cout << '.' << flush; result += exam_lsolve3S(); cout << '.' << flush; - if (!result) { - cout << " passed " << endl; - clog << "(no output)" << endl; - } else { - cout << " failed " << endl; - } - return result; } + +int main(int argc, char** argv) +{ + return exam_lsolve(); +} diff --git a/check/exam_matrices.cpp b/check/exam_matrices.cpp index 88bc5816..f4c84f97 100644 --- a/check/exam_matrices.cpp +++ b/check/exam_matrices.cpp @@ -21,7 +21,10 @@ */ #include -#include "exams.h" +#include +#include "ginac.h" +using namespace std; +using namespace GiNaC; static unsigned matrix_determinants() { @@ -337,7 +340,6 @@ unsigned exam_matrices() unsigned result = 0; cout << "examining symbolic matrix manipulations" << flush; - clog << "----------symbolic matrix manipulations:" << endl; result += matrix_determinants(); cout << '.' << flush; result += matrix_invert1(); cout << '.' << flush; @@ -348,12 +350,10 @@ unsigned exam_matrices() result += matrix_rank(); cout << "." << flush; result += matrix_misc(); cout << '.' << flush; - if (!result) { - cout << " passed " << endl; - clog << "(no output)" << endl; - } else { - cout << " failed " << endl; - } - return result; } + +int main(int argc, char** argv) +{ + return exam_matrices(); +} diff --git a/check/exam_misc.cpp b/check/exam_misc.cpp index 29febf64..13cb2f9a 100644 --- a/check/exam_misc.cpp +++ b/check/exam_misc.cpp @@ -20,8 +20,10 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ - -#include "exams.h" +#include +#include "ginac.h" +using namespace std; +using namespace GiNaC; #define VECSIZE 30 static unsigned exam_expand_subs() @@ -291,7 +293,6 @@ unsigned exam_misc() unsigned result = 0; cout << "examining miscellaneous other things" << flush; - clog << "----------miscellaneous other things:" << endl; result += exam_expand_subs(); cout << '.' << flush; result += exam_expand_subs2(); cout << '.' << flush; @@ -302,12 +303,10 @@ unsigned exam_misc() result += exam_joris(); cout << '.' << flush; result += exam_subs_algebraic(); cout << '.' << flush; - if (!result) { - cout << " passed " << endl; - clog << "(no output)" << endl; - } else { - cout << " failed " << endl; - } - return result; } + +int main(int argc, char** argv) +{ + return exam_misc(); +} diff --git a/check/exam_normalization.cpp b/check/exam_normalization.cpp index 34176dd7..7eb45311 100644 --- a/check/exam_normalization.cpp +++ b/check/exam_normalization.cpp @@ -20,7 +20,10 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "exams.h" +#include +#include "ginac.h" +using namespace std; +using namespace GiNaC; static symbol w("w"), x("x"), y("y"), z("z"); @@ -219,7 +222,6 @@ unsigned exam_normalization() unsigned result = 0; cout << "examining rational function normalization" << flush; - clog << "----------rational function normalization:" << endl; result += exam_normal1(); cout << '.' << flush; result += exam_normal2(); cout << '.' << flush; @@ -227,12 +229,10 @@ unsigned exam_normalization() result += exam_normal4(); cout << '.' << flush; result += exam_content(); cout << '.' << flush; - if (!result) { - cout << " passed " << endl; - clog << "(no output)" << endl; - } else { - cout << " failed " << endl; - } - return result; } + +int main(int argc, char** argv) +{ + return exam_normalization(); +} diff --git a/check/exam_numeric.cpp b/check/exam_numeric.cpp index 5a916e92..8f45dfed 100644 --- a/check/exam_numeric.cpp +++ b/check/exam_numeric.cpp @@ -21,9 +21,12 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "exams.h" - +#include #include +#include "ginac.h" +using namespace std; +using namespace GiNaC; + /* Simple and maybe somewhat pointless consistency tests of assorted tests and * conversions. */ @@ -378,7 +381,6 @@ unsigned exam_numeric() unsigned result = 0; cout << "examining consistency of numeric types" << flush; - clog << "----------consistency of numeric types:" << endl; result += exam_numeric1(); cout << '.' << flush; result += exam_numeric2(); cout << '.' << flush; @@ -387,12 +389,10 @@ unsigned exam_numeric() result += exam_numeric5(); cout << '.' << flush; result += exam_numeric6(); cout << '.' << flush; - if (!result) { - cout << " passed " << endl; - clog << "(no output)" << endl; - } else { - cout << " failed " << endl; - } - return result; } + +int main(int argc, char** argv) +{ + return exam_numeric(); +} diff --git a/check/exam_paranoia.cpp b/check/exam_paranoia.cpp index 035235a5..003044e9 100644 --- a/check/exam_paranoia.cpp +++ b/check/exam_paranoia.cpp @@ -23,7 +23,10 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "exams.h" +#include +#include "ginac.h" +using namespace std; +using namespace GiNaC; // The very first pair of historic problems had its roots in power.cpp and was // finally resolved on April 27th 1999. (Fixing the first on April 23rd @@ -469,7 +472,6 @@ unsigned exam_paranoia() unsigned result = 0; cout << "examining several historic failures just out of paranoia" << flush; - clog << "----------several historic failures:" << endl; result += exam_paranoia1(); cout << '.' << flush; result += exam_paranoia2(); cout << '.' << flush; @@ -489,12 +491,10 @@ unsigned exam_paranoia() result += exam_paranoia16(); cout << '.' << flush; result += exam_paranoia17(); cout << '.' << flush; - if (!result) { - cout << " passed " << endl; - clog << "(no output)" << endl; - } else { - cout << " failed " << endl; - } - return result; } + +int main(int argc, char** argv) +{ + return exam_paranoia(); +} diff --git a/check/exam_polygcd.cpp b/check/exam_polygcd.cpp index bb410f29..ef90a36d 100644 --- a/check/exam_polygcd.cpp +++ b/check/exam_polygcd.cpp @@ -21,7 +21,10 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "exams.h" +#include +#include "ginac.h" +using namespace std; +using namespace GiNaC; const int MAX_VARIABLES = 3; @@ -231,7 +234,6 @@ unsigned exam_polygcd() unsigned result = 0; cout << "examining polynomial GCD computation" << flush; - clog << "----------polynomial GCD computation:" << endl; result += poly_gcd1(); cout << '.' << flush; result += poly_gcd2(); cout << '.' << flush; @@ -243,12 +245,10 @@ unsigned exam_polygcd() result += poly_gcd6(); cout << '.' << flush; result += poly_gcd7(); cout << '.' << flush; - if (!result) { - cout << " passed " << endl; - clog << "(no output)" << endl; - } else { - cout << " failed " << endl; - } - return result; } + +int main(int argc, char** argv) +{ + return exam_polygcd(); +} diff --git a/check/exam_powerlaws.cpp b/check/exam_powerlaws.cpp index 5af3c866..d84a0818 100644 --- a/check/exam_powerlaws.cpp +++ b/check/exam_powerlaws.cpp @@ -21,7 +21,10 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "exams.h" +#include +#include "ginac.h" +using namespace std; +using namespace GiNaC; static unsigned exam_powerlaws1() { @@ -289,7 +292,6 @@ unsigned exam_powerlaws() unsigned result = 0; cout << "examining power laws" << flush; - clog << "----------power laws:" << endl; result += exam_powerlaws1(); cout << '.' << flush; result += exam_powerlaws2(); cout << '.' << flush; @@ -297,12 +299,10 @@ unsigned exam_powerlaws() result += exam_powerlaws4(); cout << '.' << flush; result += exam_powerlaws5(); cout << '.' << flush; - if (!result) { - cout << " passed " << endl; - clog << "(no output)" << endl; - } else { - cout << " failed " << endl; - } - return result; } + +int main(int argc, char** argv) +{ + return exam_powerlaws(); +} diff --git a/check/exam_pseries.cpp b/check/exam_pseries.cpp index 2e5d2d6e..e24ef414 100644 --- a/check/exam_pseries.cpp +++ b/check/exam_pseries.cpp @@ -20,7 +20,10 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "exams.h" +#include +#include "ginac.h" +using namespace std; +using namespace GiNaC; static symbol x("x"); @@ -367,7 +370,6 @@ unsigned exam_pseries() unsigned result = 0; cout << "examining series expansion" << flush; - clog << "----------series expansion:" << endl; result += exam_series1(); cout << '.' << flush; result += exam_series2(); cout << '.' << flush; @@ -383,11 +385,10 @@ unsigned exam_pseries() result += exam_series12(); cout << '.' << flush; result += exam_series13(); cout << '.' << flush; - if (!result) { - cout << " passed " << endl; - clog << "(no output)" << endl; - } else { - cout << " failed " << endl; - } return result; } + +int main(int argc, char** argv) +{ + return exam_pseries(); +} diff --git a/check/exam_structure.cpp b/check/exam_structure.cpp index 84de56ba..b433600d 100644 --- a/check/exam_structure.cpp +++ b/check/exam_structure.cpp @@ -20,7 +20,10 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "exams.h" +#include +#include "ginac.h" +using namespace std; +using namespace GiNaC; struct sprod_s { @@ -72,7 +75,6 @@ unsigned exam_structure() unsigned result = 0; cout << "examining structure template" << flush; - clog << "----------structure template:" << endl; symbol x("x"), y("y"); ex e; @@ -91,14 +93,10 @@ unsigned exam_structure() ++result; } - cout << '.' << flush; - - if (!result) { - cout << " passed " << endl; - clog << "(no output)" << endl; - } else { - cout << " failed " << endl; - } - return result; } + +int main(int argc, char** argv) +{ + return exam_structure(); +} diff --git a/check/exams.cpp b/check/exams.cpp deleted file mode 100644 index 4f669e5a..00000000 --- a/check/exams.cpp +++ /dev/null @@ -1,70 +0,0 @@ -/** @file exams.cpp - * - * Main program that calls all individual exams. */ - -/* - * GiNaC Copyright (C) 1999-2007 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 - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include - -#include "exams.h" - -int main() -{ - unsigned result = 0; - -#define EXAM(which) \ -try { \ - result += exam_ ## which (); \ -} catch (const exception &e) { \ - cout << "Error: caught exception " << e.what() << endl; \ - ++result; \ -} - - EXAM(paranoia) - EXAM(numeric) - EXAM(powerlaws) - EXAM(inifcns) - EXAM(inifcns_nstdsums) - EXAM(differentiation) - EXAM(polygcd) - EXAM(normalization) - EXAM(pseries) - EXAM(matrices) - EXAM(lsolve) - EXAM(indexed) - EXAM(color) - EXAM(clifford) - EXAM(archive) - EXAM(structure) - EXAM(hashmap) - EXAM(misc) - - if (result) { - cout << "Error: something went wrong. "; - if (result == 1) { - cout << "(one failure)" << endl; - } else { - cout << "(" << result << " individual failures)" << endl; - } - cout << "please check exams.out against exams.ref for more details." - << endl << "happy debugging!" << endl; - } - - return result; -} diff --git a/check/exams.h b/check/exams.h deleted file mode 100644 index 8cac4fee..00000000 --- a/check/exams.h +++ /dev/null @@ -1,51 +0,0 @@ -/** @file exams.h - * - * Prototypes for all individual exams. */ - -/* - * GiNaC Copyright (C) 1999-2007 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 - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef EXAMS_H -#define EXAMS_H - -#include -#include "ginac.h" -using namespace std; -using namespace GiNaC; - -// prototypes for all individual checks should be unsigned fcn(): -unsigned exam_paranoia(); -unsigned exam_numeric(); -unsigned exam_powerlaws(); -unsigned exam_inifcns(); -unsigned exam_inifcns_nstdsums(); -unsigned exam_differentiation(); -unsigned exam_polygcd(); -unsigned exam_normalization(); -unsigned exam_pseries(); -unsigned exam_matrices(); -unsigned exam_lsolve(); -unsigned exam_indexed(); -unsigned exam_color(); -unsigned exam_clifford(); -unsigned exam_archive(); -unsigned exam_structure(); -unsigned exam_hashmap(); -unsigned exam_misc(); - -#endif // ndef EXAMS_H diff --git a/check/exams.ref b/check/exams.ref deleted file mode 100644 index 016a9c2c..00000000 --- a/check/exams.ref +++ /dev/null @@ -1,36 +0,0 @@ -----------several historic failures: -(no output) -----------consistency of numeric types: -(no output) -----------power laws: -(no output) -----------consistency of symbolic functions: -(no output) -----------consistency of nestedsums functions: -(no output) -----------symbolic differentiation: -(no output) -----------polynomial GCD computation: -(no output) -----------rational function normalization: -(no output) -----------series expansion: -(no output) -----------symbolic matrix manipulations: -(no output) -----------linear solve: -(no output) -----------indexed objects: -(no output) -----------color objects: -(no output) -----------clifford objects: -(no output) -----------archiving system: -(no output) -----------structure template: -(no output) -----------hash maps: -(no output) -----------miscellaneous other things: -(no output) diff --git a/check/randomize_serials.cpp b/check/randomize_serials.cpp new file mode 100644 index 00000000..ad29a1ba --- /dev/null +++ b/check/randomize_serials.cpp @@ -0,0 +1,31 @@ +#include +#include +#include "ginac.h" +using namespace std; +using namespace GiNaC; + +/** Generate a random amount of symbols and destroy them again immediatly. + * This operation effectively makes the serial numbers of all subsequent + * symbols unpredictable. If the serials are unpredictable, then so are + * their hash values. If the hash values are unpredictable, then so are + * the canonical orderings. If the canonical orderings are unpredictable, + * all subsequent times are subject to some variation. This variation, + * however is natural and desireable for two reasons: First, we cannot know + * how many symbols have been generated before in real world computations. + * Second, the following timings are subject to some semi-random variation + * anyways because short timings need to be repeated until enough time has + * gone by for the measurement to be reliable. During this process the serial + * numbers will be shifted anyways in a semi-random way. It is better not + * to lull the user in a false sense of reproducibility and instead confront + * her with the normal variation to be expected. + */ +void randomify_symbol_serials() +{ + srand(time(NULL)); + const int m = rand() % 666; + for (int s=0; schecks.out -cmp ${srcdir}/checks.ref checks.out diff --git a/check/run_exams b/check/run_exams deleted file mode 100755 index 1e7ba463..00000000 --- a/check/run_exams +++ /dev/null @@ -1,4 +0,0 @@ -#! /bin/sh -echo "GiNaC will now take an exam with specific input (like a pupils' exam):" -./exams${EXEEXT} 2>exams.out -cmp ${srcdir}/exams.ref exams.out diff --git a/check/run_times b/check/run_times deleted file mode 100755 index eb2380bd..00000000 --- a/check/run_times +++ /dev/null @@ -1,4 +0,0 @@ -#! /bin/sh -echo "GiNaC will now run through some basic timings:" -./times${EXEEXT} 2>times.out -cmp ${srcdir}/times.ref times.out diff --git a/check/time_antipode.cpp b/check/time_antipode.cpp index 67f410c7..787dea25 100644 --- a/check/time_antipode.cpp +++ b/check/time_antipode.cpp @@ -33,13 +33,16 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "times.h" #include #include #include #include #include #include +#include "timer.h" +#include "ginac.h" +using namespace std; +using namespace GiNaC; // whether to run this beast or not: static const bool do_test = true; @@ -479,7 +482,6 @@ unsigned time_antipode() timer jaeger_le_coultre; cout << "timing computation of antipodes in Yukawa theory" << flush; - clog << "-------computation of antipodes in Yukawa theory:" << endl; if (do_test) { jaeger_le_coultre.start(); @@ -490,17 +492,18 @@ unsigned time_antipode() result += test_tree(tree5); cout << '.' << flush; result += test_tree(tree6); cout << '.' << flush; - if (!result) { - cout << " passed "; - clog << "(no output)" << endl; - } else { - cout << " failed "; - } cout << jaeger_le_coultre.read() << "s (total)" << endl; } else { cout << " disabled" << endl; - clog << "(no output)" << endl; } - return result; } + +extern void randomify_symbol_serials(); + +int main(int argc, char** argv) +{ + randomify_symbol_serials(); + cout << setprecision(2) << showpoint; + return time_antipode(); +} diff --git a/check/time_dennyfliegner.cpp b/check/time_dennyfliegner.cpp index 3f6d6def..aca6e0e4 100644 --- a/check/time_dennyfliegner.cpp +++ b/check/time_dennyfliegner.cpp @@ -24,7 +24,13 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "times.h" +#include +#include +#include +#include "ginac.h" +#include "timer.h" +using namespace std; +using namespace GiNaC; static unsigned expand_subs(unsigned size) { @@ -58,7 +64,6 @@ unsigned time_dennyfliegner() unsigned result = 0; cout << "timing commutative expansion and substitution" << flush; - clog << "-------commutative expansion and substitution:" << endl; vector sizes; vector times; @@ -76,12 +81,6 @@ unsigned time_dennyfliegner() 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) @@ -93,3 +92,12 @@ unsigned time_dennyfliegner() return result; } + +extern void randomify_symbol_serials(); + +int main(int argc, char** argv) +{ + randomify_symbol_serials(); + cout << setprecision(2) << showpoint; + return time_dennyfliegner(); +} diff --git a/check/time_fateman_expand.cpp b/check/time_fateman_expand.cpp index 904d6535..08590d29 100644 --- a/check/time_fateman_expand.cpp +++ b/check/time_fateman_expand.cpp @@ -23,7 +23,11 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "times.h" +#include +#include "ginac.h" +#include "timer.h" +using namespace std; +using namespace GiNaC; static unsigned test() { @@ -50,7 +54,6 @@ unsigned time_fateman_expand() double time = .0; cout << "timing Fateman's polynomial expand benchmark" << flush; - clog << "-------Fateman's polynomial expand benchmark:" << endl; concord.start(); // correct for very small times: @@ -60,13 +63,16 @@ unsigned time_fateman_expand() } while ((time=concord.read())<0.1 && !result); cout << '.' << flush; - if (!result) { - cout << " passed "; - clog << "(no output)" << endl; - } else { - cout << " failed "; - } cout << time/count << 's' << endl; return result; } + +extern void randomify_symbol_serials(); + +int main(int argc, char** argv) +{ + randomify_symbol_serials(); + cout << setprecision(2) << showpoint; + return time_fateman_expand(); +} diff --git a/check/time_gammaseries.cpp b/check/time_gammaseries.cpp index 3ff55d68..f3227878 100644 --- a/check/time_gammaseries.cpp +++ b/check/time_gammaseries.cpp @@ -20,7 +20,12 @@ * 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; unsigned tgammaseries(unsigned order) { @@ -48,7 +53,6 @@ unsigned time_gammaseries() unsigned result = 0; cout << "timing Laurent series expansion of Gamma function" << flush; - clog << "-------Laurent series expansion of Gamma function:" << endl; vector sizes; vector times; @@ -66,12 +70,6 @@ unsigned time_gammaseries() cout << '.' << flush; } - if (!result) { - cout << " passed "; - clog << "(no output)" << endl; - } else { - cout << " failed "; - } // print the report: cout << endl << " order: "; for (vector::iterator i=sizes.begin(); i!=sizes.end(); ++i) @@ -83,3 +81,12 @@ unsigned time_gammaseries() return result; } + +extern void randomify_symbol_serials(); + +int main(int argc, char** argv) +{ + randomify_symbol_serials(); + cout << setprecision(2) << showpoint; + return time_gammaseries(); +} diff --git a/check/time_hashmap.cpp b/check/time_hashmap.cpp index 2bd2f126..cea635b8 100644 --- a/check/time_hashmap.cpp +++ b/check/time_hashmap.cpp @@ -20,7 +20,12 @@ * 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; template static void run_timing(unsigned size, double &time_insert, double &time_find, double &time_erase) @@ -67,7 +72,6 @@ unsigned time_hashmap() unsigned result = 0; cout << "timing hash map operations" << flush; - clog << "-------hash map operations:" << endl; unsigned s[] = {10000, 50000, 100000, 500000}; vector sizes(s, s+sizeof(s)/sizeof(*s)); @@ -88,13 +92,6 @@ unsigned time_hashmap() cout << '.' << flush; } - if (!result) { - cout << " passed "; - clog << "(no output)" << endl; - } else { - cout << " failed "; - } - // print the report: cout << endl << " size:\t"; copy(sizes.begin(), sizes.end(), ostream_iterator(cout, "\t")); @@ -108,3 +105,12 @@ unsigned time_hashmap() return result; } + +extern void randomify_symbol_serials(); + +int main(int argc, char** argv) +{ + randomify_symbol_serials(); + cout << setprecision(2) << showpoint; + return time_hashmap(); +} diff --git a/check/time_lw_A.cpp b/check/time_lw_A.cpp index 94450ebc..d7fdc47f 100644 --- a/check/time_lw_A.cpp +++ b/check/time_lw_A.cpp @@ -21,7 +21,12 @@ * 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 test() { @@ -44,7 +49,6 @@ unsigned time_lw_A() double time = .0; cout << "timing Lewis-Wester test A (divide factorials)" << flush; - clog << "-------Lewis-Wester test A (divide factorials):" << endl; rolex.start(); // correct for very small times: @@ -53,14 +57,16 @@ unsigned time_lw_A() ++count; } while ((time=rolex.read())<0.1 && !result); cout << '.' << flush; - - if (!result) { - cout << " passed "; - clog << "(no output)" << endl; - } else { - cout << " failed "; - } cout << time/count << 's' << endl; return result; } + +extern void randomify_symbol_serials(); + +int main(int argc, char** argv) +{ + randomify_symbol_serials(); + cout << setprecision(2) << showpoint; + return time_lw_A(); +} diff --git a/check/time_lw_B.cpp b/check/time_lw_B.cpp index abf446eb..396bdf80 100644 --- a/check/time_lw_B.cpp +++ b/check/time_lw_B.cpp @@ -21,7 +21,12 @@ * 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 test() { @@ -45,7 +50,6 @@ unsigned time_lw_B() double time = .0; cout << "timing Lewis-Wester test B (sum of rational numbers)" << flush; - clog << "-------Lewis-Wester test B (sum of rational numbers):" << endl; rolex.start(); // correct for very small times: @@ -54,14 +58,15 @@ unsigned time_lw_B() ++count; } while ((time=rolex.read())<0.1 && !result); cout << '.' << flush; - - if (!result) { - cout << " passed "; - clog << "(no output)" << endl; - } else { - cout << " failed "; - } cout << time/count << 's' << endl; return result; } +extern void randomify_symbol_serials(); + +int main(int argc, char** argv) +{ + randomify_symbol_serials(); + cout << setprecision(2) << showpoint; + return time_lw_B(); +} diff --git a/check/time_lw_C.cpp b/check/time_lw_C.cpp index 07f0ebaa..e5e79f46 100644 --- a/check/time_lw_C.cpp +++ b/check/time_lw_C.cpp @@ -21,7 +21,12 @@ * 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 test() { @@ -49,7 +54,6 @@ unsigned time_lw_C() double time = .0; cout << "timing Lewis-Wester test C (gcd of big integers)" << flush; - clog << "-------Lewis-Wester test C (gcd of big integers):" << endl; rolex.start(); // correct for very small times: @@ -58,14 +62,16 @@ unsigned time_lw_C() ++count; } while ((time=rolex.read())<0.1 && !result); cout << '.' << flush; - - if (!result) { - cout << " passed "; - clog << "(no output)" << endl; - } else { - cout << " failed "; - } cout << time/count << 's' << endl; return result; } + +extern void randomify_symbol_serials(); + +int main(int argc, char** argv) +{ + randomify_symbol_serials(); + cout << setprecision(2) << showpoint; + return time_lw_C(); +} diff --git a/check/time_lw_D.cpp b/check/time_lw_D.cpp index e3fa86d2..8599151a 100644 --- a/check/time_lw_D.cpp +++ b/check/time_lw_D.cpp @@ -21,7 +21,12 @@ * 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 test() { @@ -49,7 +54,6 @@ unsigned time_lw_D() double time = .0; cout << "timing Lewis-Wester test D (normalized sum of rational fcns)" << flush; - clog << "-------Lewis-Wester test D (normalized sum of rational fcns):" << endl; rolex.start(); // correct for very small times: @@ -58,14 +62,16 @@ unsigned time_lw_D() ++count; } while ((time=rolex.read())<0.1 && !result); cout << '.' << flush; - - if (!result) { - cout << " passed "; - clog << "(no output)" << endl; - } else { - cout << " failed "; - } cout << time/count << 's' << endl; return result; } + +extern void randomify_symbol_serials(); + +int main(int argc, char** argv) +{ + randomify_symbol_serials(); + cout << setprecision(2) << showpoint; + return time_lw_D(); +} diff --git a/check/time_lw_E.cpp b/check/time_lw_E.cpp index c50cc297..c0b52128 100644 --- a/check/time_lw_E.cpp +++ b/check/time_lw_E.cpp @@ -21,7 +21,12 @@ * 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 test() { @@ -49,7 +54,6 @@ unsigned time_lw_E() double time = .0; cout << "timing Lewis-Wester test E (normalized sum of rational fcns)" << flush; - clog << "-------Lewis-Wester test E (normalized sum of rational fcns):" << endl; rolex.start(); // correct for very small times: @@ -58,14 +62,16 @@ unsigned time_lw_E() ++count; } while ((time=rolex.read())<0.1 && !result); cout << '.' << flush; - - if (!result) { - cout << " passed "; - clog << "(no output)" << endl; - } else { - cout << " failed "; - } cout << time/count << 's' << endl; return result; } + +extern void randomify_symbol_serials(); + +int main(int argc, char** argv) +{ + randomify_symbol_serials(); + cout << setprecision(2) << showpoint; + return time_lw_E(); +} diff --git a/check/time_lw_F.cpp b/check/time_lw_F.cpp index 31366f69..33fbc3ca 100644 --- a/check/time_lw_F.cpp +++ b/check/time_lw_F.cpp @@ -21,7 +21,12 @@ * 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 test() { @@ -46,7 +51,6 @@ unsigned time_lw_F() double time = .0; cout << "timing Lewis-Wester test F (gcd of 2-var polys)" << flush; - clog << "-------Lewis-Wester test F (gcd of 2-var polys):" << endl; rolex.start(); // correct for very small times: @@ -55,14 +59,16 @@ unsigned time_lw_F() ++count; } while ((time=rolex.read())<0.1 && !result); cout << '.' << flush; - - if (!result) { - cout << " passed "; - clog << "(no output)" << endl; - } else { - cout << " failed "; - } cout << time/count << 's' << endl; return result; } + +extern void randomify_symbol_serials(); + +int main(int argc, char** argv) +{ + randomify_symbol_serials(); + cout << setprecision(2) << showpoint; + return time_lw_F(); +} diff --git a/check/time_lw_G.cpp b/check/time_lw_G.cpp index a752d521..1295a2d1 100644 --- a/check/time_lw_G.cpp +++ b/check/time_lw_G.cpp @@ -21,7 +21,12 @@ * 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 test() { @@ -49,7 +54,6 @@ unsigned time_lw_G() double time = .0; cout << "timing Lewis-Wester test G (gcd of 3-var polys)" << flush; - clog << "-------Lewis-Wester test G (gcd of 3-var polys):" << endl; rolex.start(); // correct for very small times: @@ -58,14 +62,16 @@ unsigned time_lw_G() ++count; } while ((time=rolex.read())<0.1 && !result); cout << '.' << flush; - - if (!result) { - cout << " passed "; - clog << "(no output)" << endl; - } else { - cout << " failed "; - } cout << time/count << 's' << endl; return result; } + +extern void randomify_symbol_serials(); + +int main(int argc, char** argv) +{ + randomify_symbol_serials(); + cout << setprecision(2) << showpoint; + return time_lw_G(); +} diff --git a/check/time_lw_H.cpp b/check/time_lw_H.cpp index d17b7298..afbb48be 100644 --- a/check/time_lw_H.cpp +++ b/check/time_lw_H.cpp @@ -21,7 +21,12 @@ * 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 test(unsigned n) { @@ -61,7 +66,6 @@ unsigned time_lw_H() double time = .0; cout << "timing Lewis-Wester test H (det of 80x80 Hilbert)" << flush; - clog << "-------Lewis-Wester test H (det of 80x80 Hilbert):" << endl; rolex.start(); // correct for very small times: @@ -70,14 +74,16 @@ unsigned time_lw_H() ++count; } while ((time=rolex.read())<0.1 && !result); cout << '.' << flush; - - if (!result) { - cout << " passed "; - clog << "(no output)" << endl; - } else { - cout << " failed "; - } cout << time/count << 's' << endl; return result; } + +extern void randomify_symbol_serials(); + +int main(int argc, char** argv) +{ + randomify_symbol_serials(); + cout << setprecision(2) << showpoint; + return time_lw_H(); +} diff --git a/check/time_lw_IJKL.cpp b/check/time_lw_IJKL.cpp index 7271fe0d..2ad74d8c 100644 --- a/check/time_lw_IJKL.cpp +++ b/check/time_lw_IJKL.cpp @@ -21,7 +21,12 @@ * 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 test(unsigned n) { @@ -31,8 +36,6 @@ static unsigned test(unsigned n) cout << "timing Lewis-Wester test " << name << " (invert rank " << n << " Hilbert)" << flush; - clog << "-------Lewis-Wester test " << name - << " (invert rank " << n << " Hilbert):" << endl; // Create a rank n Hilbert matrix: matrix H(n,n); @@ -44,7 +47,6 @@ static unsigned test(unsigned n) matrix Hinv(n,n); Hinv = H.inverse(); cout << ". passed "; - clog << "(no output)" << endl; cout << cartier.read() << 's' << endl; // check result: @@ -52,8 +54,6 @@ static unsigned test(unsigned n) cout << "timing Lewis-Wester test " << name << " (check rank " << n << " Hilbert)" << flush; - clog << "-------Lewis-Wester test " << name - << " (check rank " << n << " Hilbert):" << endl; cartier.reset(); matrix identity = H.mul(Hinv); @@ -68,13 +68,8 @@ static unsigned test(unsigned n) correct = false; } } - if (correct) { - cout << ". passed "; - clog << "(no output)" << endl; - } else { - cout << ". failed "; + if (!correct) ++result; - } cout << cartier.read() << 's' << endl; return result; } @@ -90,3 +85,12 @@ unsigned time_lw_IJKL() return result; } + +extern void randomify_symbol_serials(); + +int main(int argc, char** argv) +{ + randomify_symbol_serials(); + cout << setprecision(2) << showpoint; + return time_lw_IJKL(); +} diff --git a/check/time_lw_M1.cpp b/check/time_lw_M1.cpp index d32603c2..f68ddc74 100644 --- a/check/time_lw_M1.cpp +++ b/check/time_lw_M1.cpp @@ -21,7 +21,11 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "times.h" +#include +#include "ginac.h" +#include "timer.h" +using namespace std; +using namespace GiNaC; static unsigned test() { @@ -81,7 +85,6 @@ unsigned time_lw_M1() double time = .0; cout << "timing Lewis-Wester test M1 (26x26 sparse, det)" << flush; - clog << "-------Lewis-Wester test M1 (26x26 sparse, det):" << endl; rolex.start(); // correct for very small times: @@ -90,14 +93,16 @@ unsigned time_lw_M1() ++count; } while ((time=rolex.read())<0.1 && !result); cout << '.' << flush; - - if (!result) { - cout << " passed "; - clog << "(no output)" << endl; - } else { - cout << " failed "; - } cout << time/count << 's' << endl; return result; } + +extern void randomify_symbol_serials(); + +int main(int argc, char** argv) +{ + randomify_symbol_serials(); + cout << setprecision(2) << showpoint; + return time_lw_M1(); +} diff --git a/check/time_lw_M2.cpp b/check/time_lw_M2.cpp index f9ab7754..e133378a 100644 --- a/check/time_lw_M2.cpp +++ b/check/time_lw_M2.cpp @@ -21,7 +21,11 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "times.h" +#include +#include "ginac.h" +#include "timer.h" +using namespace std; +using namespace GiNaC; static const bool do_test = false; // set to true in order to run this beast @@ -157,7 +161,6 @@ unsigned time_lw_M2() double time = .0; cout << "timing Lewis-Wester test M2 (101x101 sparse, det)" << flush; - clog << "-------Lewis-Wester test M2 (101x101 sparse, det):" << endl; if (do_test) { piaget.start(); @@ -167,18 +170,19 @@ unsigned time_lw_M2() ++count; } while ((time=piaget.read())<0.1 && !result); cout << '.' << flush; - - if (!result) { - cout << " passed "; - clog << "(no output)" << endl; - } else { - cout << " failed "; - } cout << time/count << 's' << endl; } else { cout << " disabled" << endl; - clog << "(no output)" << endl; } return result; } + +extern void randomify_symbol_serials(); + +int main(int argc, char** argv) +{ + randomify_symbol_serials(); + cout << setprecision(2) << showpoint; + return time_lw_M2(); +} diff --git a/check/time_lw_N.cpp b/check/time_lw_N.cpp index 27bb9f7b..d6e96b19 100644 --- a/check/time_lw_N.cpp +++ b/check/time_lw_N.cpp @@ -22,7 +22,12 @@ * 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 const bool do_test = false; // set to true in order to run this beast @@ -60,7 +65,6 @@ unsigned time_lw_N() double time = .0; cout << "timing Lewis-Wester test N (poly at rational fcns)" << flush; - clog << "-------Lewis-Wester test N (poly at rational fcns):" << endl; if (do_test) { tag_heuer.start(); @@ -70,18 +74,19 @@ unsigned time_lw_N() ++count; } while ((time=tag_heuer.read())<0.1 && !result); cout << '.' << flush; - - if (!result) { - cout << " passed "; - clog << "(no output)" << endl; - } else { - cout << " failed "; - } cout << time/count << 's' << endl; } else { cout << " disabled" << endl; - clog << "(no output)" << endl; } return result; } + +extern void randomify_symbol_serials(); + +int main(int argc, char** argv) +{ + randomify_symbol_serials(); + cout << setprecision(2) << showpoint; + return time_lw_N(); +} diff --git a/check/time_lw_O.cpp b/check/time_lw_O.cpp index 4bf31e91..f2a6094f 100644 --- a/check/time_lw_O.cpp +++ b/check/time_lw_O.cpp @@ -21,7 +21,12 @@ * 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 const bool do_test2 = false; // set to true in order to run this beast @@ -133,7 +138,6 @@ unsigned time_lw_O() double time = .0; cout << "timing Lewis-Wester test O1 (three 15x15 dets)" << flush; - clog << "-------Lewis-Wester test O1 (three 15x15 dets):" << endl; rolex.start(); // correct for very small times: @@ -142,32 +146,30 @@ unsigned time_lw_O() ++count; } while ((time=rolex.read())<0.1 && !result); - if (!result) { - cout << " passed "; - clog << "(no output)" << endl; - } else { - cout << " failed "; - } + if (result) + return result; + cout << time/(3*count) << "s (average)" << endl; cout << "timing Lewis-Wester test O2 (Resultant)" << flush; - clog << "-------Lewis-Wester test O2 (Resultant):" << endl; if (do_test2) { rolex.reset(); result += test_O2(); - if (!result) { - cout << " passed "; - clog << "(no output)" << endl; - } else { - cout << " failed "; - } cout << rolex.read() << "s (combined)" << endl; } else { cout << " disabled" << endl; - clog << "(no output)" << endl; } return result; } + +extern void randomify_symbol_serials(); + +int main(int argc, char** argv) +{ + randomify_symbol_serials(); + cout << setprecision(2) << showpoint; + return time_lw_O(); +} diff --git a/check/time_lw_P.cpp b/check/time_lw_P.cpp index c95bbe2a..d04e11aa 100644 --- a/check/time_lw_P.cpp +++ b/check/time_lw_P.cpp @@ -21,7 +21,12 @@ * 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 test() { @@ -59,7 +64,6 @@ unsigned time_lw_P() double time = .0; cout << "timing Lewis-Wester test P (det of sparse rank 101)" << flush; - clog << "-------Lewis-Wester test P (det of sparse rank 101):" << endl; rolex.start(); // correct for very small times: @@ -67,15 +71,16 @@ unsigned time_lw_P() result = test(); ++count; } while ((time=rolex.read())<0.1 && !result); - cout << '.' << flush; - - if (!result) { - cout << " passed "; - clog << "(no output)" << endl; - } else { - cout << " failed "; - } cout << time/count << 's' << endl; return result; } + +extern void randomify_symbol_serials(); + +int main(int argc, char** argv) +{ + randomify_symbol_serials(); + cout << setprecision(2) << showpoint; + return time_lw_P(); +} diff --git a/check/time_lw_Pprime.cpp b/check/time_lw_Pprime.cpp index 5174efc0..4c7e587b 100644 --- a/check/time_lw_Pprime.cpp +++ b/check/time_lw_Pprime.cpp @@ -21,7 +21,12 @@ * 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 test() { @@ -72,7 +77,6 @@ unsigned time_lw_Pprime() double time = .0; cout << "timing Lewis-Wester test P' (det of less sparse rank 101)" << flush; - clog << "-------Lewis-Wester test P' (det of less sparse rank 101):" << endl; rolex.start(); // correct for very small times: @@ -81,14 +85,16 @@ unsigned time_lw_Pprime() ++count; } while ((time=rolex.read())<0.1 && !result); cout << '.' << flush; - - if (!result) { - cout << " passed "; - clog << "(no output)" << endl; - } else { - cout << " failed "; - } cout << time/count << 's' << endl; return result; } + +extern void randomify_symbol_serials(); + +int main(int argc, char** argv) +{ + randomify_symbol_serials(); + cout << setprecision(2) << showpoint; + return time_lw_Pprime(); +} diff --git a/check/time_lw_Q.cpp b/check/time_lw_Q.cpp index e506a355..1236dec7 100644 --- a/check/time_lw_Q.cpp +++ b/check/time_lw_Q.cpp @@ -21,7 +21,12 @@ * 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 const bool do_test = true; // set to true in order to run this beast @@ -62,7 +67,6 @@ unsigned time_lw_Q() double time = .0; cout << "timing Lewis-Wester test Q (charpoly(P))" << flush; - clog << "-------Lewis-Wester test Q (charpoly(P)):" << endl; if (do_test) { rolex.start(); @@ -72,18 +76,19 @@ unsigned time_lw_Q() ++count; } while ((time=rolex.read())<0.1 && !result); cout << '.' << flush; - - if (!result) { - cout << " passed "; - clog << "(no output)" << endl; - } else { - cout << " failed "; - } cout << time/count << 's' << endl; } else { cout << " disabled" << endl; - clog << "(no output)" << endl; } return result; } + +extern void randomify_symbol_serials(); + +int main(int argc, char** argv) +{ + randomify_symbol_serials(); + cout << setprecision(2) << showpoint; + return time_lw_Q(); +} diff --git a/check/time_lw_Qprime.cpp b/check/time_lw_Qprime.cpp index 64374120..0046dde9 100644 --- a/check/time_lw_Qprime.cpp +++ b/check/time_lw_Qprime.cpp @@ -21,7 +21,12 @@ * 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 const bool do_test = true; // set to true in order to run this beast @@ -74,7 +79,6 @@ unsigned time_lw_Qprime() double time = .0; cout << "timing Lewis-Wester test Q' (charpoly(P'))" << flush; - clog << "-------Lewis-Wester test Q' (charpoly(P')):" << endl; if (do_test) { rolex.start(); @@ -84,18 +88,19 @@ unsigned time_lw_Qprime() ++count; } while ((time=rolex.read())<0.1 && !result); cout << '.' << flush; - - if (!result) { - cout << " passed "; - clog << "(no output)" << endl; - } else { - cout << " failed "; - } cout << time/count << 's' << endl; } else { cout << " disabled" << endl; - clog << "(no output)" << endl; } return result; } + +extern void randomify_symbol_serials(); + +int main(int argc, char** argv) +{ + randomify_symbol_serials(); + cout << setprecision(2) << showpoint; + return time_lw_Qprime(); +} diff --git a/check/time_toeplitz.cpp b/check/time_toeplitz.cpp index 9bf569ab..2b27e90b 100644 --- a/check/time_toeplitz.cpp +++ b/check/time_toeplitz.cpp @@ -23,7 +23,12 @@ * 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) { @@ -69,7 +74,6 @@ 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; @@ -93,12 +97,6 @@ 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) @@ -110,3 +108,12 @@ unsigned time_toeplitz() return result; } + +extern void randomify_symbol_serials(); + +int main(int argc, char** argv) +{ + randomify_symbol_serials(); + cout << setprecision(2) << showpoint; + return time_toeplitz(); +} diff --git a/check/time_vandermonde.cpp b/check/time_vandermonde.cpp index fccc1392..1caaa407 100644 --- a/check/time_vandermonde.cpp +++ b/check/time_vandermonde.cpp @@ -24,7 +24,12 @@ * 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 vandermonde_det(unsigned size) { @@ -66,7 +71,6 @@ unsigned time_vandermonde() unsigned result = 0; cout << "timing determinant of univariate symbolic Vandermonde matrices" << flush; - clog << "-------determinant of univariate symbolic Vandermonde matrices:" << endl; vector sizes; vector times; @@ -90,12 +94,6 @@ unsigned time_vandermonde() 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) @@ -107,3 +105,12 @@ unsigned time_vandermonde() return result; } + +extern void randomify_symbol_serials(); + +int main(int argc, char** argv) +{ + randomify_symbol_serials(); + cout << setprecision(2) << showpoint; + return time_vandermonde(); +} diff --git a/check/times.cpp b/check/times.cpp deleted file mode 100644 index b825543b..00000000 --- a/check/times.cpp +++ /dev/null @@ -1,104 +0,0 @@ -/** @file times.cpp - * - * Main program that calls the individual timings. */ - -/* - * GiNaC Copyright (C) 1999-2007 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 - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include -#include "times.h" - -/** Generate a random amount of symbols and destroy them again immediatly. - * This operation effectively makes the serial numbers of all subsequent - * symbols unpredictable. If the serials are unpredictable, then so are - * their hash values. If the hash values are unpredictable, then so are - * the canonical orderings. If the canonical orderings are unpredictable, - * all subsequent times are subject to some variation. This variation, - * however is natural and desireable for two reasons: First, we cannot know - * how many symbols have been generated before in real world computations. - * Second, the following timings are subject to some semi-random variation - * anyways because short timings need to be repeated until enough time has - * gone by for the measurement to be reliable. During this process the serial - * numbers will be shifted anyways in a semi-random way. It is better not - * to lull the user in a false sense of reproducibility and instead confront - * her with the normal variation to be expected. - */ -void randomify_symbol_serials() -{ - srand(time(NULL)); - const int m = rand() % 666; - for (int s=0; s -#include -#include -#include -#include "config.h" -#include "ginac.h" -using namespace std; -using namespace GiNaC; - -#include "timer.h" - -// prototypes for all individual timings should be unsigned fcn(): -unsigned time_dennyfliegner(); -unsigned time_gammaseries(); -unsigned time_vandermonde(); -unsigned time_toeplitz(); -unsigned time_hashmap(); -unsigned time_lw_A(); -unsigned time_lw_B(); -unsigned time_lw_C(); -unsigned time_lw_D(); -unsigned time_lw_E(); -unsigned time_lw_F(); -unsigned time_lw_G(); -unsigned time_lw_H(); -unsigned time_lw_IJKL(); -unsigned time_lw_M1(); -unsigned time_lw_M2(); -unsigned time_lw_N(); -unsigned time_lw_O(); -unsigned time_lw_P(); -unsigned time_lw_Pprime(); -unsigned time_lw_Q(); -unsigned time_lw_Qprime(); -unsigned time_antipode(); -unsigned time_fateman_expand(); - -#endif // ndef CHECKS_H diff --git a/check/times.ref b/check/times.ref deleted file mode 100644 index 08e9b393..00000000 --- a/check/times.ref +++ /dev/null @@ -1,56 +0,0 @@ --------commutative expansion and substitution: -(no output) --------Laurent series expansion of Gamma function: -(no output) --------determinant of univariate symbolic Vandermonde matrices: -(no output) --------determinant of polyvariate symbolic Toeplitz matrices: -(no output) --------hash map operations: -(no output) --------Lewis-Wester test A (divide factorials): -(no output) --------Lewis-Wester test B (sum of rational numbers): -(no output) --------Lewis-Wester test C (gcd of big integers): -(no output) --------Lewis-Wester test D (normalized sum of rational fcns): -(no output) --------Lewis-Wester test E (normalized sum of rational fcns): -(no output) --------Lewis-Wester test F (gcd of 2-var polys): -(no output) --------Lewis-Wester test G (gcd of 3-var polys): -(no output) --------Lewis-Wester test H (det of 80x80 Hilbert): -(no output) --------Lewis-Wester test I (invert rank 40 Hilbert): -(no output) --------Lewis-Wester test J (check rank 40 Hilbert): -(no output) --------Lewis-Wester test K (invert rank 70 Hilbert): -(no output) --------Lewis-Wester test L (check rank 70 Hilbert): -(no output) --------Lewis-Wester test M1 (26x26 sparse, det): -(no output) --------Lewis-Wester test M2 (101x101 sparse, det): -(no output) --------Lewis-Wester test N (poly at rational fcns): -(no output) --------Lewis-Wester test O1 (three 15x15 dets): -(no output) --------Lewis-Wester test O2 (Resultant): -(no output) --------Lewis-Wester test P (det of sparse rank 101): -(no output) --------Lewis-Wester test P' (det of less sparse rank 101): -(no output) --------Lewis-Wester test Q (charpoly(P)): -(no output) --------Lewis-Wester test Q' (charpoly(P')): -(no output) --------computation of antipodes in Yukawa theory: -(no output) --------Fateman's polynomial expand benchmark: -(no output)