From varg at theor.jinr.ru Tue Feb 5 08:09:46 2008 From: varg at theor.jinr.ru (Alexei Sheplyakov) Date: Tue, 5 Feb 2008 10:09:46 +0300 Subject: [GiNaC-devel] Semi-official GiNaC git repository Message-ID: <20080205070946.GA30102@theor.jinr.ru> Hello! Semi-official GiNaC git repostiory is available at git://ffmssmsc.jinr.ru:443/varg/ginac.git There's a web interface: http://ffmssmsc.jinr.ru/~varg/git/gitweb.cgi?p=varg/ginac.git Have fun, Alexei -- All science is either physics or stamp collecting. -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 827 bytes Desc: Digital signature URL: From varg at theor.jinr.ru Mon Feb 25 08:47:41 2008 From: varg at theor.jinr.ru (varg at theor.jinr.ru) Date: Mon, 25 Feb 2008 10:47:41 +0300 Subject: [GiNaC-devel] [SCM] GiNaC -- a C++ library for symbolic computations branch, master, updated. release_1-4-0-26-g3a56e58 Message-ID: <1203925661.211408.16212.nullmailer@vargsbox.jinr.ru> This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GiNaC -- a C++ library for symbolic computations". The branch, master has been updated via 3a56e58f6a3e2dac83f12c254d0d7549bb886af4 (commit) from f69a24a4fd6caf42ef773d1cef21562a8afa068a (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 3a56e58f6a3e2dac83f12c254d0d7549bb886af4 Author: Richard Kreckel Date: Sat Feb 23 02:27:56 2008 +0000 * Version 1.5. ----------------------------------------------------------------------- Summary of changes: configure.ac | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) hooks/post-receive -- GiNaC -- a C++ library for symbolic computations From varg at theor.jinr.ru Thu Feb 28 08:28:27 2008 From: varg at theor.jinr.ru (Alexei Sheplyakov) Date: Thu, 28 Feb 2008 10:28:27 +0300 Subject: [GiNaC-devel] [PATCH] check: indicate the test failures with non-zero exit code; split test programs. In-Reply-To: <20080227105811.GA6704@theor.jinr.ru> References: <20080227105811.GA6704@theor.jinr.ru> Message-ID: <20080228072827.GA9973@theor.jinr.ru> 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. --- check/Makefile.am | 245 ++++++++++++++++++++++++++++++++++----- check/check_inifcns.cpp | 19 ++-- check/check_lsolve.cpp | 22 ++-- check/check_matrices.cpp | 26 +++-- check/check_numeric.cpp | 18 ++-- check/checks.cpp | 60 ---------- check/checks.h | 47 -------- check/checks.ref | 8 -- check/exam_archive.cpp | 21 ++-- check/exam_clifford.cpp | 18 ++-- check/exam_color.cpp | 18 ++-- check/exam_differentiation.cpp | 17 ++-- check/exam_hashmap.cpp | 19 ++-- check/exam_indexed.cpp | 18 ++-- check/exam_inifcns.cpp | 18 ++-- check/exam_inifcns_nstdsums.cpp | 20 ++-- check/exam_lsolve.cpp | 18 ++-- check/exam_matrices.cpp | 18 ++-- check/exam_misc.cpp | 19 ++-- check/exam_normalization.cpp | 18 ++-- check/exam_numeric.cpp | 20 ++-- check/exam_paranoia.cpp | 18 ++-- check/exam_polygcd.cpp | 18 ++-- check/exam_powerlaws.cpp | 18 ++-- check/exam_pseries.cpp | 17 ++-- check/exam_structure.cpp | 20 ++-- check/exams.cpp | 70 ----------- check/exams.h | 51 -------- check/exams.ref | 36 ------ check/randomize_serials.cpp | 31 +++++ check/run_checks | 4 - check/run_exams | 4 - check/run_times | 4 - check/time_antipode.cpp | 23 ++-- check/time_dennyfliegner.cpp | 24 +++-- check/time_fateman_expand.cpp | 22 +++-- check/time_gammaseries.cpp | 23 +++-- check/time_hashmap.cpp | 24 +++-- check/time_lw_A.cpp | 24 +++-- check/time_lw_B.cpp | 23 +++-- check/time_lw_C.cpp | 24 +++-- check/time_lw_D.cpp | 24 +++-- check/time_lw_E.cpp | 24 +++-- check/time_lw_F.cpp | 24 +++-- check/time_lw_G.cpp | 24 +++-- check/time_lw_H.cpp | 24 +++-- check/time_lw_IJKL.cpp | 28 +++-- check/time_lw_M1.cpp | 23 +++-- check/time_lw_M2.cpp | 24 +++-- check/time_lw_N.cpp | 25 +++-- check/time_lw_O.cpp | 34 +++--- check/time_lw_P.cpp | 25 +++-- check/time_lw_Pprime.cpp | 24 +++-- check/time_lw_Q.cpp | 25 +++-- check/time_lw_Qprime.cpp | 25 +++-- check/time_toeplitz.cpp | 23 +++-- check/time_vandermonde.cpp | 23 +++-- check/times.cpp | 104 ----------------- check/times.h | 63 ---------- check/times.ref | 56 --------- 60 files changed, 820 insertions(+), 967 deletions(-) delete mode 100644 check/checks.cpp delete mode 100644 check/checks.h delete mode 100644 check/checks.ref delete mode 100644 check/exams.cpp delete mode 100644 check/exams.h delete mode 100644 check/exams.ref create mode 100644 check/randomize_serials.cpp delete mode 100755 check/run_checks delete mode 100755 check/run_exams delete mode 100755 check/run_times delete mode 100644 check/times.cpp delete mode 100644 check/times.h delete mode 100644 check/times.ref diff --git a/check/Makefile.am b/check/Makefile.am index b7c9d0f..d7f372b 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 2b10178..293fd8b 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 02a1df5..5f3c78a 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 38c87f4..1b310d4 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 ec1eaf2..ce79a27 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 3f063ac..0000000 --- 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 61e043f..0000000 --- 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 a109f51..0000000 --- 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 a2e19c4..0fcb616 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 006c076..4dbfacf 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 f2342a3..382f6d3 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 1eb5dfc..f2d6dbb 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 ae6a324..289c226 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 06bdbaa..722f53f 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 e0d595a..0b3c614 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 68b11b4..86c1e45 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 7df0fc4..67aae4e 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 88bc581..f4c84f9 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 29febf6..13cb2f9 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 34176dd..7eb4531 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 5a916e9..8f45dfe 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 035235a..003044e 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 bb410f2..ef90a36 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 5af3c86..d84a081 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 2e5d2d6..e24ef41 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 84de56b..b433600 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 4f669e5..0000000 --- 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 8cac4fe..0000000 --- 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 016a9c2..0000000 --- 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 0000000..ad29a1b --- /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 1e7ba46..0000000 --- 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 eb2380b..0000000 --- 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 67f410c..787dea2 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 3f6d6de..aca6e0e 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 904d653..08590d2 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 3ff55d6..f322787 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 2bd2f12..cea635b 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 94450eb..d7fdc47 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 abf446e..396bdf8 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 07f0eba..e5e79f4 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 e3fa86d..8599151 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 c50cc29..c0b5212 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 31366f6..33fbc3c 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 a752d52..1295a2d 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 d17b729..afbb48b 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 7271fe0..2ad74d8 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 d32603c..f68ddc7 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 f9ab775..e133378 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 27bb9f7..d6e96b1 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 4bf31e9..f2a6094 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 c95bbe2..d04e11a 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 5174efc..4c7e587 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 e506a35..1236dec 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 6437412..0046dde 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 9bf569a..2b27e90 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 fccc139..1caaa40 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 b825543..0000000 --- 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 08e9b39..0000000 --- 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) -- 1.5.4.2 Best regards, Alexei -- All science is either physics or stamp collecting. -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 827 bytes Desc: Digital signature URL: