]> www.ginac.de Git - ginac.git/blobdiff - ginac/normal.cpp
Fix the compliation error *for real* ... and restore performance
[ginac.git] / ginac / normal.cpp
index 8f5ba73f03308c3daabaf7a9c2f55491250f1362..2a251a780704fdfb66ed96dc0befcf93567dc84b 100644 (file)
@@ -6,7 +6,7 @@
  *  computation, square-free factorization and rational function normalization. */
 
 /*
- *  GiNaC Copyright (C) 1999-2008 Johannes Gutenberg University Mainz, Germany
+ *  GiNaC Copyright (C) 1999-2009 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
@@ -23,9 +23,6 @@
  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
-#include <algorithm>
-#include <map>
-
 #include "normal.h"
 #include "basic.h"
 #include "ex.h"
 #include "pseries.h"
 #include "symbol.h"
 #include "utils.h"
+#include "polynomial/chinrem_gcd.h"
+
+#include <algorithm>
+#include <map>
 
 namespace GiNaC {
 
@@ -1623,8 +1624,15 @@ ex gcd(const ex &a, const ex &b, ex *ca, ex *cb, bool check_args, unsigned optio
                }
 #endif
        }
+       if (options & gcd_options::use_sr_gcd) {
+               g = sr_gcd(aex, bex, var);
+       } else {
+               exvector vars;
+               for (std::size_t n = sym_stats.size(); n-- != 0; )
+                       vars.push_back(sym_stats[n].sym);
+               g = chinrem_gcd(aex, bex, vars);
+       }
 
-       g = sr_gcd(aex, bex, var);
        if (g.is_equal(_ex1)) {
                // Keep cofactors factored if possible
                if (ca)