]> www.ginac.de Git - ginac.git/commitdiff
- added test O1 from Lewis-Wester paper.
authorRichard Kreckel <Richard.Kreckel@uni-mainz.de>
Sun, 26 Mar 2000 18:45:39 +0000 (18:45 +0000)
committerRichard Kreckel <Richard.Kreckel@uni-mainz.de>
Sun, 26 Mar 2000 18:45:39 +0000 (18:45 +0000)
- corrected a thinko in computing the time.

16 files changed:
check/Makefile.am
check/Makefile.in
check/time_lw_A.cpp
check/time_lw_B.cpp
check/time_lw_C.cpp
check/time_lw_D.cpp
check/time_lw_E.cpp
check/time_lw_F.cpp
check/time_lw_G.cpp
check/time_lw_H.cpp
check/time_lw_O.cpp [new file with mode: 0644]
check/time_lw_P.cpp
check/time_lw_Pprime.cpp
check/times.cpp
check/times.h
check/times.ref

index 1fcec8ad2fc9164f4426ec45465f44d9c54da418..a877fdb5f335af9bf642a3e1ae019a649666877f 100644 (file)
@@ -12,7 +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_P.cpp time_lw_Pprime.cpp timer.cpp times.cpp times.h
+  time_lw_H.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 7ffe01e9be055b2044ce1d4900b6a88c014c5e4e..3a7cd3b62de837bfdb62201203161457f995dc3c 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_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_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
@@ -137,8 +137,8 @@ checks_DEPENDENCIES =  ../ginac/libginac.la
 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_P.o \
-time_lw_Pprime.o timer.o times.o
+time_lw_D.o time_lw_E.o time_lw_F.o time_lw_G.o time_lw_H.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,7 +167,7 @@ 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_P.P \
+.deps/time_lw_G.P .deps/time_lw_H.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)
index c21bcede0f31252e0b14fef747f8233bd5ccffc0..2fa40c92b1e1fe928edf14daecb2de3ff431155e 100644 (file)
@@ -39,7 +39,7 @@ static unsigned test(void)
 unsigned time_lw_A(void)
 {
     unsigned result = 0;
-    unsigned count = 1;
+    unsigned count = 0;
     timer rolex;
     double time = .0;
     
index 00bbc00a1659c8fba79db90aea0e74a4297e3384..3431203d6ee47f2c36e6fd27acd56611e036cfd1 100644 (file)
@@ -40,7 +40,7 @@ static unsigned test(void)
 unsigned time_lw_B(void)
 {
     unsigned result = 0;
-    unsigned count = 1;
+    unsigned count = 0;
     timer rolex;
     double time = .0;
     
index dbb128ddb255352f22aed47f6a87f6a2a7c62dcd..8885d8701ac1c35369372547408d888a4630ac1a 100644 (file)
@@ -44,7 +44,7 @@ static unsigned test(void)
 unsigned time_lw_C(void)
 {
     unsigned result = 0;
-    unsigned count = 1;
+    unsigned count = 0;
     timer rolex;
     double time = .0;
     
index abd0abe62fb44ff6db5936513800d6131dc8622d..092d5cc981c12912a9f125a4c41889ec6a4ad3b6 100644 (file)
@@ -42,7 +42,7 @@ static unsigned test(void)
 unsigned time_lw_D(void)
 {
     unsigned result = 0;
-    unsigned count = 1;
+    unsigned count = 0;
     timer rolex;
     double time = .0;
     
index dfeac7d622a7a02c57e9d519dab0aeda66fa434b..934d52b5049a90ccb1645c4f2b66bbac266a6c08 100644 (file)
@@ -42,7 +42,7 @@ static unsigned test(void)
 unsigned time_lw_E(void)
 {
     unsigned result = 0;
-    unsigned count = 1;
+    unsigned count = 0;
     timer rolex;
     double time = .0;
     
index 49d0d636112a695255903a244a2b2d355a14ab1e..ce8920e5136a218a3fa43fa070abbf2feff86d83 100644 (file)
@@ -41,7 +41,7 @@ static unsigned test(void)
 unsigned time_lw_F(void)
 {
     unsigned result = 0;
-    unsigned count = 1;
+    unsigned count = 0;
     timer rolex;
     double time = .0;
     
index 771b4372560286af7c0dd48c449d9821270011ef..75dd42610a8718792e328048afc2d1b022902852 100644 (file)
@@ -44,7 +44,7 @@ static unsigned test(void)
 unsigned time_lw_G(void)
 {
     unsigned result = 0;
-    unsigned count = 1;
+    unsigned count = 0;
     timer rolex;
     double time = .0;
     
index 1bbe19d9e0d2ab21e23bd6bdf1fae50fafc6ee1d..a7c5c852ddbe149e04a0f49978f3eb7dbfa48d05 100644 (file)
@@ -42,7 +42,7 @@ static unsigned test(void)
 unsigned time_lw_H(void)
 {
     unsigned result = 0;
-    unsigned count = 1;
+    unsigned count = 0;
     timer rolex;
     double time = .0;
     
diff --git a/check/time_lw_O.cpp b/check/time_lw_O.cpp
new file mode 100644 (file)
index 0000000..c6af8c8
--- /dev/null
@@ -0,0 +1,127 @@
+/** @file time_lw_O.cpp
+ *
+ *  Test O1 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 test1(void)
+{
+    symbol a1("a1"), a2("a2"), a3("a3"), a4("a4"), a5("a5"), a6("a6");
+    symbol b1("b1"), b2("b2"), b3("b3"), b4("b4"), b5("b5"), b6("b6");
+    symbol c1("c1"), c2("c2"), c3("c3"), c4("c4"), c5("c5"), c6("c6");
+    ex w1[15][15] = {
+        {a6, a5, a4, a3, a2, a1, 0,  0,  0,  0,  0,  0,  0,  0,  0 },
+        {0,  0,  a6, 0,  a5, a4, 0,  a3, a2, a1, 0,  0,  0,  0,  0 },
+        {0,  a6, 0,  a5, a4, 0,  a3, a2, a1, 0,  0,  0,  0,  0,  0 },
+        {0,  0,  0,  a6, 0,  0,  a5, a4, 0,  0,  a3, a2, a1, 0,  0 },
+        {0,  0,  0,  0,  a6, 0,  0,  a5, a4, 0,  0,  a3, a2, a1, 0 },
+        {0,  0,  0,  0,  0,  a6, 0,  0,  a5, a4, 0,  0,  a3, a2, a1},
+        {0,  0,  0,  b6, 0,  0,  b5, b4, 0,  0,  b3, b2, b1, 0,  0 },
+        {0,  0,  0,  0,  b6, 0,  0,  b5, b4, 0,  0,  b3, b2, b1, 0 },
+        {0,  b6, 0,  b5, b4, 0,  b3, b2, b1, 0,  0,  0,  0,  0,  0 },
+        {0,  0,  b6, 0,  b5, b4, 0,  b3, b2, b1, 0,  0,  0,  0,  0 },
+        {0,  0,  0,  0,  0,  b6, 0,  0,  b5, b4, 0,  0,  b3, b2, b1},
+        {0,  0,  0,  0,  0,  c6, 0,  0,  c5, c4, 0,  0,  c3, c2, c1},
+        {0,  0,  c6, 0,  c5, c4, 0,  c3, c2, c1, 0,  0,  0,  0,  0 },
+        {0,  c6, 0,  c5, c4, 0,  c3, c2, c1, 0,  0,  0,  0,  0,  0 },
+        {0,  0,  0,  0,  c6, 0,  0,  c5, c4, 0,  0,  c3, c2, c1, 0 }
+    };
+    ex w2[15][15] = {
+        {b6, b5, b4, b3, b2, b1, 0,  0,  0,  0,  0,  0,  0,  0,  0 },
+        {0,  0,  b6, 0,  b5, b4, 0,  b3, b2, b1, 0,  0,  0,  0,  0 },
+        {0,  b6, 0,  b5, b4, 0,  b3, b2, b1, 0,  0,  0,  0,  0,  0 },
+        {0,  0,  0,  b6, 0,  0,  b5, b4, 0,  0,  b3, b2, b1, 0,  0 },
+        {0,  0,  0,  0,  b6, 0,  0,  b5, b4, 0,  0,  b3, b2, b1, 0 },
+        {0,  0,  0,  0,  0,  b6, 0,  0,  b5, b4, 0,  0,  b3, b2, b1},
+        {0,  0,  0,  c6, 0,  0,  c5, c4, 0,  0,  c3, c2, c1, 0,  0 },
+        {0,  0,  0,  0,  c6, 0,  0,  c5, c4, 0,  0,  c3, c2, c1, 0 },
+        {0,  c6, 0,  c5, c4, 0,  c3, c2, c1, 0,  0,  0,  0,  0,  0 },
+        {0,  0,  c6, 0,  c5, c4, 0,  c3, c2, c1, 0,  0,  0,  0,  0 },
+        {0,  0,  0,  0,  0,  c6, 0,  0,  c5, c4, 0,  0,  c3, c2, c1},
+        {0,  0,  0,  0,  0,  a6, 0,  0,  a5, a4, 0,  0,  a3, a2, a1},
+        {0,  0,  a6, 0,  a5, a4, 0,  a3, a2, a1, 0,  0,  0,  0,  0 },
+        {0,  a6, 0,  a5, a4, 0,  a3, a2, a1, 0,  0,  0,  0,  0,  0 },
+        {0,  0,  0,  0,  a6, 0,  0,  a5, a4, 0,  0,  a3, a2, a1, 0 }
+    };
+    ex w3[15][15] = {
+        {c6, c5, c4, c3, c2, c1, 0,  0,  0,  0,  0,  0,  0,  0,  0 },
+        {0,  0,  c6, 0,  c5, c4, 0,  c3, c2, c1, 0,  0,  0,  0,  0 },
+        {0,  c6, 0,  c5, c4, 0,  c3, c2, c1, 0,  0,  0,  0,  0,  0 },
+        {0,  0,  0,  c6, 0,  0,  c5, c4, 0,  0,  c3, c2, c1, 0,  0 },
+        {0,  0,  0,  0,  c6, 0,  0,  c5, c4, 0,  0,  c3, c2, c1, 0 },
+        {0,  0,  0,  0,  0,  c6, 0,  0,  c5, c4, 0,  0,  c3, c2, c1},
+        {0,  0,  0,  a6, 0,  0,  a5, a4, 0,  0,  a3, a2, a1, 0,  0 },
+        {0,  0,  0,  0,  a6, 0,  0,  a5, a4, 0,  0,  a3, a2, a1, 0 },
+        {0,  a6, 0,  a5, a4, 0,  a3, a2, a1, 0,  0,  0,  0,  0,  0 },
+        {0,  0,  a6, 0,  a5, a4, 0,  a3, a2, a1, 0,  0,  0,  0,  0 },
+        {0,  0,  0,  0,  0,  a6, 0,  0,  a5, a4, 0,  0,  a3, a2, a1},
+        {0,  0,  0,  0,  0,  b6, 0,  0,  b5, b4, 0,  0,  b3, b2, b1},
+        {0,  0,  b6, 0,  b5, b4, 0,  b3, b2, b1, 0,  0,  0,  0,  0 },
+        {0,  b6, 0,  b5, b4, 0,  b3, b2, b1, 0,  0,  0,  0,  0,  0 },
+        {0,  0,  0,  0,  b6, 0,  0,  b5, b4, 0,  0,  b3, b2, b1, 0 }
+    };
+    matrix d1(15,15), d2(15,15), d3(15,15);
+    for (unsigned r=0; r<15; ++r) {
+        for (unsigned c=0; c<15; ++c) {
+            d1.set(r,c,w1[r][c]);
+            d2.set(r,c,w2[r][c]);
+            d3.set(r,c,w3[r][c]);
+        }
+    }
+    unsigned nops1 = nops(d1.determinant());  cout << '.' << flush;
+    unsigned nops2 = nops(d2.determinant());  cout << '.' << flush;
+    unsigned nops3 = nops(d3.determinant());  cout << '.' << flush;
+    
+    if ((nops1 != 37490) || (nops2 != 37490) || (nops3 != 37490)) {
+        clog << "Determinant from van der Waerden's example were miscalculated" << endl;
+        return 1;
+    }
+    return 0;
+}
+
+unsigned time_lw_O(void)
+{
+    unsigned result = 0;
+    unsigned count = 0;
+    timer rolex;
+    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:
+    do {
+        result = test1();
+        ++count;
+    } while ((time=rolex.read())<0.1 && !result);
+    
+    if (!result) {
+        cout << " passed ";
+        clog << "(no output)" << endl;
+    } else {
+        cout << " failed ";
+    }
+    cout << int(1000*(time/(3*count)))*0.001 << "s (average)" << endl;
+    
+    return result;
+}
index 37772ef104a1fdcbce5078518205a3c18cb506ee..3145093ae2a016eea9405ccd705c58152fc12ca4 100644 (file)
@@ -46,7 +46,7 @@ static unsigned test(void)
 unsigned time_lw_P(void)
 {
     unsigned result = 0;
-    unsigned count = 1;
+    unsigned count = 0;
     timer rolex;
     double time = .0;
     
index 88854b29ff552d3d4222e12bc27aad44306dc86c..5fb670da64ebaec4da19b173b2ed68927db38557 100644 (file)
@@ -61,7 +61,7 @@ static unsigned test(void)
 unsigned time_lw_Pprime(void)
 {
     unsigned result = 0;
-    unsigned count = 1;
+    unsigned count = 0;
     timer rolex;
     double time = .0;
     
index 65ca3baffc4467411841bd5ab74c3371cd1656cd..5628aa4cfb64cd502c3f5e0d209bdaf828115b50 100644 (file)
@@ -125,6 +125,14 @@ int main()
         ++result;
     }
     
+    try {
+        for (int i=0; i<1; ++i)
+            result += time_lw_O();
+    } catch (const exception &e) {
+        cout << "Error: caught exception " << e.what() << endl;
+        ++result;
+    }
+    
     try {
         for (int i=0; i<1; ++i)
             result += time_lw_P();
index c4919751cd761d0c0247912c7ce1e78ce523da31..26a33552f50b6be94acbb0e0c0d82c9966f05ec7 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_O();
 unsigned time_lw_P();
 unsigned time_lw_Pprime();
 
index 074fbdf80db3837feebc5dfd16919c427d7f4a51..1ae35418c3e90a41bbe228693dbf45f44a0b3227 100644 (file)
@@ -22,6 +22,8 @@
 (no output)
 -------Lewis-Wester test H (det of 80x80 Hilbert)
 (no output)
+-------Lewis-Wester test O1 (three 15x15 dets)
+(no output)
 -------Lewis-Wester test P (det of sparse rank 101)
 (no output)
 -------Lewis-Wester test P' (det of less sparse rank 101)