diff --git a/src/math/lp/numeric_pair.h b/src/math/lp/numeric_pair.h index 4a60c82ca9e..a64825cd8f1 100644 --- a/src/math/lp/numeric_pair.h +++ b/src/math/lp/numeric_pair.h @@ -112,18 +112,6 @@ struct convert_struct { }; -template <> -struct convert_struct { - static double convert(const mpq & q) {return q.get_double();} -}; - - -template <> -struct convert_struct { - static mpq convert(unsigned q) {return mpq(q);} -}; - - template struct numeric_pair { @@ -308,71 +296,8 @@ class numeric_traits> { } }; -template <> -struct convert_struct> { - static double convert(const numeric_pair & q) {return q.x;} -}; - typedef numeric_pair impq; - -template -struct convert_struct, double> { - static numeric_pair convert(const double & q) { - return numeric_pair(convert_struct::convert(q), numeric_traits::zero()); - } - static bool below_bound_numeric(const numeric_pair &, const numeric_pair &, const double &) { - // lp_unreachable(); - return false; - } - static bool above_bound_numeric(const numeric_pair &, const numeric_pair &, const double &) { - // lp_unreachable(); - return false; - } -}; -template <> -struct convert_struct, double> { - static numeric_pair convert(const double & q) { - return numeric_pair(q, 0.0); - } - - static int compare_on_coord(const double & x, const double & bound, const double eps) { - if (bound == 0) return (x < - eps)? -1: (x > eps? 1 : 0); // it is an important special case - double relative = (bound > 0)? - eps: eps; - return (x < bound * (1.0 + relative) - eps)? -1 : ((x > bound * (1.0 - relative) + eps)? 1 : 0); - } - - static bool below_bound_numeric(const numeric_pair & x, const numeric_pair & bound, const double & eps) { - int r = compare_on_coord(x.x, bound.x, eps); - if (r == 1) return false; - if (r == -1) return true; - // the first coordinates are almost the same - return compare_on_coord(x.y, bound.y, eps) == -1; - } - - static bool above_bound_numeric(const numeric_pair & x, const numeric_pair & bound, const double & eps) { - int r = compare_on_coord(x.x, bound.x, eps); - if (r == -1) return false; - if (r == 1) return true; - // the first coordinates are almost the same - return compare_on_coord(x.y, bound.y, eps) == 1; - } -}; - -template <> -struct convert_struct { - static double convert(const double & y){ return y;} - static bool below_bound_numeric(const double & x, const double & bound, const double & eps) { - if (bound == 0) return x < - eps; - double relative = (bound > 0)? - eps: eps; - return x < bound * (1.0 + relative) - eps; - } - static bool above_bound_numeric(const double & x, const double & bound, const double & eps) { - if (bound == 0) return x > eps; - double relative = (bound > 0)? eps: - eps; - return x > bound * (1.0 + relative) + eps; - } -}; template bool below_bound_numeric(const X & x, const X & bound, const double& eps) { return convert_struct::below_bound_numeric(x, bound, eps);} template bool above_bound_numeric(const X & x, const X & bound, const double& eps) { return convert_struct::above_bound_numeric(x, bound, eps);} template T floor(const numeric_pair & r) {