]> www.ginac.de Git - ginac.git/blob - ginac/polynomial/gcd_uvar.cpp
Improve method of setting status_flags::dynallocated.
[ginac.git] / ginac / polynomial / gcd_uvar.cpp
1 /** @file gcd_uvar.cpp
2  *
3  *  Several GCD algorithms. */
4
5 /*
6  *  GiNaC Copyright (C) 1999-2015 Johannes Gutenberg University Mainz, Germany
7  *
8  *  This program is free software; you can redistribute it and/or modify
9  *  it under the terms of the GNU General Public License as published by
10  *  the Free Software Foundation; either version 2 of the License, or
11  *  (at your option) any later version.
12  *
13  *  This program is distributed in the hope that it will be useful,
14  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  *  GNU General Public License for more details.
17  *
18  *  You should have received a copy of the GNU General Public License
19  *  along with this program; if not, write to the Free Software
20  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
21  */
22
23 #include "upoly.h"
24 #include "sr_gcd_uvar.h"
25 #include "heur_gcd_uvar.h"
26
27 #include <stdexcept>
28
29 namespace GiNaC {
30
31 upoly sr_gcd(const upoly& a, const upoly& b)
32 {
33         upoly g;
34         bool found = sr_gcd_priv(g, a, b);
35         if (found)
36                 return g;
37
38         throw std::runtime_error("failed to compute gcd");
39 }
40
41 bool heur_gcd_z(upoly& g, const upoly& a, const upoly& b)
42 {
43         return heur_gcd_z_priv(g, a, b);
44 }
45
46 upoly pseudoremainder(const upoly& a, const upoly& b)
47 {
48         upoly r;
49         pseudoremainder(r, a, b);
50         return r;
51
52 }
53
54 } // namespace GiNaC