]> www.ginac.de Git - ginac.git/blobdiff - check/check_matrices.cpp
Removed debugging code.
[ginac.git] / check / check_matrices.cpp
index 4a768b90c3406d44dff0ac3a329ca77c4fb24744..91f4b5da4b64ace42691890fbf614f9268d0a467 100644 (file)
@@ -1,9 +1,11 @@
 /** @file check_matrices.cpp
  *
- *  Here we test manipulations on GiNaC's symbolic matrices. */
+ *  Here we test manipulations on GiNaC's symbolic matrices.  They are a
+ *  well-tried resource for cross-checking the underlying symbolic
+ *  manipulations. */
 
 /*
- *  GiNaC Copyright (C) 1999-2000 Johannes Gutenberg University Mainz, Germany
+ *  GiNaC Copyright (C) 1999-2003 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
 
 /* determinants of some sparse symbolic matrices with coefficients in
  * an integral domain. */
-static unsigned integdom_matrix_determinants(void)
+static unsigned integdom_matrix_determinants()
 {
        unsigned result = 0;
        symbol a("a");
        
-       for (unsigned size=3; size<20; ++size) {
+       for (unsigned size=3; size<22; ++size) {
                matrix A(size,size);
                // populate one element in each row:
                for (unsigned r=0; r<size-1; ++r)
@@ -40,8 +42,8 @@ static unsigned integdom_matrix_determinants(void)
                        A.set(size-1,c,A(0,c)-A(size-2,c));
                if (!A.determinant().is_zero()) {
                        clog << "Determinant of " << size << "x" << size << " matrix "
-                                << endl << A << endl
-                                << "was not found to vanish!" << endl;
+                            << endl << A << endl
+                            << "was not found to vanish!" << endl;
                        ++result;
                }
        }
@@ -51,12 +53,12 @@ static unsigned integdom_matrix_determinants(void)
 
 /* determinants of some symbolic matrices with multivariate rational function
  * coefficients. */
-static unsigned rational_matrix_determinants(void)
+static unsigned rational_matrix_determinants()
 {
        unsigned result = 0;
        symbol a("a"), b("b"), c("c");
        
-       for (unsigned size=3; size<8; ++size) {
+       for (unsigned size=3; size<9; ++size) {
                matrix A(size,size);
                for (unsigned r=0; r<size-1; ++r) {
                        // populate one or two elements in each row:
@@ -75,8 +77,8 @@ static unsigned rational_matrix_determinants(void)
                        A.set(size-1,co,A(0,co)-A(size-2,co));
                if (!A.determinant().is_zero()) {
                        clog << "Determinant of " << size << "x" << size << " matrix "
-                                << endl << A << endl
-                                << "was not found to vanish!" << endl;
+                            << endl << A << endl
+                            << "was not found to vanish!" << endl;
                        ++result;
                }
        }
@@ -85,12 +87,12 @@ static unsigned rational_matrix_determinants(void)
 }
 
 /* Some quite funny determinants with functions and stuff like that inside. */
-static unsigned funny_matrix_determinants(void)
+static unsigned funny_matrix_determinants()
 {
        unsigned result = 0;
        symbol a("a"), b("b"), c("c");
        
-       for (unsigned size=3; size<7; ++size) {
+       for (unsigned size=3; size<8; ++size) {
                matrix A(size,size);
                for (unsigned co=0; co<size-1; ++co) {
                        // populate one or two elements in each row:
@@ -109,8 +111,8 @@ static unsigned funny_matrix_determinants(void)
                        A.set(ro,size-1,A(ro,0)-A(ro,size-2));
                if (!A.determinant().is_zero()) {
                        clog << "Determinant of " << size << "x" << size << " matrix "
-                                << endl << A << endl
-                                << "was not found to vanish!" << endl;
+                            << endl << A << endl
+                            << "was not found to vanish!" << endl;
                        ++result;
                }
        }
@@ -119,12 +121,12 @@ static unsigned funny_matrix_determinants(void)
 }
 
 /* compare results from different determinant algorithms.*/
-static unsigned compare_matrix_determinants(void)
+static unsigned compare_matrix_determinants()
 {
        unsigned result = 0;
        symbol a("a");
        
-       for (unsigned size=2; size<7; ++size) {
+       for (unsigned size=2; size<8; ++size) {
                matrix A(size,size);
                for (unsigned co=0; co<size; ++co) {
                        for (unsigned ro=0; ro<size; ++ro) {
@@ -143,12 +145,12 @@ static unsigned compare_matrix_determinants(void)
                        (det_bareiss-det_laplace).normal() != 0 ||
                        (det_divfree-det_laplace).normal() != 0) {
                        clog << "Determinant of " << size << "x" << size << " matrix "
-                                << endl << A << endl
-                                << "is inconsistent between different algorithms:" << endl
-                                << "Gauss elimination:   " << det_gauss << endl
-                                << "Minor elimination:   " << det_laplace << endl
-                                << "Division-free elim.: " << det_divfree << endl
-                                << "Fraction-free elim.: " << det_bareiss << endl;
+                            << endl << A << endl
+                            << "is inconsistent between different algorithms:" << endl
+                            << "Gauss elimination:   " << det_gauss << endl
+                            << "Minor elimination:   " << det_laplace << endl
+                            << "Division-free elim.: " << det_divfree << endl
+                            << "Fraction-free elim.: " << det_bareiss << endl;
                        ++result;
                }
        }
@@ -156,12 +158,12 @@ static unsigned compare_matrix_determinants(void)
        return result;
 }
 
-static unsigned symbolic_matrix_inverse(void)
+static unsigned symbolic_matrix_inverse()
 {
        unsigned result = 0;
        symbol a("a"), b("b"), c("c");
        
-       for (unsigned size=2; size<5; ++size) {
+       for (unsigned size=2; size<6; ++size) {
                matrix A(size,size);
                do {
                        for (unsigned co=0; co<size; ++co) {
@@ -183,9 +185,9 @@ static unsigned symbolic_matrix_inverse(void)
                                        ok = false;
                if (!ok) {
                        clog << "Inverse of " << size << "x" << size << " matrix "
-                                << endl << A << endl
-                                << "erroneously returned: "
-                                << endl << B << endl;
+                            << endl << A << endl
+                            << "erroneously returned: "
+                            << endl << B << endl;
                        ++result;
                }
        }
@@ -193,7 +195,7 @@ static unsigned symbolic_matrix_inverse(void)
        return result;
 }
 
-unsigned check_matrices(void)
+unsigned check_matrices()
 {
        unsigned result = 0;