]> www.ginac.de Git - ginac.git/commitdiff
- New tests from the Lewis-Wester Paper: I, J, K and L.
authorRichard Kreckel <Richard.Kreckel@uni-mainz.de>
Tue, 28 Mar 2000 00:51:17 +0000 (00:51 +0000)
committerRichard Kreckel <Richard.Kreckel@uni-mainz.de>
Tue, 28 Mar 2000 00:51:17 +0000 (00:51 +0000)
check/Makefile.am
check/Makefile.in
check/time_dennyfliegner.cpp
check/time_lw_IJKL.cpp [new file with mode: 0644]
check/times.cpp
check/times.h
check/times.ref

index 7b24a57837771d369b181a4d67b851b5125b19d7..7083c694e850303deeeadd510ed722a6b3c85f91 100644 (file)
@@ -12,8 +12,8 @@ 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
+  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
index b3f8dd5b2391f8de46d0a5d8e42f1690dfdae5b1..ab8c531a6ad6e1b493f9e8b37fd86bc958438650 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 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
@@ -138,7 +138,8 @@ checks_LDFLAGS =
 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@
@@ -167,10 +168,10 @@ DEP_FILES =  .deps/check_inifcns.P .deps/check_lsolve.P \
 .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)
 
index 591e7a4f6f4719bf853e3e12c33c0cee272f7786..0d787853b506307db518b942f2536b41c9e76f79 100644 (file)
@@ -62,7 +62,7 @@ unsigned time_dennyfliegner(void)
     
     vector<unsigned> sizes;
     vector<double> times;
-    timer rolex;
+    timer breitling;
     
     sizes.push_back(25);
     sizes.push_back(50);
@@ -70,9 +70,9 @@ unsigned time_dennyfliegner(void)
     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;
     }
     
diff --git a/check/time_lw_IJKL.cpp b/check/time_lw_IJKL.cpp
new file mode 100644 (file)
index 0000000..62f69b6
--- /dev/null
@@ -0,0 +1,92 @@
+/** @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;
+}
index f5642862b47f678edba343d9b5c0bde8b1db0a34..0d0007ec04ca57fb3ec2a396b99910e703767743 100644 (file)
@@ -113,6 +113,13 @@ int main()
         ++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) {
index 24cfc77670af633fc96253978197cc3153e68fc3..a49c0f41bb84e50b6ef5f7025a4bd4af3c248a02 100644 (file)
@@ -59,6 +59,7 @@ 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_O();
 unsigned time_lw_P();
index d47cb6d30df698f03fb30ac28e0251870fe00bd5..54827f06dc6c7179d8d579442f6417ca23889f42 100644 (file)
 (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)