11 #ifndef CouenneRootQ_hpp
12 #define CouenneRootQ_hpp
35 static std::map <int, CouNumber>
Qmap;
51 std::map <int, CouNumber>:: iterator
pos;
58 if ((pos =
Qmap.find (k)) ==
Qmap.end()) {
60 std::pair <int, CouNumber> newpair;
63 newpair.second = (root =
rootQ (k));
65 Qmap.insert (newpair);
73 case 2:
return -(sqrt(2.0) - 1.0);
74 case 4:
return -0.56042566045031785945;
75 case 6:
return -0.64146546982884663257;
76 case 8:
return -0.69428385661425826738;
77 case 10:
return -0.73192937842370733350;
79 std::cerr <<
"Need to implement root finding for even k" << std::endl;
CouNumber rootQ(int k)
Find roots of polynomial $Q^k(x) = .
static std::map< int, CouNumber > Qmap
Maps an integer k with the root of .
pos
position where the operator should be printed when printing the expression
Qroot()
Empty constructor – we only need the method to work on the static structure.
~Qroot()
Empty destructor.
double CouNumber
main number type in Couenne
class that stores result of previous calls to rootQ into a map for faster access
CouNumber operator()(int k)
Retrieve root of Q with order = k.