2 * File: ThomEncoding.tpp
5 * Created on 20. August 2016, 11:37
8 #include "ThomEncoding.h"
15 //*******************//
17 //*******************//
20 * called by ThomEncoding::compare
23 template<typename Number>
24 ThomComparisonResult ThomEncoding<Number>::compareDifferentPoly(const ThomEncoding<Number>& lhs, const ThomEncoding<Number>& rhs) {
25 using Polynomial = MultivariatePolynomial<Number>;
27 std::list<Polynomial> der_rhs = der(rhs.polynomial(), rhs.main_var(), 0, rhs.polynomial().degree(rhs.main_var()));
28 SignCondition sc_lhs_on_der_rhs;
29 auto it_der_rhs = der_rhs.rbegin();
31 for( ; it_der_rhs != der_rhs.rend(); it_der_rhs++) {
32 sc_lhs_on_der_rhs.push_front(lhs.signOnPolynomial(*it_der_rhs));
33 if(rhs.mSc.size() < currLength) rhs.extendSignCondition();
34 SignCondition sc_rhs_curr = rhs.mSc.trailingPart(currLength);
35 if(sc_rhs_curr != sc_lhs_on_der_rhs) {
36 CARL_LOG_TRACE("carl.thom.compare", "comparing " << sc_lhs_on_der_rhs << " with " << sc_rhs_curr);
37 return SignCondition::compare(sc_lhs_on_der_rhs, sc_rhs_curr);
42 // that means that lhs realized precisely the same signs on der_rhs as rhs itself -> then the encoded numbers must be equal