]> www.ginac.de Git - ginac.git/blobdiff - check/check_inifcns.cpp
Rewritten heuristic and PRS GCD for univariate polynomials, added benchmark.
[ginac.git] / check / check_inifcns.cpp
index b5945d2e15cca0124fded728120d6cebee96965a..9d493290b5ee854e254e053398ec28d6fa4fe2cf 100644 (file)
@@ -4,7 +4,7 @@
  *  functions. */
 
 /*
- *  GiNaC Copyright (C) 1999-2001 Johannes Gutenberg University Mainz, Germany
+ *  GiNaC Copyright (C) 1999-2008 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
  *
  *  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
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
-#include "checks.h"
+#include <iostream>
+#include <cstdlib> // rand()
+#include "ginac.h"
+using namespace std;
+using namespace GiNaC;
 
 /* Some tests on the sine trigonometric function. */
-static unsigned inifcns_check_sin(void)
+static unsigned inifcns_check_sin()
 {
        unsigned result = 0;
        bool errorflag = false;
@@ -79,7 +83,7 @@ static unsigned inifcns_check_sin(void)
 }
 
 /* Simple tests on the cosine trigonometric function. */
-static unsigned inifcns_check_cos(void)
+static unsigned inifcns_check_cos()
 {
        unsigned result = 0;
        bool errorflag;
@@ -133,7 +137,7 @@ static unsigned inifcns_check_cos(void)
 }
 
 /* Simple tests on the tangent trigonometric function. */
-static unsigned inifcns_check_tan(void)
+static unsigned inifcns_check_tan()
 {
        unsigned result = 0;
        bool errorflag;
@@ -162,7 +166,7 @@ static unsigned inifcns_check_tan(void)
 }
 
 /* Simple tests on the dilogarithm function. */
-static unsigned inifcns_check_Li2(void)
+static unsigned inifcns_check_Li2()
 {
        // NOTE: this can safely be removed once CLN supports dilogarithms and
        // checks them itself.
@@ -178,7 +182,7 @@ static unsigned inifcns_check_Li2(void)
                argument = numeric(20.0*rand()/(RAND_MAX+1.0)-10.0)
                         + numeric(20.0*rand()/(RAND_MAX+1.0)-10.0)*I;
                if (abs(Li2(pow(argument,2))-2*Li2(argument)-2*Li2(-argument)) > epsilon) {
-                       cout << "Li2(z) at z==" << argument
+                       clog << "Li2(z) at z==" << argument
                             << " failed to satisfy Li2(z^2)==2*(Li2(z)+Li2(-z))" << endl;
                        errorflag = true;
                }
@@ -190,24 +194,21 @@ static unsigned inifcns_check_Li2(void)
        return result;
 }
 
-unsigned check_inifcns(void)
+unsigned check_inifcns()
 {
        unsigned result = 0;
 
        cout << "checking consistency of symbolic functions" << flush;
-       clog << "---------consistency of symbolic functions:" << endl;
        
        result += inifcns_check_sin();  cout << '.' << flush;
        result += inifcns_check_cos();  cout << '.' << flush;
        result += inifcns_check_tan();  cout << '.' << flush;
        result += inifcns_check_Li2();  cout << '.' << flush;
        
-       if (!result) {
-               cout << " passed " << endl;
-               clog << "(no output)" << endl;
-       } else {
-               cout << " failed " << endl;
-       }
-       
        return result;
 }
+
+int main(int argc, char** argv)
+{
+       return check_inifcns();
+}