]> www.ginac.de Git - ginac.git/blob - ginac/polynomial/ring_traits.hpp
Implemented modular GCD algorithm for univariate polynomials.
[ginac.git] / ginac / polynomial / ring_traits.hpp
1 #ifndef GINAC_RING_TRAITS_HPP
2 #define GINAC_RING_TRAITS_HPP
3 #include <cln/integer.h>
4 #include <cln/modinteger.h>
5
6 namespace cln
7 {
8 static inline cln::cl_I div(const cln::cl_I& x, const cln::cl_I& y)
9 {
10         return cln::exquo(x, y);
11 }
12
13 static inline cln::cl_I get_ring_elt(const cln::cl_I& sample, const int val)
14 {
15         return cln::cl_I(val);
16 }
17
18 static inline cln::cl_MI get_ring_elt(const cln::cl_MI& sample, const int val)
19 {
20         return sample.ring()->canonhom(val);
21 }
22
23 template<typename T>
24 static inline T the_one(const T& sample)
25 {
26         return get_ring_elt(sample, 1);
27 }
28
29 } // namespace cln
30
31 #endif // GINAC_RING_TRAITS_HPP
32