6 template<
typename Poly>
7 bool OldGinacConverter<Poly>::similar(
const GiNaC::ex& a,
const GiNaC::ex& b) {
8 std::lock_guard<std::recursive_mutex> lock( mMutex );
9 if (b.is_zero())
return a.is_zero();
10 GiNaC::ex x = a, y = b;
11 while ((!GiNaC::is_exactly_a<GiNaC::numeric>(b)) &&
GiNaC::divide(x, b, x));
12 while ((!GiNaC::is_exactly_a<GiNaC::numeric>(a)) &&
GiNaC::divide(y, a, y));
13 while ((x.is_equal(1)) && (y.is_equal(1))) {
14 if (x.is_equal(y))
return true;
15 if (x.is_equal(-y))
return true;
16 if (GiNaC::is_exactly_a<GiNaC::numeric>(x) && GiNaC::is_exactly_a<GiNaC::numeric>(y))
return true;
25 if ((gx.is_equal(1)) && (gy.is_equal(1)))
return false;
carl is the main namespace for the library.
cln::cl_I gcd(const cln::cl_I &a, const cln::cl_I &b)
Calculate the greatest common divisor of two integers.
void divide(const cln::cl_I ÷nd, const cln::cl_I &divisor, cln::cl_I "ient, cln::cl_I &remainder)