GiNaC-devel
Threads by month
- ----- 2025 -----
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2005 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2004 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2003 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2002 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2001 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2000 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1999 -----
- December
- November
- October
- September
March 2008
- 5 participants
- 26 discussions
[PATCH 1/8] inifcns_nstdsums.cpp: S_num takes cl_N as an argument instead of numeric.
by Alexei Sheplyakov 28 Jul '08
by Alexei Sheplyakov 28 Jul '08
28 Jul '08
Implicit conversion from cl_N to numeric considered harmful.
Using GiNaC::numeric for numerical computations incurs significant
overhead, so one might want to do these computations using proper CLN
types. Unfortunately, it's not easy due to automatic conversion from
cln::cl_N to GiNaC::numeric. Here is a simple example:
cl_N x, y;
// initialize them
return sin(x) + y*exp(y);
The compiler complains about ambigously overloaded of functions, i.e.
cl_N cln::sin(const cl_N&) versus numeric GiNaC::sin(const numeric&).
Hence, I propose to disable *implicit* conversion from cl_N to numeric
(this can be done by marking the numeric ctor as `explicit').
However, this change happens to be a bit nontrivial, because that evil
conversion is used in GiNaC itself. So, I decided to rewrite those fragments
of code.
---
ginac/inifcns_nstdsums.cpp | 50 ++++++++++++++++++++++++++-----------------
1 files changed, 30 insertions(+), 20 deletions(-)
diff --git a/ginac/inifcns_nstdsums.cpp b/ginac/inifcns_nstdsums.cpp
index cd3511a..ea42a6e 100644
--- a/ginac/inifcns_nstdsums.cpp
+++ b/ginac/inifcns_nstdsums.cpp
@@ -320,7 +320,7 @@ cln::cl_N Lin_do_sum_Xn(int n, const cln::cl_N& x)
// forward declaration needed by function Li_projection and C below
-numeric S_num(int n, int p, const numeric& x);
+const cln::cl_N S_num(int n, int p, const cln::cl_N& x);
// helper function for classical polylog Li
@@ -371,7 +371,7 @@ cln::cl_N Li_projection(int n, const cln::cl_N& x, const cln::float_format_t& pr
} else {
cln::cl_N result = -cln::expt(cln::log(x), n-1) * cln::log(1-x) / cln::factorial(n-1);
for (int j=0; j<n-1; j++) {
- result = result + (S_num(n-j-1, 1, 1).to_cl_N() - S_num(1, n-j-1, 1-x).to_cl_N())
+ result = result + (S_num(n-j-1, 1, 1) - S_num(1, n-j-1, 1-x))
* cln::expt(cln::log(x), j) / cln::factorial(j);
}
return result;
@@ -402,7 +402,7 @@ numeric Lin_numeric(int n, const numeric& x)
cln::cl_N x_ = ex_to<numeric>(x).to_cl_N();
cln::cl_N result = -cln::expt(cln::log(x_), n-1) * cln::log(1-x_) / cln::factorial(n-1);
for (int j=0; j<n-1; j++) {
- result = result + (S_num(n-j-1, 1, 1).to_cl_N() - S_num(1, n-j-1, 1-x_).to_cl_N())
+ result = result + (S_num(n-j-1, 1, 1) - S_num(1, n-j-1, 1-x_))
* cln::expt(cln::log(x_), j) / cln::factorial(j);
}
return result;
@@ -1715,10 +1715,10 @@ cln::cl_N C(int n, int p)
if (k == 0) {
if (n & 1) {
if (j & 1) {
- result = result - 2 * cln::expt(cln::pi(),2*j) * S_num(n-2*j,p,1).to_cl_N() / cln::factorial(2*j);
+ result = result - 2 * cln::expt(cln::pi(),2*j) * S_num(n-2*j,p,1) / cln::factorial(2*j);
}
else {
- result = result + 2 * cln::expt(cln::pi(),2*j) * S_num(n-2*j,p,1).to_cl_N() / cln::factorial(2*j);
+ result = result + 2 * cln::expt(cln::pi(),2*j) * S_num(n-2*j,p,1) / cln::factorial(2*j);
}
}
}
@@ -1726,23 +1726,23 @@ cln::cl_N C(int n, int p)
if (k & 1) {
if (j & 1) {
result = result + cln::factorial(n+k-1)
- * cln::expt(cln::pi(),2*j) * S_num(n+k-2*j,p-k,1).to_cl_N()
+ * cln::expt(cln::pi(),2*j) * S_num(n+k-2*j,p-k,1)
/ (cln::factorial(k) * cln::factorial(n-1) * cln::factorial(2*j));
}
else {
result = result - cln::factorial(n+k-1)
- * cln::expt(cln::pi(),2*j) * S_num(n+k-2*j,p-k,1).to_cl_N()
+ * cln::expt(cln::pi(),2*j) * S_num(n+k-2*j,p-k,1)
/ (cln::factorial(k) * cln::factorial(n-1) * cln::factorial(2*j));
}
}
else {
if (j & 1) {
- result = result - cln::factorial(n+k-1) * cln::expt(cln::pi(),2*j) * S_num(n+k-2*j,p-k,1).to_cl_N()
+ result = result - cln::factorial(n+k-1) * cln::expt(cln::pi(),2*j) * S_num(n+k-2*j,p-k,1)
/ (cln::factorial(k) * cln::factorial(n-1) * cln::factorial(2*j));
}
else {
result = result + cln::factorial(n+k-1)
- * cln::expt(cln::pi(),2*j) * S_num(n+k-2*j,p-k,1).to_cl_N()
+ * cln::expt(cln::pi(),2*j) * S_num(n+k-2*j,p-k,1)
/ (cln::factorial(k) * cln::factorial(n-1) * cln::factorial(2*j));
}
}
@@ -1855,7 +1855,7 @@ cln::cl_N S_projection(int n, int p, const cln::cl_N& x, const cln::float_format
res2 = res2 + cln::expt(cln::cl_I(-1),r) * cln::expt(cln::log(1-x),r)
* S_do_sum(p-r,n-s,1-x,prec) / cln::factorial(r);
}
- result = result + cln::expt(cln::log(x),s) * (S_num(n-s,p,1).to_cl_N() - res2) / cln::factorial(s);
+ result = result + cln::expt(cln::log(x),s) * (S_num(n-s,p,1) - res2) / cln::factorial(s);
}
return result;
@@ -1866,7 +1866,7 @@ cln::cl_N S_projection(int n, int p, const cln::cl_N& x, const cln::float_format
// helper function for S(n,p,x)
-numeric S_num(int n, int p, const numeric& x)
+const cln::cl_N S_num(int n, int p, const cln::cl_N& x)
{
if (x == 1) {
if (n == 1) {
@@ -1902,11 +1902,11 @@ numeric S_num(int n, int p, const numeric& x)
// what is the desired float format?
// first guess: default format
cln::float_format_t prec = cln::default_float_format;
- const cln::cl_N value = x.to_cl_N();
+ const cln::cl_N value = x;
// second guess: the argument's format
- if (!x.real().is_rational())
+ if (!instanceof(realpart(value), cln::cl_RA_ring))
prec = cln::float_format(cln::the<cln::cl_F>(cln::realpart(value)));
- else if (!x.imag().is_rational())
+ else if (!instanceof(imagpart(value), cln::cl_RA_ring))
prec = cln::float_format(cln::the<cln::cl_F>(cln::imagpart(value)));
// [Kol] (5.3)
@@ -1919,9 +1919,9 @@ numeric S_num(int n, int p, const numeric& x)
cln::cl_N res2;
for (int r=0; r<p; r++) {
res2 = res2 + cln::expt(cln::cl_I(-1),r) * cln::expt(cln::log(1-value),r)
- * S_num(p-r,n-s,1-value).to_cl_N() / cln::factorial(r);
+ * S_num(p-r,n-s,1-value) / cln::factorial(r);
}
- result = result + cln::expt(cln::log(value),s) * (S_num(n-s,p,1).to_cl_N() - res2) / cln::factorial(s);
+ result = result + cln::expt(cln::log(value),s) * (S_num(n-s,p,1) - res2) / cln::factorial(s);
}
return result;
@@ -1936,7 +1936,7 @@ numeric S_num(int n, int p, const numeric& x)
for (int r=0; r<=s; r++) {
result = result + cln::expt(cln::cl_I(-1),s) * cln::expt(cln::log(-value),r) * cln::factorial(n+s-r-1)
/ cln::factorial(r) / cln::factorial(s-r) / cln::factorial(n-1)
- * S_num(n+s-r,p-s,cln::recip(value)).to_cl_N();
+ * S_num(n+s-r,p-s,cln::recip(value));
}
}
result = result * cln::expt(cln::cl_I(-1),n);
@@ -1972,12 +1972,18 @@ numeric S_num(int n, int p, const numeric& x)
static ex S_evalf(const ex& n, const ex& p, const ex& x)
{
if (n.info(info_flags::posint) && p.info(info_flags::posint)) {
+ const int n_ = ex_to<numeric>(n).to_int();
+ const int p_ = ex_to<numeric>(p).to_int();
if (is_a<numeric>(x)) {
- return S_num(ex_to<numeric>(n).to_int(), ex_to<numeric>(p).to_int(), ex_to<numeric>(x));
+ const cln::cl_N x_ = ex_to<numeric>(x).to_cl_N();
+ const cln::cl_N result = S_num(n_, p_, x_);
+ return numeric(result);
} else {
ex x_val = x.evalf();
if (is_a<numeric>(x_val)) {
- return S_num(ex_to<numeric>(n).to_int(), ex_to<numeric>(p).to_int(), ex_to<numeric>(x_val));
+ const cln::cl_N x_val_ = ex_to<numeric>(x_val).to_cl_N();
+ const cln::cl_N result = S_num(n_, p_, x_val_);
+ return numeric(result);
}
}
}
@@ -2002,7 +2008,11 @@ static ex S_eval(const ex& n, const ex& p, const ex& x)
return Li(n+1, x);
}
if (x.info(info_flags::numeric) && (!x.info(info_flags::crational))) {
- return S_num(ex_to<numeric>(n).to_int(), ex_to<numeric>(p).to_int(), ex_to<numeric>(x));
+ int n_ = ex_to<numeric>(n).to_int();
+ int p_ = ex_to<numeric>(p).to_int();
+ const cln::cl_N x_ = ex_to<numeric>(x).to_cl_N();
+ const cln::cl_N result = S_num(n_, p_, x_);
+ return numeric(result);
}
}
if (n.is_zero()) {
--
1.5.4.2
--
All science is either physics or stamp collecting.
3
6
Hi!
These merges
83a7ee99a947cbbf331018b803ad6be43a9ccd45
eb9e62507fb1d2a0d5ddfdfcc2977a57ce40ca21
357698c2ef153870a31d33a9b53a5a01d582f942
look really strange (as in "this should not happen"). What's going on?
Best regards,
Alexei
--
All science is either physics or stamp collecting.
3
6
[SCM] GiNaC -- a C++ library for symbolic computations branch, master, updated. release_1-4-0-40-g3c85fea
by gitï¼ ginac.de 27 Mar '08
by gitï¼ ginac.de 27 Mar '08
27 Mar '08
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 3c85fea898265651ad22baa22aa002a819e5c536 (commit)
from 83a7ee99a947cbbf331018b803ad6be43a9ccd45 (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 3c85fea898265651ad22baa22aa002a819e5c536
Author: Richard B. Kreckel <kreckel(a)ginac.de>
Date: Thu Mar 27 23:56:32 2008 +0100
Adjust for GiNaC 1.5.
-----------------------------------------------------------------------
Summary of changes:
debian/control | 10 +++++-----
.../{libginac1.4.install => libginac1.5.install} | 0
debian/rules | 2 +-
3 files changed, 6 insertions(+), 6 deletions(-)
rename debian/{libginac1.4.install => libginac1.5.install} (100%)
hooks/post-receive
--
GiNaC -- a C++ library for symbolic computations
1
0
[SCM] GiNaC -- a C++ library for symbolic computations branch, ginac_1-4, updated. release_1-4-0-42-g47c1eb8
by gitï¼ ginac.de 27 Mar '08
by gitï¼ ginac.de 27 Mar '08
27 Mar '08
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, ginac_1-4 has been updated
via 47c1eb8365109f015062719acc5f2709b4131206 (commit)
from eb9e62507fb1d2a0d5ddfdfcc2977a57ce40ca21 (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 47c1eb8365109f015062719acc5f2709b4131206
Author: Richard B. Kreckel <kreckel(a)ginac.de>
Date: Thu Mar 27 22:35:27 2008 +0100
Update debian/changelog in anticipation of release.
-----------------------------------------------------------------------
Summary of changes:
debian/changelog | 49 +++++++++++++++++++++++++++++++++++++++++++++----
1 files changed, 45 insertions(+), 4 deletions(-)
hooks/post-receive
--
GiNaC -- a C++ library for symbolic computations
1
0
[SCM] GiNaC -- a C++ library for symbolic computations branch, master, updated. release_1-4-0-39-g83a7ee9
by gitï¼ ginac.de 27 Mar '08
by gitï¼ ginac.de 27 Mar '08
27 Mar '08
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 83a7ee99a947cbbf331018b803ad6be43a9ccd45 (commit)
via 4549628b93b6a795baf8f2dc836838acb88b4ffa (commit)
from 56a180a49e085b325c0e6e49a2e2db07c570ef7b (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 83a7ee99a947cbbf331018b803ad6be43a9ccd45
Merge: 4549628b93b6a795baf8f2dc836838acb88b4ffa 56a180a49e085b325c0e6e49a2e2db07c570ef7b
Author: Jens Vollinga <jensv(a)balin.nikhef.nl>
Date: Thu Mar 27 11:16:11 2008 +0100
Merge commit 'origin/master'
commit 4549628b93b6a795baf8f2dc836838acb88b4ffa
Author: Jens Vollinga <jensv(a)balin.nikhef.nl>
Date: Thu Mar 27 11:08:09 2008 +0100
Fixed make distcheck issues.
-----------------------------------------------------------------------
Summary of changes:
check/Makefile.am | 2 ++
doc/examples/Makefile.am | 3 ++-
doc/tutorial/Makefile.am | 5 ++---
doc/tutorial/classhierarchy.txt | 1 -
doc/tutorial/repnaive.txt | 1 -
doc/tutorial/reppair.txt | 1 -
doc/tutorial/repreal.txt | 1 -
7 files changed, 6 insertions(+), 8 deletions(-)
delete mode 100644 doc/tutorial/classhierarchy.txt
delete mode 100644 doc/tutorial/repnaive.txt
delete mode 100644 doc/tutorial/reppair.txt
delete mode 100644 doc/tutorial/repreal.txt
hooks/post-receive
--
GiNaC -- a C++ library for symbolic computations
1
0
[SCM] GiNaC -- a C++ library for symbolic computations branch, ginac_1-4, updated. release_1-4-0-41-geb9e625
by gitï¼ ginac.de 27 Mar '08
by gitï¼ ginac.de 27 Mar '08
27 Mar '08
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, ginac_1-4 has been updated
via eb9e62507fb1d2a0d5ddfdfcc2977a57ce40ca21 (commit)
via 92bef99606b90934ec00043959cace7f4545e533 (commit)
from 357698c2ef153870a31d33a9b53a5a01d582f942 (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 eb9e62507fb1d2a0d5ddfdfcc2977a57ce40ca21
Merge: 92bef99606b90934ec00043959cace7f4545e533 357698c2ef153870a31d33a9b53a5a01d582f942
Author: Jens Vollinga <jensv(a)balin.nikhef.nl>
Date: Thu Mar 27 11:15:39 2008 +0100
Merge commit 'origin/ginac_1-4' into ginac_1-4
commit 92bef99606b90934ec00043959cace7f4545e533
Author: Jens Vollinga <jensv(a)balin.nikhef.nl>
Date: Thu Mar 27 11:08:09 2008 +0100
Fixed make distcheck issues.
-----------------------------------------------------------------------
Summary of changes:
check/Makefile.am | 2 ++
doc/examples/Makefile.am | 3 ++-
doc/tutorial/Makefile.am | 5 ++---
doc/tutorial/classhierarchy.txt | 1 -
doc/tutorial/repnaive.txt | 1 -
doc/tutorial/reppair.txt | 1 -
doc/tutorial/repreal.txt | 1 -
7 files changed, 6 insertions(+), 8 deletions(-)
delete mode 100644 doc/tutorial/classhierarchy.txt
delete mode 100644 doc/tutorial/repnaive.txt
delete mode 100644 doc/tutorial/reppair.txt
delete mode 100644 doc/tutorial/repreal.txt
hooks/post-receive
--
GiNaC -- a C++ library for symbolic computations
1
0
[SCM] GiNaC -- a C++ library for symbolic computations branch, master, updated. release_1-4-0-37-g56a180a
by gitï¼ ginac.de 27 Mar '08
by gitï¼ ginac.de 27 Mar '08
27 Mar '08
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 56a180a49e085b325c0e6e49a2e2db07c570ef7b (commit)
from 67467d256b44f5e08498ca81c946d9ffaa25d1e2 (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 56a180a49e085b325c0e6e49a2e2db07c570ef7b
Author: Richard B. Kreckel <kreckel(a)ginac.de>
Date: Thu Mar 27 00:50:19 2008 +0100
Update debian/changelog in anticipation of release.
In reality, I'm testing the post-receive hook.
-----------------------------------------------------------------------
Summary of changes:
debian/changelog | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
hooks/post-receive
--
GiNaC -- a C++ library for symbolic computations
1
0
Hi,
I think I want to repair the dates of the tags in git. It just doesn't
look to good with all the unknown dates (I also want to fix
relase->release). But I am not 100% sure what that would mean for the
other people here (would they have to delete and fetch every single tag
manually, clone again, do nothing, ...). So, I just wanted to ask
whether there are some objections or better ideas. I have already fix
release_0-5-0 as a show case.
Regards,
Jens
2
1
[PATCH] check: indicate the test failures with non-zero exit code; split test programs.
by Alexei Sheplyakov 24 Mar '08
by Alexei Sheplyakov 24 Mar '08
24 Mar '08
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 <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()
@@ -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 <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)
@@ -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 <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. */
@@ -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 <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. */
@@ -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 <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;
-}
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 <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
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 <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;
@@ -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 <iostream>
+#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 <iostream>
+#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 <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)
@@ -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 <iostream>
+#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<unsigned> 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 <iostream>
+#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 <iostream>
+#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 <iostream>
#include <fstream>
+#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 <iostream>
+#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 <stdexcept>
-#include "exams.h"
+#include <iostream>
+#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 <iostream>
+#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 <iostream>
+#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 <iostream>
#include <sstream>
+#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 <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
@@ -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 <iostream>
+#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 <iostream>
+#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 <iostream>
+#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 <iostream>
+#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 <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;
-}
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 <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
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 <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");
+ }
+}
+
+
diff --git a/check/run_checks b/check/run_checks
deleted file mode 100755
index 93b7706..0000000
--- a/check/run_checks
+++ /dev/null
@@ -1,4 +0,0 @@
-#! /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
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 <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;
@@ -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 <iostream>
+#include <sstream>
+#include <vector>
+#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<unsigned> sizes;
vector<double> 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<unsigned>::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 <iostream>
+#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 <iostream>
+#include <vector>
+#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<unsigned> sizes;
vector<double> 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<unsigned>::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 <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)
@@ -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<unsigned> 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<unsigned>(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 <iostream>
+#include <vector>
+#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 <iostream>
+#include <vector>
+#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 <iostream>
+#include <vector>
+#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 <iostream>
+#include <vector>
+#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 <iostream>
+#include <vector>
+#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 <iostream>
+#include <vector>
+#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 <iostream>
+#include <vector>
+#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 <iostream>
+#include <vector>
+#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 <iostream>
+#include <vector>
+#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 <iostream>
+#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 <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
@@ -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 <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
@@ -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 <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
@@ -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 <iostream>
+#include <vector>
+#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 <iostream>
+#include <vector>
+#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 <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
@@ -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 <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
@@ -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 <iostream>
+#include <vector>
+#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<unsigned> sizes;
vector<double> 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<unsigned>::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 <iostream>
+#include <vector>
+#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<unsigned> sizes;
vector<double> 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<unsigned>::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 <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;
-}
diff --git a/check/times.h b/check/times.h
deleted file mode 100644
index 40b1340..0000000
--- a/check/times.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/** @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
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.
3
17
19 Mar '08
The actual code is the same. These functions are OK since cl_N is not
automatically converted to numeric any more.
---
ginac/numeric.cpp | 12 ++++++------
1 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/ginac/numeric.cpp b/ginac/numeric.cpp
index 4cbaa7d..d2c10f6 100644
--- a/ginac/numeric.cpp
+++ b/ginac/numeric.cpp
@@ -1977,7 +1977,7 @@ static const cln::float_format_t guess_precision(const cln::cl_N& x)
* sufficiently many or sufficiently accurate, more can be calculated
* using the program doc/examples/lanczos.cpp. In that case, be sure to
* read the comments in that file. */
-const cln::cl_N lgamma_(const cln::cl_N &x)
+const cln::cl_N lgamma(const cln::cl_N &x)
{
cln::float_format_t prec = guess_precision(x);
lanczos_coeffs lc;
@@ -1985,7 +1985,7 @@ const cln::cl_N lgamma_(const cln::cl_N &x)
cln::cl_N pi_val = cln::pi(prec);
if (realpart(x) < 0.5)
return cln::log(pi_val) - cln::log(sin(pi_val*x))
- - lgamma_(1 - x);
+ - lgamma(1 - x);
cln::cl_N A = lc.calc_lanczos_A(x);
cln::cl_N temp = x + lc.get_order() - cln::cl_N(1)/2;
cln::cl_N result = log(cln::cl_I(2)*pi_val)/2
@@ -2001,18 +2001,18 @@ const cln::cl_N lgamma_(const cln::cl_N &x)
const numeric lgamma(const numeric &x)
{
const cln::cl_N x_ = x.to_cl_N();
- const cln::cl_N result = lgamma_(x_);
+ const cln::cl_N result = lgamma(x_);
return numeric(result);
}
-const cln::cl_N tgamma_(const cln::cl_N &x)
+const cln::cl_N tgamma(const cln::cl_N &x)
{
cln::float_format_t prec = guess_precision(x);
lanczos_coeffs lc;
if (lc.sufficiently_accurate(prec)) {
cln::cl_N pi_val = cln::pi(prec);
if (realpart(x) < 0.5)
- return pi_val/(cln::sin(pi_val*x))/tgamma_(1 - x);
+ return pi_val/(cln::sin(pi_val*x))/tgamma(1 - x);
cln::cl_N A = lc.calc_lanczos_A(x);
cln::cl_N temp = x + lc.get_order() - cln::cl_N(1)/2;
cln::cl_N result
@@ -2027,7 +2027,7 @@ const cln::cl_N tgamma_(const cln::cl_N &x)
const numeric tgamma(const numeric &x)
{
const cln::cl_N x_ = x.to_cl_N();
- const cln::cl_N result = tgamma_(x_);
+ const cln::cl_N result = tgamma(x_);
return numeric(result);
}
--
1.5.4.2
--
All science is either physics or stamp collecting.
1
0