]> www.ginac.de Git - ginac.git/blobdiff - ginac/polynomial/primpart_content.cpp
Happy New Year!
[ginac.git] / ginac / polynomial / primpart_content.cpp
index fa7f69ba07bf39584a98dc43fc7b231c994d7fd2..2db82588f3a744315a6393f3428cb7ccfbb27678 100644 (file)
@@ -1,3 +1,25 @@
+/** @file primpart_content.cpp
+ *
+ *  Function to find primitive part of a multivariate polynomial. */
+
+/*
+ *  GiNaC Copyright (C) 1999-2019 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
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  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., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
 #include "ex.h"
 #include "numeric.h"
 #include "collect_vargs.h"
@@ -5,8 +27,7 @@
 #include "divide_in_z_p.h"
 #include "debug.h"
 
-namespace GiNaC
-{
+namespace GiNaC {
 
 /**
  * Compute the primitive part and the content of a modular multivariate
@@ -41,13 +62,13 @@ void primpart_content(ex& pp, ex& c, ex e, const exvector& vars,
                // p_1(x_n) p_2(x_0, \ldots, x_{n-1})
                c = ec.rbegin()->second;
                ec.rbegin()->second = ex1;
-               pp = ex_collect_to_ex(ec, vars).expand().smod(numeric(p));
+               pp = ex_collect_to_ex(ec, rest_vars).expand().smod(numeric(p));
                return;
        }
 
        // Start from the leading coefficient (which is stored as a last
        // element of the terms array)
-       ex_collect_t::reverse_iterator i = ec.rbegin();
+       auto i = ec.rbegin();
        ex g = i->second;
        // there are at least two terms, so it's safe to...
        ++i;
@@ -75,4 +96,3 @@ void primpart_content(ex& pp, ex& c, ex e, const exvector& vars,
 }
 
 } // namespace GiNaC
-