]> www.ginac.de Git - ginac.git/commitdiff
- Added some tests from the Lewis-Wester testsuite.
authorRichard Kreckel <Richard.Kreckel@uni-mainz.de>
Sat, 25 Mar 2000 20:35:48 +0000 (20:35 +0000)
committerRichard Kreckel <Richard.Kreckel@uni-mainz.de>
Sat, 25 Mar 2000 20:35:48 +0000 (20:35 +0000)
13 files changed:
check/Makefile.am
check/Makefile.in
check/exam_matrices.cpp
check/time_lw_A.cpp [new file with mode: 0644]
check/time_lw_B.cpp [new file with mode: 0644]
check/time_lw_C.cpp [new file with mode: 0644]
check/time_lw_D.cpp [new file with mode: 0644]
check/time_lw_E.cpp [new file with mode: 0644]
check/time_lw_F.cpp [new file with mode: 0644]
check/time_lw_G.cpp [new file with mode: 0644]
check/time_lw_H.cpp [new file with mode: 0644]
check/times.cpp
check/times.h

index 6b3919f6dec3662f65f01b59c04e424dab014b08..323fde13224b81dd9873222e1162f78414cca8eb 100644 (file)
@@ -10,7 +10,9 @@ 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 timer.cpp times.cpp times.h
+  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 timer.cpp times.cpp times.h
 times_LDADD = ../ginac/libginac.la
 INCLUDES = -I$(srcdir)/../ginac
 CLEANFILES = exams.out checks.out times.out
index 777124a76763dd938021f49e2b99f84bedf638c0..8d5903b7efaaf569f98e0ab01f19429a49264498 100644 (file)
@@ -111,7 +111,7 @@ exams_LDADD = ../ginac/libginac.la
 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 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 timer.cpp times.cpp times.h
 
 times_LDADD = ../ginac/libginac.la
 INCLUDES = -I$(srcdir)/../ginac
@@ -136,7 +136,9 @@ check_lsolve.o genex.o checks.o
 checks_DEPENDENCIES =  ../ginac/libginac.la
 checks_LDFLAGS = 
 times_OBJECTS =  time_dennyfliegner.o time_gammaseries.o \
-time_vandermonde.o time_toeplitz.o timer.o times.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 timer.o \
+times.o
 times_DEPENDENCIES =  ../ginac/libginac.la
 times_LDFLAGS = 
 CXXFLAGS = @CXXFLAGS@
@@ -163,8 +165,10 @@ DEP_FILES =  .deps/check_inifcns.P .deps/check_lsolve.P \
 .deps/exam_normalization.P .deps/exam_numeric.P .deps/exam_paranoia.P \
 .deps/exam_polygcd.P .deps/exam_powerlaws.P .deps/exam_pseries.P \
 .deps/exams.P .deps/genex.P .deps/time_dennyfliegner.P \
-.deps/time_gammaseries.P .deps/time_toeplitz.P .deps/time_vandermonde.P \
-.deps/timer.P .deps/times.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_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)
 
index a27d586ff97e09d7721ad80d7af2830c115a8afe..db61e3e12027bb17235ad3942608cc49ca1b272a 100644 (file)
@@ -74,8 +74,8 @@ static unsigned matrix_determinants(void)
     }
     
     // check dense symbolic 2x2 matrix determinant
-    m2.set(0,0,a/(a-b)).set(0,1,numeric(1));
-    m2.set(1,0,b/(a-b)).set(1,1,numeric(1));
+    m2.set(0,0,a/(a-b)).set(0,1,1);
+    m2.set(1,0,b/(a-b)).set(1,1,1);
     det = m2.determinant();
     if (det != 1) {
         if (det.normal() == 1)  // only half wrong
@@ -86,7 +86,7 @@ static unsigned matrix_determinants(void)
                  << " erroneously returned " << det << endl;
         ++result;
     }
-
+    
     // check sparse symbolic 4x4 matrix determinant
     m4.set(0,1,a).set(1,0,b).set(3,2,c).set(2,3,d);
     det = m4.determinant();
diff --git a/check/time_lw_A.cpp b/check/time_lw_A.cpp
new file mode 100644 (file)
index 0000000..c21bced
--- /dev/null
@@ -0,0 +1,66 @@
+/** @file time_lw_A.cpp
+ *
+ *  Test A 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(void)
+{
+    for (int i=1; i<=99; ++i)
+        factorial(1000+i)/factorial(900+i);
+    ex rat(factorial(1100)/factorial(1000));
+    
+    if (abs(evalf(rat)-numeric(".13280014101512E303"))>numeric("1.0E289")) {
+        clog << "1100!/1000! erroneously returned " << rat << endl;
+        return 1;
+    }
+    return 0;
+}
+
+unsigned time_lw_A(void)
+{
+    unsigned result = 0;
+    unsigned count = 1;
+    timer rolex;
+    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:
+    do {
+        result = test();
+        ++count;
+    } while ((time=rolex.read())<0.1 && !result);
+    cout << '.' << flush;
+    
+    if (!result) {
+        cout << " passed ";
+        clog << "(no output)" << endl;
+    } else {
+        cout << " failed ";
+    }
+    cout << int(1000*(time/count))*0.001 << 's' << endl;
+    
+    return result;
+}
diff --git a/check/time_lw_B.cpp b/check/time_lw_B.cpp
new file mode 100644 (file)
index 0000000..00bbc00
--- /dev/null
@@ -0,0 +1,67 @@
+/** @file time_lw_B.cpp
+ *
+ *  Test B 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(void)
+{
+    numeric s;
+    
+    for (int i=1; i<=1000; ++i)
+        s += numeric(i).inverse();
+    
+    if (abs(s.evalf()-numeric("7.4854708605503449"))>numeric("2.0E-16")) {
+        clog << "sum(1/i,i=1..1000) erroneously returned " << s << endl;
+        return 1;
+    }
+    return 0;
+}
+
+unsigned time_lw_B(void)
+{
+    unsigned result = 0;
+    unsigned count = 1;
+    timer rolex;
+    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:
+    do {
+        result = test();
+        ++count;
+    } while ((time=rolex.read())<0.1 && !result);
+    cout << '.' << flush;
+    
+    if (!result) {
+        cout << " passed ";
+        clog << "(no output)" << endl;
+    } else {
+        cout << " failed ";
+    }
+    cout << int(1000*(time/count))*0.001 << 's' << endl;
+    
+    return result;
+}
diff --git a/check/time_lw_C.cpp b/check/time_lw_C.cpp
new file mode 100644 (file)
index 0000000..dbb128d
--- /dev/null
@@ -0,0 +1,71 @@
+/** @file time_lw_C.cpp
+ *
+ *  Test C 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(void)
+{
+    numeric x(13*17*31);
+    numeric y(13*19*29);
+    
+    for (int i=1; i<200; ++i)
+        gcd(pow(x,300+(i%181)),pow(y,200+(i%183)));
+    
+    ex lastgcd = gcd(pow(x,300+(200%181)),pow(y,200+(200%183)));
+    if (lastgcd != numeric("53174994123961114423610399251974962981084780166115806651505844915220196792416194060680805428433601792982500430324916963290494659936522782673704312949880308677990050199363768068005367578752699785180694630122629259539608472261461289805919741933")) {
+        clog << "gcd(" << x << "^" << 300+(200%181) << ","
+             << y << "^" << 200+(200%183) << ") erroneously returned "
+             << lastgcd << endl;
+        return 1;
+    }
+    return 0;
+}
+
+unsigned time_lw_C(void)
+{
+    unsigned result = 0;
+    unsigned count = 1;
+    timer rolex;
+    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:
+    do {
+        result = test();
+        ++count;
+    } while ((time=rolex.read())<0.1 && !result);
+    cout << '.' << flush;
+    
+    if (!result) {
+        cout << " passed ";
+        clog << "(no output)" << endl;
+    } else {
+        cout << " failed ";
+    }
+    cout << int(1000*(time/count))*0.001 << 's' << endl;
+    
+    return result;
+}
diff --git a/check/time_lw_D.cpp b/check/time_lw_D.cpp
new file mode 100644 (file)
index 0000000..abd0abe
--- /dev/null
@@ -0,0 +1,69 @@
+/** @file time_lw_D.cpp
+ *
+ *  Test D 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(void)
+{
+    ex s;
+    symbol y("y");
+    symbol t("t");
+    
+    for (int i=1; i<=10; ++i)
+        s += i*y*pow(t,i)/pow(y + i*t,i);
+    
+    if (s.nops()!=10) {
+        clog << "something very strange happened" << endl;
+        return 1;
+    }
+    return 0;
+}
+
+unsigned time_lw_D(void)
+{
+    unsigned result = 0;
+    unsigned count = 1;
+    timer rolex;
+    double time = .0;
+    
+    cout << "timing Lewis-Wester test D (sum of rational fcns)" << flush;
+    clog << "-------Lewis-Wester test D (sum of rational fcns)" << endl;
+    
+    rolex.start();
+    // correct for very small times:
+    do {
+        result = test();
+        ++count;
+    } while ((time=rolex.read())<0.1 && !result);
+    cout << '.' << flush;
+    
+    if (!result) {
+        cout << " passed ";
+        clog << "(no output)" << endl;
+    } else {
+        cout << " failed ";
+    }
+    cout << int(1000*(time/count))*0.001 << 's' << endl;
+    
+    return result;
+}
diff --git a/check/time_lw_E.cpp b/check/time_lw_E.cpp
new file mode 100644 (file)
index 0000000..dfeac7d
--- /dev/null
@@ -0,0 +1,69 @@
+/** @file time_lw_E.cpp
+ *
+ *  Test E 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(void)
+{
+    ex s;
+    symbol y("y");
+    symbol t("t");
+    
+    for (int i=1; i<=10; ++i)
+        s += i*y*pow(t,i)/pow(y + abs(5-i)*t,i);
+    
+    if (s.nops()!=10) {
+        clog << "something very strange happened" << endl;
+        return 1;
+    }
+    return 0;
+}
+
+unsigned time_lw_E(void)
+{
+    unsigned result = 0;
+    unsigned count = 1;
+    timer rolex;
+    double time = .0;
+    
+    cout << "timing Lewis-Wester test E (sum of rational fcns)" << flush;
+    clog << "-------Lewis-Wester test E (sum of rational fcns)" << endl;
+    
+    rolex.start();
+    // correct for very small times:
+    do {
+        result = test();
+        ++count;
+    } while ((time=rolex.read())<0.1 && !result);
+    cout << '.' << flush;
+    
+    if (!result) {
+        cout << " passed ";
+        clog << "(no output)" << endl;
+    } else {
+        cout << " failed ";
+    }
+    cout << int(1000*(time/count))*0.001 << 's' << endl;
+    
+    return result;
+}
diff --git a/check/time_lw_F.cpp b/check/time_lw_F.cpp
new file mode 100644 (file)
index 0000000..49d0d63
--- /dev/null
@@ -0,0 +1,68 @@
+/** @file time_lw_F.cpp
+ *
+ *  Test F 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(void)
+{
+    symbol x("x");
+    symbol y("y");
+
+    ex p = expand(pow(pow(x,2)-3*x*y+pow(y,2),4)*pow(3*x-7*y+2,5));
+    ex q = expand(pow(pow(x,2)-3*x*y+pow(y,2),3)*pow(3*x-7*y-2,6));
+    ex result = gcd(p,q);
+    if (result!=expand(pow(pow(x,2)-3*x*y+pow(y,2),3))) {
+        clog << "gcd((x^2-3*x*y+y^2)^4*(3*x-7*y+2)^5),(x^2-3*x*y+y^2)^3*(3*x-7*y-2)^6)) erroneously returned " << result << endl;
+        return 1;
+    }
+    return 0;
+}
+
+unsigned time_lw_F(void)
+{
+    unsigned result = 0;
+    unsigned count = 1;
+    timer rolex;
+    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:
+    do {
+        result = test();
+        ++count;
+    } while ((time=rolex.read())<0.1 && !result);
+    cout << '.' << flush;
+    
+    if (!result) {
+        cout << " passed ";
+        clog << "(no output)" << endl;
+    } else {
+        cout << " failed ";
+    }
+    cout << int(1000*(time/count))*0.001 << 's' << endl;
+    
+    return result;
+}
diff --git a/check/time_lw_G.cpp b/check/time_lw_G.cpp
new file mode 100644 (file)
index 0000000..771b437
--- /dev/null
@@ -0,0 +1,71 @@
+/** @file time_lw_G.cpp
+ *
+ *  Test G 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(void)
+{
+    symbol x("x");
+    symbol y("y");
+    symbol z("z");
+
+    ex p = expand(pow(7*y*pow(x*z,2)-3*x*y*z+11*(x+1)*pow(y,2)+5*z+1,4)
+                  *pow(3*x-7*y+2*z-3,5));
+    ex q = expand(pow(7*y*pow(x*z,2)-3*x*y*z+11*(x+1)*pow(y,2)+5*z+1,3)
+                  *pow(3*x-7*y+2*z+3,6));
+    ex result = gcd(p,q);
+    if (result.expand()!=expand(pow(7*y*pow(x*z,2)-3*x*y*z+11*(x+1)*pow(y,2)+5*z+1,3))) {
+        clog << "gcd(expand((7*y*x^2*z^2-3*x*y*z+11*(x+1)*y^2+5*z+1)^4*(3*x-7*y+2*z-3)^5),expand((7*y*x^2*z^2-3*x*y*z+11*(x+1)*y^2+5*z+1)^3*(3*x-7*y+2*z+3)^6)) erroneously returned " << result << endl;
+        return 1;
+    }
+    return 0;
+}
+
+unsigned time_lw_G(void)
+{
+    unsigned result = 0;
+    unsigned count = 1;
+    timer rolex;
+    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:
+    do {
+        result = test();
+        ++count;
+    } while ((time=rolex.read())<0.1 && !result);
+    cout << '.' << flush;
+    
+    if (!result) {
+        cout << " passed ";
+        clog << "(no output)" << endl;
+    } else {
+        cout << " failed ";
+    }
+    cout << int(1000*(time/count))*0.001 << 's' << endl;
+    
+    return result;
+}
diff --git a/check/time_lw_H.cpp b/check/time_lw_H.cpp
new file mode 100644 (file)
index 0000000..1bbe19d
--- /dev/null
@@ -0,0 +1,69 @@
+/** @file time_lw_H.cpp
+ *
+ *  Test H 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(void)
+{
+    matrix h80(80,80);
+    
+    for (unsigned r=0; r<80; ++r)
+        for (unsigned c=0; c<80; ++c)
+            h80.set(r,c,numeric(1,r+c+1));
+    ex det = h80.determinant();
+    
+    if (abs(det.evalf()-numeric(".10097939769690107E-3789"))>numeric("1.E-3800")) {
+        clog << "determinant of 80x80 erroneously returned " << det << endl;
+        return 1;
+    }
+    return 0;
+}
+
+unsigned time_lw_H(void)
+{
+    unsigned result = 0;
+    unsigned count = 1;
+    timer rolex;
+    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:
+    do {
+        result = test();
+        ++count;
+    } while ((time=rolex.read())<0.1 && !result);
+    cout << '.' << flush;
+    
+    if (!result) {
+        cout << " passed ";
+        clog << "(no output)" << endl;
+    } else {
+        cout << " failed ";
+    }
+    cout << int(1000*(time/count))*0.001 << 's' << endl;
+    
+    return result;
+}
index 5ba754a07866bb76dc2aa64496a0081f19761b75..54f36b83a546360322900fe8d60270584925275e 100644 (file)
@@ -60,7 +60,71 @@ int main()
         cout << "Error: caught exception " << e.what() << endl;
         ++result;
     }
-        
+    
+    try {
+        for (int i=0; i<1; ++i)
+            result += time_lw_A();
+    } catch (const exception &e) {
+        cout << "Error: caught exception " << e.what() << endl;
+        ++result;
+    }
+    
+    try {
+        for (int i=0; i<1; ++i)
+            result += time_lw_B();
+    } catch (const exception &e) {
+        cout << "Error: caught exception " << e.what() << endl;
+        ++result;
+    }
+    
+    try {
+        for (int i=0; i<1; ++i)
+            result += time_lw_C();
+    } catch (const exception &e) {
+        cout << "Error: caught exception " << e.what() << endl;
+        ++result;
+    }
+    
+    try {
+        for (int i=0; i<1; ++i)
+            result += time_lw_D();
+    } catch (const exception &e) {
+        cout << "Error: caught exception " << e.what() << endl;
+        ++result;
+    }
+    
+    try {
+        for (int i=0; i<1; ++i)
+            result += time_lw_E();
+    } catch (const exception &e) {
+        cout << "Error: caught exception " << e.what() << endl;
+        ++result;
+    }
+    
+    try {
+        for (int i=0; i<1; ++i)
+            result += time_lw_F();
+    } catch (const exception &e) {
+        cout << "Error: caught exception " << e.what() << endl;
+        ++result;
+    }
+    
+    try {
+        for (int i=0; i<1; ++i)
+            result += time_lw_G();
+    } catch (const exception &e) {
+        cout << "Error: caught exception " << e.what() << endl;
+        ++result;
+    }
+    
+    try {
+        for (int i=0; i<1; ++i)
+            result += time_lw_H();
+    } catch (const exception &e) {
+        cout << "Error: caught exception " << e.what() << endl;
+        ++result;
+    }
+
     if (result) {
         cout << "Error: something went wrong. ";
         if (result == 1) {
index dec00ace8342e30f1b5dc2c97bcd93501cc35b55..f1fc2e52bd87a1322c75a04aca5246a0b3f3752f 100644 (file)
@@ -51,5 +51,13 @@ unsigned time_dennyfliegner();
 unsigned time_gammaseries();
 unsigned time_vandermonde();
 unsigned time_toeplitz();
+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();
 
 #endif // ndef CHECKS_H