## 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
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include "checks.h"
+#include <iostream>
+#include <cstdlib> // rand()
+#include "ginac.h"
+using namespace std;
+using namespace GiNaC;
/* Some tests on the sine trigonometric function. */
static unsigned inifcns_check_sin()
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();
+}
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include "checks.h"
+#include <iostream>
#include <sstream>
+#include <cstdlib> // 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)
unsigned result = 0;
cout << "checking linear solve" << flush;
- clog << "---------linear solve:" << endl;
// solve some numeric linear systems
for (unsigned n=1; n<14; ++n)
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();
+}
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include "checks.h"
+#include <iostream>
+#include <cstdlib> // 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. */
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;
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();
+}
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include "checks.h"
+#include <iostream>
+#include <cstdlib> // rand()
+#include "ginac.h"
+using namespace std;
+using namespace GiNaC;
/* Simple and maybe somewhat pointless consistency tests of assorted tests and
* conversions. */
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();
+}
+++ /dev/null
-/** @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 <stdexcept>
-#include <time.h>
-
-#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;
-}
+++ /dev/null
-/** @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 <iostream>
-
-#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
+++ /dev/null
----------consistency of numeric types:
-(no output)
----------consistency of symbolic functions:
-(no output)
----------symbolic matrix manipulations:
-(no output)
----------linear solve:
-(no output)
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include "exams.h"
-
+#include <iostream>
#include <fstream>
+#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;
++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();
+}
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include "exams.h"
+#include <iostream>
+#include "ginac.h"
+using namespace std;
+using namespace GiNaC;
const numeric half(1, 2);
unsigned result = 0;
cout << "examining clifford objects" << flush;
- clog << "----------clifford objects:" << endl;
result += clifford_check1(); cout << '.' << flush;
result += clifford_check2(); cout << '.' << flush;
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();
+}
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include "exams.h"
+#include <iostream>
+#include "ginac.h"
+using namespace std;
+using namespace GiNaC;
static unsigned check_equal(const ex &e1, const ex &e2)
{
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();
+}
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include "exams.h"
+#include <iostream>
+#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)
unsigned result = 0;
cout << "examining symbolic differentiation" << flush;
- clog << "----------symbolic differentiation:" << endl;
result += exam_differentiation1(); cout << '.' << flush;
result += exam_differentiation2(); cout << '.' << flush;
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();
+}
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include "exams.h"
+#include <iostream>
+#include "ginac.h"
+using namespace std;
+using namespace GiNaC;
unsigned exam_hashmap()
{
unsigned N = 100;
cout << "examining hash maps" << flush;
- clog << "----------hash maps:" << endl;
// Create empty container
exhashmap<unsigned> M1;
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();
+}
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include "exams.h"
+#include <iostream>
+#include "ginac.h"
+using namespace std;
+using namespace GiNaC;
static unsigned check_equal(const ex &e1, const ex &e2)
{
unsigned result = 0;
cout << "examining indexed objects" << flush;
- clog << "----------indexed objects:" << endl;
result += delta_check(); cout << '.' << flush;
result += metric_check(); cout << '.' << flush;
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();
+}
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include "exams.h"
+#include <iostream>
+#include "ginac.h"
+using namespace std;
+using namespace GiNaC;
/* Assorted tests on other transcendental functions. */
static unsigned inifcns_consist_trans()
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();
+}
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include "exams.h"
-
+#include <iostream>
#include <fstream>
+#include "ginac.h"
+using namespace std;
+using namespace GiNaC;
+
////////////////////////////////////////////////////////////////////////////////
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();
+}
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include "exams.h"
+#include <iostream>
+#include "ginac.h"
+using namespace std;
+using namespace GiNaC;
static unsigned exam_lsolve1()
{
unsigned result = 0;
cout << "examining linear solve" << flush;
- clog << "----------linear solve:" << endl;
result += exam_lsolve1(); cout << '.' << flush;
result += exam_lsolve2a(); cout << '.' << flush;
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();
+}
*/
#include <stdexcept>
-#include "exams.h"
+#include <iostream>
+#include "ginac.h"
+using namespace std;
+using namespace GiNaC;
static unsigned matrix_determinants()
{
unsigned result = 0;
cout << "examining symbolic matrix manipulations" << flush;
- clog << "----------symbolic matrix manipulations:" << endl;
result += matrix_determinants(); cout << '.' << flush;
result += matrix_invert1(); cout << '.' << flush;
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();
+}
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-
-#include "exams.h"
+#include <iostream>
+#include "ginac.h"
+using namespace std;
+using namespace GiNaC;
#define VECSIZE 30
static unsigned exam_expand_subs()
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;
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();
+}
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include "exams.h"
+#include <iostream>
+#include "ginac.h"
+using namespace std;
+using namespace GiNaC;
static symbol w("w"), x("x"), y("y"), z("z");
unsigned result = 0;
cout << "examining rational function normalization" << flush;
- clog << "----------rational function normalization:" << endl;
result += exam_normal1(); cout << '.' << flush;
result += exam_normal2(); cout << '.' << flush;
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();
+}
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include "exams.h"
-
+#include <iostream>
#include <sstream>
+#include "ginac.h"
+using namespace std;
+using namespace GiNaC;
+
/* Simple and maybe somewhat pointless consistency tests of assorted tests and
* conversions. */
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;
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();
+}
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include "exams.h"
+#include <iostream>
+#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
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;
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();
+}
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include "exams.h"
+#include <iostream>
+#include "ginac.h"
+using namespace std;
+using namespace GiNaC;
const int MAX_VARIABLES = 3;
unsigned result = 0;
cout << "examining polynomial GCD computation" << flush;
- clog << "----------polynomial GCD computation:" << endl;
result += poly_gcd1(); cout << '.' << flush;
result += poly_gcd2(); cout << '.' << flush;
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();
+}
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include "exams.h"
+#include <iostream>
+#include "ginac.h"
+using namespace std;
+using namespace GiNaC;
static unsigned exam_powerlaws1()
{
unsigned result = 0;
cout << "examining power laws" << flush;
- clog << "----------power laws:" << endl;
result += exam_powerlaws1(); cout << '.' << flush;
result += exam_powerlaws2(); cout << '.' << flush;
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();
+}
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include "exams.h"
+#include <iostream>
+#include "ginac.h"
+using namespace std;
+using namespace GiNaC;
static symbol x("x");
unsigned result = 0;
cout << "examining series expansion" << flush;
- clog << "----------series expansion:" << endl;
result += exam_series1(); cout << '.' << flush;
result += exam_series2(); cout << '.' << flush;
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();
+}
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include "exams.h"
+#include <iostream>
+#include "ginac.h"
+using namespace std;
+using namespace GiNaC;
struct sprod_s {
unsigned result = 0;
cout << "examining structure template" << flush;
- clog << "----------structure template:" << endl;
symbol x("x"), y("y");
ex e;
++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();
+}
+++ /dev/null
-/** @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 <stdexcept>
-
-#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;
-}
+++ /dev/null
-/** @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 <iostream>
-#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
+++ /dev/null
-----------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)
--- /dev/null
+#include <cstdlib>
+#include <ctime>
+#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; s<m; ++s ) {
+ symbol("dummy");
+ }
+}
+
+
+++ /dev/null
-#! /bin/sh
-echo "GiNaC will now run through some rather costly random consistency checks:"
-./checks${EXEEXT} 2>checks.out
-cmp ${srcdir}/checks.ref checks.out
+++ /dev/null
-#! /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
+++ /dev/null
-#! /bin/sh
-echo "GiNaC will now run through some basic timings:"
-./times${EXEEXT} 2>times.out
-cmp ${srcdir}/times.ref times.out
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include "times.h"
#include <utility>
#include <vector>
#include <set>
#include <map>
#include <typeinfo>
#include <stdexcept>
+#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;
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();
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();
+}
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include "times.h"
+#include <iostream>
+#include <sstream>
+#include <vector>
+#include "ginac.h"
+#include "timer.h"
+using namespace std;
+using namespace GiNaC;
static unsigned expand_subs(unsigned size)
{
unsigned result = 0;
cout << "timing commutative expansion and substitution" << flush;
- clog << "-------commutative expansion and substitution:" << endl;
vector<unsigned> sizes;
vector<double> times;
cout << '.' << flush;
}
- if (!result) {
- cout << " passed ";
- clog << "(no output)" << endl;
- } else {
- cout << " failed ";
- }
// print the report:
cout << endl << " size: ";
for (vector<unsigned>::iterator i=sizes.begin(); i!=sizes.end(); ++i)
return result;
}
+
+extern void randomify_symbol_serials();
+
+int main(int argc, char** argv)
+{
+ randomify_symbol_serials();
+ cout << setprecision(2) << showpoint;
+ return time_dennyfliegner();
+}
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include "times.h"
+#include <iostream>
+#include "ginac.h"
+#include "timer.h"
+using namespace std;
+using namespace GiNaC;
static unsigned test()
{
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:
} 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();
+}
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include "times.h"
+#include <iostream>
+#include <vector>
+#include "ginac.h"
+#include "timer.h"
+using namespace std;
+using namespace GiNaC;
unsigned tgammaseries(unsigned order)
{
unsigned result = 0;
cout << "timing Laurent series expansion of Gamma function" << flush;
- clog << "-------Laurent series expansion of Gamma function:" << endl;
vector<unsigned> sizes;
vector<double> times;
cout << '.' << flush;
}
- if (!result) {
- cout << " passed ";
- clog << "(no output)" << endl;
- } else {
- cout << " failed ";
- }
// print the report:
cout << endl << " order: ";
for (vector<unsigned>::iterator i=sizes.begin(); i!=sizes.end(); ++i)
return result;
}
+
+extern void randomify_symbol_serials();
+
+int main(int argc, char** argv)
+{
+ randomify_symbol_serials();
+ cout << setprecision(2) << showpoint;
+ return time_gammaseries();
+}
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include "times.h"
+#include <iostream>
+#include <vector>
+#include "ginac.h"
+#include "timer.h"
+using namespace std;
+using namespace GiNaC;
template <class T>
static void run_timing(unsigned size, double &time_insert, double &time_find, double &time_erase)
unsigned result = 0;
cout << "timing hash map operations" << flush;
- clog << "-------hash map operations:" << endl;
unsigned s[] = {10000, 50000, 100000, 500000};
vector<unsigned> sizes(s, s+sizeof(s)/sizeof(*s));
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<unsigned>(cout, "\t"));
return result;
}
+
+extern void randomify_symbol_serials();
+
+int main(int argc, char** argv)
+{
+ randomify_symbol_serials();
+ cout << setprecision(2) << showpoint;
+ return time_hashmap();
+}
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include "times.h"
+#include <iostream>
+#include <vector>
+#include "ginac.h"
+#include "timer.h"
+using namespace std;
+using namespace GiNaC;
static unsigned test()
{
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:
++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();
+}
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include "times.h"
+#include <iostream>
+#include <vector>
+#include "ginac.h"
+#include "timer.h"
+using namespace std;
+using namespace GiNaC;
static unsigned test()
{
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:
++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();
+}
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include "times.h"
+#include <iostream>
+#include <vector>
+#include "ginac.h"
+#include "timer.h"
+using namespace std;
+using namespace GiNaC;
static unsigned test()
{
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:
++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();
+}
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include "times.h"
+#include <iostream>
+#include <vector>
+#include "ginac.h"
+#include "timer.h"
+using namespace std;
+using namespace GiNaC;
static unsigned test()
{
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:
++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();
+}
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include "times.h"
+#include <iostream>
+#include <vector>
+#include "ginac.h"
+#include "timer.h"
+using namespace std;
+using namespace GiNaC;
static unsigned test()
{
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:
++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();
+}
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include "times.h"
+#include <iostream>
+#include <vector>
+#include "ginac.h"
+#include "timer.h"
+using namespace std;
+using namespace GiNaC;
static unsigned test()
{
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:
++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();
+}
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include "times.h"
+#include <iostream>
+#include <vector>
+#include "ginac.h"
+#include "timer.h"
+using namespace std;
+using namespace GiNaC;
static unsigned test()
{
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:
++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();
+}
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include "times.h"
+#include <iostream>
+#include <vector>
+#include "ginac.h"
+#include "timer.h"
+using namespace std;
+using namespace GiNaC;
static unsigned test(unsigned n)
{
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:
++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();
+}
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include "times.h"
+#include <iostream>
+#include <vector>
+#include "ginac.h"
+#include "timer.h"
+using namespace std;
+using namespace GiNaC;
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);
matrix Hinv(n,n);
Hinv = H.inverse();
cout << ". passed ";
- clog << "(no output)" << endl;
cout << cartier.read() << 's' << endl;
// check result:
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);
correct = false;
}
}
- if (correct) {
- cout << ". passed ";
- clog << "(no output)" << endl;
- } else {
- cout << ". failed ";
+ if (!correct)
++result;
- }
cout << cartier.read() << 's' << endl;
return result;
}
return result;
}
+
+extern void randomify_symbol_serials();
+
+int main(int argc, char** argv)
+{
+ randomify_symbol_serials();
+ cout << setprecision(2) << showpoint;
+ return time_lw_IJKL();
+}
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include "times.h"
+#include <iostream>
+#include "ginac.h"
+#include "timer.h"
+using namespace std;
+using namespace GiNaC;
static unsigned test()
{
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:
++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();
+}
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include "times.h"
+#include <iostream>
+#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
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();
++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();
+}
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include "times.h"
+#include <iostream>
+#include <vector>
+#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
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();
++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();
+}
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include "times.h"
+#include <iostream>
+#include <vector>
+#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
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:
++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();
+}
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include "times.h"
+#include <iostream>
+#include <vector>
+#include "ginac.h"
+#include "timer.h"
+using namespace std;
+using namespace GiNaC;
static unsigned test()
{
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:
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();
+}
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include "times.h"
+#include <iostream>
+#include <vector>
+#include "ginac.h"
+#include "timer.h"
+using namespace std;
+using namespace GiNaC;
static unsigned test()
{
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:
++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();
+}
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include "times.h"
+#include <iostream>
+#include <vector>
+#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
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();
++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();
+}
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include "times.h"
+#include <iostream>
+#include <vector>
+#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
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();
++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();
+}
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include "times.h"
+#include <iostream>
+#include <vector>
+#include "ginac.h"
+#include "timer.h"
+using namespace std;
+using namespace GiNaC;
static unsigned toeplitz_det(unsigned size)
{
unsigned result = 0;
cout << "timing determinant of polyvariate symbolic Toeplitz matrices" << flush;
- clog << "-------determinant of polyvariate symbolic Toeplitz matrices:" << endl;
vector<unsigned> sizes;
vector<double> times;
cout << '.' << flush;
}
- if (!result) {
- cout << " passed ";
- clog << "(no output)" << endl;
- } else {
- cout << " failed ";
- }
// print the report:
cout << endl << " dim: ";
for (vector<unsigned>::iterator i=sizes.begin(); i!=sizes.end(); ++i)
return result;
}
+
+extern void randomify_symbol_serials();
+
+int main(int argc, char** argv)
+{
+ randomify_symbol_serials();
+ cout << setprecision(2) << showpoint;
+ return time_toeplitz();
+}
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include "times.h"
+#include <iostream>
+#include <vector>
+#include "ginac.h"
+#include "timer.h"
+using namespace std;
+using namespace GiNaC;
static unsigned vandermonde_det(unsigned size)
{
unsigned result = 0;
cout << "timing determinant of univariate symbolic Vandermonde matrices" << flush;
- clog << "-------determinant of univariate symbolic Vandermonde matrices:" << endl;
vector<unsigned> sizes;
vector<double> times;
cout << '.' << flush;
}
- if (!result) {
- cout << " passed ";
- clog << "(no output)" << endl;
- } else {
- cout << " failed ";
- }
// print the report:
cout << endl << " dim: ";
for (vector<unsigned>::iterator i=sizes.begin(); i!=sizes.end(); ++i)
return result;
}
+
+extern void randomify_symbol_serials();
+
+int main(int argc, char** argv)
+{
+ randomify_symbol_serials();
+ cout << setprecision(2) << showpoint;
+ return time_vandermonde();
+}
+++ /dev/null
-/** @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 <stdexcept>
-#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<m; ++s ) {
- symbol("dummy");
- }
-}
-
-int main()
-{
- randomify_symbol_serials();
-
- unsigned result = 0;
-
- // For all timings:
- cout << setprecision(2) << showpoint;
-
-#define TIME(which) \
-try { \
- result += time_ ## which (); \
-} catch (const exception &e) { \
- cout << "Error: caught exception " << e.what() << endl; \
- ++result; \
-}
-
- 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)
-
- if (result) {
- cout << "Error: something went wrong. ";
- if (result == 1) {
- cout << "(one failure)" << endl;
- } else {
- cout << "(" << result << " individual failures)" << endl;
- }
- cout << "please check times.out against times.ref for more details."
- << endl << "happy debugging!" << endl;
- }
-
- return result;
-}
+++ /dev/null
-/** @file times.h
- *
- * Prototypes for all 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
- */
-
-#ifndef CHECKS_H
-#define CHECKS_H
-
-#include <cstdlib>
-#include <iostream>
-#include <sstream>
-#include <vector>
-#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
+++ /dev/null
--------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)