5 #include "../Settings.h"
15 namespace sample_compare {
28 return carl::bitsize(it->value());
36 if (!it->value().is_numeric())
return 0;
37 if (!carl::is_integer(it->value()))
return 1;
45 template<
typename It,
typename tag,
typename F>
50 SMTRAT_LOG_TRACE(
"smtrat.cad.samplecompare",
"Comparing " << l <<
" < " << r <<
" -> 0");
53 SMTRAT_LOG_TRACE(
"smtrat.cad.samplecompare",
"Comparing " << l <<
" < " << r <<
" ? " << (f(l, r) ? -1 : 1));
54 return f(l, r) ? -1 : 1;
58 bool compare(
const It& lhs,
const It& rhs) {
61 template<
typename It,
typename tag,
typename F,
typename... Tail>
62 bool compare(
const It& lhs,
const It& rhs) {
64 if (res != 0)
return res > 0;
65 return compare<It, Tail...>(lhs, rhs);
68 template<
typename It,
typename... Args>
71 auto res =
compare<It, Args...>(lhs, rhs);
72 SMTRAT_LOG_TRACE(
"smtrat.cad.samplecompare", *lhs <<
" < " << *rhs <<
" ? " << res);
77 using lt = std::less<>;
78 using gt = std::greater<>;
80 template<
typename Iterator, SampleCompareStrategy Strategy>
83 template<
typename Iterator>
91 template<
typename Iterator>
96 auto r = reference(lhs, rhs);
103 auto res = sc(lhs, rhs);
104 SMTRAT_LOG_TRACE(
"smtrat.cad.samplecompare", *lhs <<
" < " << *rhs <<
" -> " << res);
108 bool l1 = carl::is_integer(lhs->value());
109 bool r1 = carl::is_integer(rhs->value());
110 SMTRAT_LOG_TRACE(
"smtrat.cad.samplecompare", lhs->value() <<
" < " << rhs->value() <<
": Int " << r1);
114 bool l2 = lhs->value().is_numeric();
115 bool r2 = rhs->value().is_numeric();
116 SMTRAT_LOG_TRACE(
"smtrat.cad.samplecompare", lhs->value() <<
" < " << rhs->value() <<
": Num " << r2);
120 std::size_t l3 = carl::bitsize(lhs->value());
121 std::size_t r3 = carl::bitsize(rhs->value());
122 SMTRAT_LOG_TRACE(
"smtrat.cad.samplecompare", lhs->value() <<
" < " << rhs->value() <<
": Size (" << l3 <<
" / " << r3 <<
") " << (l3 > r3));
132 template<
typename Iterator>
135 template<
typename Iterator>
138 template<
typename Iterator>
141 template<
typename Iterator>
144 template<
typename Iterator>
147 template<
typename Iterator>
150 template<
typename Iterator>
153 template<
typename Iterator>
156 template<
typename Iterator>
159 template<
typename Iterator>
166 template<
typename Iterator, FullSampleCompareStrategy Strategy>
169 template<
typename Iterator>
171 template<
typename Iterator>
173 template<
typename Iterator>
bool compare(const It &lhs, const It &rhs)
int compareCriterion(const It &lhs, const It &rhs, tag t, F &&f)
Compares the criterion given by t of two samples lhs and rhs using a comparator f.
auto get(const It &it, level)
FullSampleCompareStrategy
Numeric abs(const Numeric &_value)
Calculates the absolute value of the given Numeric.
PositionIteratorType Iterator
Class to create the formulas for axioms.
#define SMTRAT_LOG_TRACE(channel, msg)
bool reference(const Iterator &lhs, const Iterator &rhs) const
bool compare(const Iterator &lhs, const Iterator &rhs) const
bool operator()(const Iterator &lhs, const Iterator &rhs) const
bool operator()(const It &lhs, const It &rhs) const