X-Git-Url: https://www.ginac.de/ginac.git//ginac.git?p=ginac.git;a=blobdiff_plain;f=ginac%2Fpolynomial%2Fpoly_cra.h;h=7f81a672ce6d61bcaa72e91a3a3bebe652af9417;hp=cbcff7b3945a203594d5d92816c23d99fe4b3c69;hb=8cffcdf13d817a47f217f1a1043317d95969e070;hpb=45b1e47372090352ac5af655b32473df2abab23b diff --git a/ginac/polynomial/poly_cra.h b/ginac/polynomial/poly_cra.h index cbcff7b3..7f81a672 100644 --- a/ginac/polynomial/poly_cra.h +++ b/ginac/polynomial/poly_cra.h @@ -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 #include "smod_helpers.h" -namespace GiNaC -{ +#include + +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