]> www.ginac.de Git - ginac.git/blobdiff - check/time_toeplitz.cpp
Use initializer lists to construct container<>, lst.
[ginac.git] / check / time_toeplitz.cpp
index 9bf569ab7d6b35ad7c8f00a5a7b080aaf90b094b..bb8a1c15fc769804771797b3ab1d43298a25c1ed 100644 (file)
@@ -6,7 +6,7 @@
  */
 
 /*
- *  GiNaC Copyright (C) 1999-2007 Johannes Gutenberg University Mainz, Germany
+ *  GiNaC Copyright (C) 1999-2015 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
  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
-#include "times.h"
+#include "ginac.h"
+#include "timer.h"
+using namespace GiNaC;
+
+#include <iostream>
+#include <vector>
+using namespace std;
 
 static unsigned toeplitz_det(unsigned size)
 {
        unsigned result = 0;
        const symbol a("a"), b("b");
-       ex p[10] = {ex("a",lst(a,b)),
-                  ex("b",lst(a,b)),
-                  ex("a+b",lst(a,b)),
-                  ex("a^2+a*b+b^2",lst(a,b)),
-                  ex("a^3+a^2*b-a*b^2+b^3",lst(a,b)),
-                  ex("a^4+a^3*b+a^2*b^2+a*b^3+b^4",lst(a,b)),
-                  ex("a^5+a^4*b+a^3*b^2-a^2*b^3+a*b^4+b^5",lst(a,b)),
-                  ex("a^6+a^5*b+a^4*b^2+a^3*b^3+a^2*b^4+a*b^5+b^6",lst(a,b)),
-                  ex("a^7+a^6*b+a^5*b^2+a^4*b^3-a^3*b^4+a^2*b^5+a*b^6+b^7",lst(a,b)),
-                  ex("a^8+a^7*b+a^6*b^2+a^5*b^3+a^4*b^4+a^3*b^5+a^2*b^6+a*b^7+b^8",lst(a,b))
+       ex p[10] = {ex("a",lst{a,b}),
+                  ex("b",lst{a,b}),
+                  ex("a+b",lst{a,b}),
+                  ex("a^2+a*b+b^2",lst{a,b}),
+                  ex("a^3+a^2*b-a*b^2+b^3",lst{a,b}),
+                  ex("a^4+a^3*b+a^2*b^2+a*b^3+b^4",lst{a,b}),
+                  ex("a^5+a^4*b+a^3*b^2-a^2*b^3+a*b^4+b^5",lst{a,b}),
+                  ex("a^6+a^5*b+a^4*b^2+a^3*b^3+a^2*b^4+a*b^5+b^6",lst{a,b}),
+                  ex("a^7+a^6*b+a^5*b^2+a^4*b^3-a^3*b^4+a^2*b^5+a*b^6+b^7",lst{a,b}),
+                  ex("a^8+a^7*b+a^6*b^2+a^5*b^3+a^4*b^4+a^3*b^5+a^2*b^6+a*b^7+b^8",lst{a,b})
        };
 
        // construct Toeplitz matrix (diagonal structure: [[x,y,z],[y,x,y],[z,y,x]]):
@@ -69,7 +75,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 +98,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 +109,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();
+}