]> www.ginac.de Git - ginac.git/blobdiff - ginac/polynomial/poly_cra.h
Happy New Year!
[ginac.git] / ginac / polynomial / poly_cra.h
index cbcff7b3945a203594d5d92816c23d99fe4b3c69..7f81a672ce6d61bcaa72e91a3a3bebe652af9417 100644 (file)
@@ -1,11 +1,34 @@
+/** @file poly_cra.h
+ *
+ *  Chinese remainder algorithm. */
+
+/*
+ *  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
+ */
+
 #ifndef GINAC_POLY_CRA_H
 #define GINAC_POLY_CRA_H
+
 #include "ex.h"
-#include <cln/integer.h>
 #include "smod_helpers.h"
 
-namespace GiNaC
-{
+#include <cln/integer.h>
+
+namespace GiNaC {
 
 /**
  * @brief Chinese reamainder algorithm for polynomials.
@@ -28,11 +51,10 @@ ex chinese_remainder(const ex& e1, const cln::cl_I& q1,
        ex v2 = (e2.smod(q2n) - v1.smod(q2n)).expand().smod(q2n);
        const numeric q1_1(recip(q1, q2)); // 1/q_1 mod q_2
        v2 = (v2*q1_1).smod(q2n);
-       ex ret = (v1 + v2*q1_1).expand();
+       ex ret = (v1 + v2*q1n).expand();
        return ret;
 }
 
 } // namespace GiNaC
 
-#endif /* GINAC_POLY_CRA_H */
-
+#endif // ndef GINAC_POLY_CRA_H