Fixed a problem in polynomial divide by deactivating a recursion that lead to a
authorJens Vollinga <jensv@balin.nikhef.nl>
Mon, 1 Dec 2008 08:54:53 +0000 (09:54 +0100)
committerJens Vollinga <jensv@balin.nikhef.nl>
Mon, 1 Dec 2008 08:54:53 +0000 (09:54 +0100)
significant slowdown in sqrfree() and sometimes to a infinite loop.

ginac/normal.cpp

index 09773d3..8f5ba73 100644 (file)
@@ -672,12 +672,13 @@ bool divide(const ex &a, const ex &b, ex &q, bool check_args)
                        q = rem_i*power(ab, a_exp - 1);
                        return true;
                }
-               for (int i=2; i < a_exp; i++) {
-                       if (divide(power(ab, i), b, rem_i, false)) {
-                               q = rem_i*power(ab, a_exp - i);
-                               return true;
-                       }
-               } // ... so we *really* need to expand expression.
+// code below is commented-out because it leads to a significant slowdown
+//             for (int i=2; i < a_exp; i++) {
+//                     if (divide(power(ab, i), b, rem_i, false)) {
+//                             q = rem_i*power(ab, a_exp - i);
+//                             return true;
+//                     }
+//             } // ... so we *really* need to expand expression.
        }
        
        // Polynomial long division (recursive)