times_SOURCES = time_dennyfliegner.cpp time_gammaseries.cpp \
time_vandermonde.cpp time_toeplitz.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_M1.cpp time_lw_O.cpp time_lw_P.cpp time_lw_Pprime.cpp \
- timer.cpp times.cpp times.h
+ time_lw_H.cpp time_lw_IJKL.cpp time_lw_M1.cpp time_lw_O.cpp time_lw_P.cpp \
+ time_lw_Pprime.cpp timer.cpp times.cpp times.h
times_LDADD = ../ginac/libginac.la
INCLUDES = -I$(srcdir)/../ginac
CLEANFILES = exams.out checks.out times.out
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
-times_SOURCES = time_dennyfliegner.cpp time_gammaseries.cpp time_vandermonde.cpp time_toeplitz.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_M1.cpp time_lw_O.cpp time_lw_P.cpp time_lw_Pprime.cpp timer.cpp times.cpp times.h
+times_SOURCES = time_dennyfliegner.cpp time_gammaseries.cpp time_vandermonde.cpp time_toeplitz.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_O.cpp time_lw_P.cpp time_lw_Pprime.cpp timer.cpp times.cpp times.h
times_LDADD = ../ginac/libginac.la
INCLUDES = -I$(srcdir)/../ginac
times_OBJECTS = time_dennyfliegner.o time_gammaseries.o \
time_vandermonde.o time_toeplitz.o time_lw_A.o time_lw_B.o time_lw_C.o \
time_lw_D.o time_lw_E.o time_lw_F.o time_lw_G.o time_lw_H.o \
-time_lw_M1.o time_lw_O.o time_lw_P.o time_lw_Pprime.o timer.o times.o
+time_lw_IJKL.o time_lw_M1.o time_lw_O.o time_lw_P.o time_lw_Pprime.o \
+timer.o times.o
times_DEPENDENCIES = ../ginac/libginac.la
times_LDFLAGS =
CXXFLAGS = @CXXFLAGS@
.deps/exams.P .deps/genex.P .deps/time_dennyfliegner.P \
.deps/time_gammaseries.P .deps/time_lw_A.P .deps/time_lw_B.P \
.deps/time_lw_C.P .deps/time_lw_D.P .deps/time_lw_E.P .deps/time_lw_F.P \
-.deps/time_lw_G.P .deps/time_lw_H.P .deps/time_lw_M1.P \
-.deps/time_lw_O.P .deps/time_lw_P.P .deps/time_lw_Pprime.P \
-.deps/time_toeplitz.P .deps/time_vandermonde.P .deps/timer.P \
-.deps/times.P
+.deps/time_lw_G.P .deps/time_lw_H.P .deps/time_lw_IJKL.P \
+.deps/time_lw_M1.P .deps/time_lw_O.P .deps/time_lw_P.P \
+.deps/time_lw_Pprime.P .deps/time_toeplitz.P .deps/time_vandermonde.P \
+.deps/timer.P .deps/times.P
SOURCES = $(exams_SOURCES) $(checks_SOURCES) $(times_SOURCES)
OBJECTS = $(exams_OBJECTS) $(checks_OBJECTS) $(times_OBJECTS)
vector<unsigned> sizes;
vector<double> times;
- timer rolex;
+ timer breitling;
sizes.push_back(25);
sizes.push_back(50);
sizes.push_back(200);
for (vector<unsigned>::iterator i=sizes.begin(); i!=sizes.end(); ++i) {
- rolex.start();
+ breitling.start();
result += expand_subs(*i);
- times.push_back(rolex.read());
+ times.push_back(breitling.read());
cout << '.' << flush;
}
--- /dev/null
+/** @file time_lw_IJKL.cpp
+ *
+ * Tests I, J, K and L from the paper "Comparison of Polynomial-Oriented CAS"
+ * by Robert H. Lewis and Michael Wester. */
+
+/*
+ * GiNaC Copyright (C) 1999-2000 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include "times.h"
+
+static unsigned test(unsigned n)
+{
+ unsigned result = 0;
+ timer cartier;
+ char name = (n==40?'I':(n==70?'K':'?'));
+
+ 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);
+ for (unsigned r=0; r<n; ++r)
+ for (unsigned c=0; c<n; ++c)
+ H.set(r,c,numeric(1,r+c+1));
+ // invert it:
+ cartier.start();
+ matrix Hinv(n,n);
+ Hinv = H.inverse();
+ cout << ". passed ";
+ clog << "(no output)" << endl;
+ cout << int(1000*cartier.read())*0.001 << 's' << endl;
+
+ // check result:
+ name = (n==40?'J':(n==70?'L':'?'));
+
+ 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);
+ bool correct = true;
+ for (unsigned r=0; r<n; ++r)
+ for (unsigned c=0; c<n; ++c) {
+ if (r==c) {
+ if (identity(r,c)!=1)
+ correct = false;
+ } else {
+ if (identity(r,c)!=0)
+ correct = false;
+ }
+ }
+ if (correct) {
+ cout << ". passed ";
+ clog << "(no output)" << endl;
+ } else {
+ cout << ". failed ";
+ ++result;
+ }
+ cout << int(1000*cartier.read())*0.001 << 's' << endl;
+ return result;
+}
+
+unsigned time_lw_IJKL(void)
+{
+ unsigned result = 0;
+
+ // Tests I and J:
+ result += test(40);
+ // Tests K and L:
+ result += test(70);
+
+ return result;
+}
++result;
}
+ try {
+ result += time_lw_IJKL();
+ } catch (const exception &e) {
+ cout << "Error: caught exception " << e.what() << endl;
+ ++result;
+ }
+
try {
result += time_lw_M1();
} catch (const exception &e) {
unsigned time_lw_F();
unsigned time_lw_G();
unsigned time_lw_H();
+unsigned time_lw_IJKL();
unsigned time_lw_M1();
unsigned time_lw_O();
unsigned time_lw_P();
(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 O1 (three 15x15 dets)