1    	
2    	/* ----------------------------------------------------------------------
3    	 * This file is autogenerated from the file multiprecision.hpp.in during
4    	 * the cmake configuration of your project. If you need to make changes
5    	 * edit the original file.
6    	 * ----------------------------------------------------------------------
7    	 */
8    	#ifndef __SOPLEX_MULTIPRECISION_HPP_
9    	#define __SOPLEX_MULTIPRECISION_HPP_
10   	#define SOPLEX_DEBUG
11   	#include <numeric>
12   	#include <vector>
13   	#include <string>
14   	#include "soplex/spxdefines.h"
15   	
16   	#ifdef SOPLEX_WITH_GMP
17   	#include <gmp.h>
18   	#endif
19   	
20   	#ifdef SOPLEX_WITH_BOOST
21   	#include <boost/multiprecision/number.hpp>
22   	
23   	#ifdef SOPLEX_WITH_GMP
24   	#include <boost/multiprecision/gmp.hpp>
25   	
26   	namespace soplex
27   	{
28   	
29   	using namespace boost::multiprecision;
30   	using Rational = number<gmp_rational, et_off>;
31   	using Integer = number<gmp_int, et_off>;
32   	inline void SpxLcm(Integer& result, Integer a, Integer b)
33   	{
34   	   mpz_lcm(result.backend().data(), a.backend().data(), b.backend().data());
35   	}
36   	inline void SpxGcd(Integer& result, Integer a, Integer b)
37   	{
38   	   mpz_gcd(result.backend().data(), a.backend().data(), b.backend().data());
39   	}
40   	
41   	} // namespace soplex
42   	#else
43   	#include <boost/multiprecision/cpp_int.hpp>
44   	#include <boost/multiprecision/detail/default_ops.hpp>
45   	
46   	namespace soplex
47   	{
48   	
49   	using namespace boost::multiprecision;
50   	using Rational = cpp_rational;
51   	using Integer = cpp_int;
52   	inline void SpxLcm(Integer& result, Integer a, Integer b)
53   	{
54   	   result = boost::multiprecision::lcm(a, b);
55   	}
56   	inline void SpxGcd(Integer& result, Integer a, Integer b)
57   	{
58   	   result = boost::multiprecision::gcd(a, b);
59   	}
60   	
61   	} // namespace soplex
62   	#endif
63   	
64   	namespace soplex
65   	{
66   	
67   	inline void printRational(Rational r)
68   	{
69   	   std::cout << r << std::endl;
70   	}
71   	
72   	inline void printInteger(Integer r)
73   	{
74   	   std::cout << r << std::endl;
75   	}
76   	inline bool isAdjacentTo(const Rational& r, const double& d)
77   	{
78   	   double x = (double) r;
79   	   double a;
80   	   double b;
81   	   Rational tmp = x;
82   	
83   	   // the rational value is representable in double precision
84   	   if(tmp == r)
85   	      return true;
86   	   // the rounded value is smaller than the rational value
87   	   else if(tmp < r)
88   	   {
89   	      a = x;
90   	      b = (double)nextafter(a, 1e100);
91   	   }
92   	   // the rounded value is larger than the rational value
93   	   else
94   	   {
95   	      b = x;
96   	      a = (double)nextafter(b, -1e100);
97   	   }
98   	
99   	   return ((a == d) || (b == d));
100  	}
101  	
102  	inline void invert(Rational& r)
103  	{
104  	   r = Rational(denominator(r), numerator(r));
105  	}
106  	
107  	/// round up to next power of two
108  	inline void powRound(Rational& r)
109  	{
110  	   Integer roundval;
111  	   Integer den;
112  	   Integer num;
113  	
114  	   MSG_DEBUG(std::cout << "rounding " << str(r) <<
115  	             " to power of two" << "\n");
116  	
117  	   num = numerator(r);
118  	   den = denominator(r);
119  	   roundval = num / den;
120  	
121  	   MSG_DEBUG(std::cout << "   --> " << str(roundval) << "\n");
122  	
123  	   size_t binlog = roundval == 0 ? 1 : msb(roundval) + 1;
124  	   Integer base = 2;
125  	
126  	   MSG_DEBUG(std::cout << "   --> 2^" << binlog << "\n");
127  	
128  	   roundval = boost::multiprecision::pow(base, (unsigned int)binlog);
129  	
130  	   MSG_DEBUG(std::cout << "   --> " << str(roundval) << "\n");
131  	
132  	   r = roundval;
133  	
134  	   MSG_DEBUG(std::cout << "   --> " << str(r) << "\n");
135  	}
136  	
137  	/* find substring, ignore case */
138  	static
139  	std::string::const_iterator findSubStringIC(const std::string& substr, const std::string& str)
140  	{
141  	   auto it = std::search(
142  	                str.begin(), str.end(),
143  	                substr.begin(),   substr.end(),
144  	                [](char ch1, char ch2)
145  	   {
146  	      return std::toupper(ch1) == std::toupper(ch2);
147  	   }
148  	             );
149  	   return it;
150  	}
151  	
152  	inline Rational ratFromString(const char* desc)
153  	{
154  	   Rational res;
155  	
156  	   if(0 == strcmp(desc, "inf"))
157  	   {
158  	      res = 1e100;
159  	   }
160  	   else if(0 == strcmp(desc, "-inf"))
161  	   {
162  	      res = -1e100;
163  	   }
164  	   else
165  	   {
166  	      std::string s(desc);
167  	
168  	      /* case 1: string is given in nom/den format */
169  	      if(s.find('.') == std::string::npos)
170  	         res = Rational(desc);
171  	      /* case 2: string is given as base-10 decimal number */
172  	      else
173  	      {
174  	         std::string::const_iterator it = findSubStringIC("e", s);
175  	         int mult = 0;
176  	
177  	         if(it != s.end())
178  	         {
179  	            int exponentidx = int(it - s.begin());
180  	            mult = std::stoi(s.substr(exponentidx + 1, s.length()));
181  	            s = s.substr(0, exponentidx);
182  	         }
183  	
184  	         // std::cout << s << std::endl;
185  	         if(s[0] == '.')
186  	            s.insert(0, "0");
187  	
188  	         size_t pos = s.find('.');
189  	         size_t exp = s.length() - 1 - pos;
190  	         std::string den("1");
191  	
192  	         for(size_t i = 0; i < exp; ++i)
193  	            den.append("0");
194  	
195  	         s.erase(pos, 1);
196  	         assert(std::all_of(s.begin() + 1, s.end(), ::isdigit));
197  	
198  	         // remove padding 0s
199  	         if(s[0] == '-')
200  	            s.erase(1, std::min(s.substr(1).find_first_not_of('0'), s.size() - 1));
201  	         else
202  	            s.erase(0, std::min(s.find_first_not_of('0'), s.size() - 1));
203  	
204  	         s.append("/");
205  	         s.append(den);
206  	         res = Rational(s);
207  	         res *= pow(10, mult);
208  	      }
209  	   }
210  	
211  	   return res;
212  	}
213  	
214  	} // namespace soplex
215  	#else
216  	
217  	#ifndef SOPLEX_WITH_GMP
218  	using mpq_t = char;
219  	#endif
220  	
221  	using Integer = int;
222  	// this is a placeholder class to ensure compilation when boost ist not linked. Rationals need BOOST in order to function.
223  	class Rational
224  	{
225  	
226  	private:
(1) Event member_decl: Class member declaration for "val".
Also see events: [uninit_member]
227  	   double val;
228  	
229  	public:
230  	
231  	   ///@name Construction and destruction
232  	   ///@{
233  	
234  	   inline void rationalErrorMessage() const
235  	   {
236  	      MSG_ERROR(std::cerr << "Using rational methods without linking boost is not supported" << std::endl;
237  	               )
238  	   };
239  	
240  	   /// default constructor
241  	   inline Rational()
242  	   {
243  	      rationalErrorMessage();
244  	   };
245  	   /// copy constructor
246  	   inline Rational(const Rational& r)
247  	   {
248  	      rationalErrorMessage();
249  	   };
250  	   /// constructor from long double
251  	   inline Rational(const long double& r)
252  	   {
253  	      rationalErrorMessage();
254  	   };
255  	   /// constructor from double
256  	   inline Rational(const double& r)
257  	   {
258  	      rationalErrorMessage();
259  	   };
260  	   ///constructor from int
261  	   inline Rational(const int& i)
262  	   {
263  	      rationalErrorMessage();
264  	   };
265  	   /// constructor from Integer
266  	   inline Rational(const Integer& num, const Integer& den)
267  	   {
268  	      rationalErrorMessage();
(2) Event uninit_member: Non-static class member "val" is not initialized in this constructor nor in any functions that it calls.
Also see events: [member_decl]
269  	   };
270  	   /// constructor from mpq_t (GMP only)
271  	   inline Rational(const mpq_t& q)
272  	   {
273  	      rationalErrorMessage();
274  	   };
275  	#ifdef SOPLEX_WITH_BOOST
276  	   // constructor from boost number
277  	   inline template <typename T, boost::multiprecision::expression_template_option eto>
278  	   Rational(const boost::multiprecision::number<T, eto>& q)
279  	   {
280  	      rationalErrorMessage();
281  	   };
282  	#endif
283  	   /// destructor
284  	   inline ~Rational()
285  	   {
286  	      rationalErrorMessage();
287  	   };
288  	
289  	   /// assignment operator
290  	   inline Rational& operator=(const Rational&)
291  	   {
292  	      rationalErrorMessage();
293  	      return *this;
294  	   };
295  	   /// assignment operator from long double
296  	   inline Rational& operator=(const long double& r)
297  	   {
298  	      rationalErrorMessage();
299  	      return *this;
300  	   };
301  	   /// assignment operator from double
302  	   inline Rational& operator=(const double& r)
303  	   {
304  	      rationalErrorMessage();
305  	      return *this;
306  	   };
307  	   /// assignment operator from int
308  	   inline Rational& operator=(const int& i)
309  	   {
310  	      rationalErrorMessage();
311  	      return *this;
312  	   };
313  	   /// assignment operator from mpq_t
314  	   inline Rational& operator=(const mpq_t& q)
315  	   {
316  	      rationalErrorMessage();
317  	      return *this;
318  	   };
319  	
320  	   inline void assign(const Rational&)
321  	   {
322  	      rationalErrorMessage();
323  	   };
324  	   inline void assign(const long double& r)
325  	   {
326  	      rationalErrorMessage();
327  	   };
328  	   inline void assign(const double& r)
329  	   {
330  	      rationalErrorMessage();
331  	   };
332  	   inline void assign(const int& i)
333  	   {
334  	      rationalErrorMessage();
335  	   };
336  	
337  	   ///@name Typecasts
338  	   ///@{
339  	
340  	   inline operator double() const
341  	   {
342  	      return 0;
343  	   };
344  	   inline operator long double() const
345  	   {
346  	      return 0;
347  	   };
348  	   inline operator float() const
349  	   {
350  	      return 0;
351  	   };
352  	#ifdef SOPLEX_WITH_BOOST
353  	#ifndef SOPLEX_WITH_CPPMPF
354  	   // Operator to typecast Rational to one of the Boost Number types
355  	   inline template <typename T, boost::multiprecision::expression_template_option eto>
356  	   operator boost::multiprecision::number<T, eto>() const
357  	   {
358  	      rationalErrorMessage();
359  	      return val;
360  	   };
361  	#else
362  	   // Operator to typecast Rational to one of the Boost Number types
363  	   inline template <unsigned bits, boost::multiprecision::expression_template_option eto>
364  	   operator boost::multiprecision::number<boost::multiprecision::backends::cpp_dec_float<bits>, eto>()
365  	   const
366  	   {
367  	      rationalErrorMessage();
368  	      return val;
369  	   };
370  	#endif
371  	#endif
372  	
373  	   ///@name Typecasts
374  	   ///@{
375  	
376  	   ///@}
377  	
378  	
379  	   ///@name Arithmetic operators
380  	   ///@{
381  	
382  	   /// addition operator
383  	   inline Rational operator+(const Rational& r) const
384  	   {
385  	      rationalErrorMessage();
386  	      return *this;
387  	   }
388  	   /// addition assignment operator
389  	   inline Rational operator+=(const Rational& r)
390  	   {
391  	      rationalErrorMessage();
392  	      return *this;
393  	   }
394  	   /// addition operator for doubles
395  	   inline Rational operator+(const double& r) const
396  	   {
397  	      rationalErrorMessage();
398  	      return *this;
399  	   }
400  	   /// addition assignment operator  for doubles
401  	   inline Rational operator+=(const double& r)
402  	   {
403  	      rationalErrorMessage();
404  	      return *this;
405  	   }
406  	   /// addition operator for ints
407  	   inline Rational operator+(const int& r) const
408  	   {
409  	      rationalErrorMessage();
410  	      return *this;
411  	   }
412  	   /// addition assignment operator  for ints
413  	   inline Rational operator+=(const int& r)
414  	   {
415  	      rationalErrorMessage();
416  	      return *this;
417  	   }
418  	   /// subtraction operator
419  	   inline Rational operator-(const Rational& r) const
420  	   {
421  	      rationalErrorMessage();
422  	      return *this;
423  	   }
424  	   /// subtraction assignment operator
425  	   inline Rational operator-=(const Rational& r)
426  	   {
427  	      rationalErrorMessage();
428  	      return *this;
429  	   }
430  	   /// subtraction operator for doubles
431  	   inline Rational operator-(const double& r) const
432  	   {
433  	      rationalErrorMessage();
434  	      return *this;
435  	   }
436  	   /// subtraction assignment operator for doubles
437  	   inline Rational operator-=(const double& r)
438  	   {
439  	      rationalErrorMessage();
440  	      return *this;
441  	   }
442  	   /// subtraction operator for ints
443  	   inline Rational operator-(const int& r) const
444  	   {
445  	      rationalErrorMessage();
446  	      return *this;
447  	   }
448  	   /// subtraction assignment operator for ints
449  	   inline Rational operator-=(const int& r)
450  	   {
451  	      rationalErrorMessage();
452  	      return *this;
453  	   }
454  	   /// multiplication operator
455  	   inline Rational operator*(const Rational& r) const
456  	   {
457  	      rationalErrorMessage();
458  	      return *this;
459  	   }
460  	   /// multiplication assignment operator operator
461  	   inline Rational operator*=(const Rational& r)
462  	   {
463  	      rationalErrorMessage();
464  	      return *this;
465  	   }
466  	   /// multiplication operator for doubles
467  	   inline Rational operator*(const double& r) const
468  	   {
469  	      rationalErrorMessage();
470  	      return *this;
471  	   }
472  	   /// multiplication assignment operator for doubles
473  	   inline Rational operator*=(const double& r)
474  	   {
475  	      rationalErrorMessage();
476  	      return *this;
477  	   }
478  	   /// multiplication operator for ints
479  	   inline Rational operator*(const int& r) const
480  	   {
481  	      rationalErrorMessage();
482  	      return *this;
483  	   }
484  	   /// multiplication assignment operator for ints
485  	   inline Rational operator*=(const int& r)
486  	   {
487  	      rationalErrorMessage();
488  	      return *this;
489  	   }
490  	   /// division operator
491  	   inline Rational operator/(const Rational& r) const
492  	   {
493  	      rationalErrorMessage();
494  	      return *this;
495  	   }
496  	   /// division assignment operator
497  	   inline Rational operator/=(const Rational& r)
498  	   {
499  	      rationalErrorMessage();
500  	      return *this;
501  	   }
502  	   /// division operator for doubles
503  	   inline Rational operator/(const double& r) const
504  	   {
505  	      rationalErrorMessage();
506  	      return *this;
507  	   }
508  	   /// division assignment operator for doubles
509  	   inline Rational operator/=(const double& r)
510  	   {
511  	      rationalErrorMessage();
512  	      return *this;
513  	   }
514  	   /// division operator for ints
515  	   inline Rational operator/(const int& r) const
516  	   {
517  	      rationalErrorMessage();
518  	      return *this;
519  	   }
520  	   /// division assignment operator for ints
521  	   inline Rational operator/=(const int& r)
522  	   {
523  	      rationalErrorMessage();
524  	      return *this;
525  	   }
526  	   /// add product of two rationals
527  	   Rational& addProduct(const Rational& r, const Rational& s)
528  	   {
529  	      rationalErrorMessage();
530  	      return *this;
531  	   }
532  	
533  	   /// subtract product of two rationals
534  	   Rational& subProduct(const Rational& r, const Rational& s)
535  	   {
536  	      rationalErrorMessage();
537  	      return *this;
538  	   }
539  	
540  	   /// add quotient of two rationals, r divided by s
541  	   Rational& addQuotient(const Rational& r, const Rational& s)
542  	   {
543  	      rationalErrorMessage();
544  	      return *this;
545  	   }
546  	
547  	   /// subtract quotient of two rationals, r divided by s
548  	   Rational& subQuotient(const Rational& r, const Rational& s)
549  	   {
550  	      rationalErrorMessage();
551  	      return *this;
552  	   }
553  	
554  	   ///@}
555  	
556  	
557  	   ///@name Methods for checking exactness of doubles
558  	   ///@{
559  	
560  	   /// checks if \p d is exactly equal to the Rational and if not, if it is one of the two adjacent doubles
561  	   inline bool isAdjacentTo(const double& d) const
562  	   {
563  	      rationalErrorMessage();
564  	      return false;
565  	   };
566  	
567  	   ///@}
568  	
569  	
570  	   ///@name Methods for querying size
571  	   ///@{
572  	
573  	   /// Size in specified base (bit size for base 2)
574  	   int sizeInBase(const int base = 2) const
575  	   {
576  	      rationalErrorMessage();
577  	      return 0;
578  	   };
579  	
580  	   ///@}
581  	
582  	
583  	   ///@name Conversion from and to String
584  	   ///@{
585  	   inline friend std::ostream& operator<<(std::ostream& os, const Rational& r)
586  	   {
587  	      r.rationalErrorMessage();
588  	      return os;
589  	   };
590  	   inline std::string str() const
591  	   {
592  	      this->rationalErrorMessage();
593  	      return std::string("");
594  	   };
595  	   ///@}
596  	
597  	   ///@name Friends
598  	   ///@{
599  	
600  	   inline friend int compareRational(const Rational& r, const Rational& s)
601  	   {
602  	      r.rationalErrorMessage();
603  	      return 0;
604  	   };
605  	   inline friend bool operator!=(const Rational& r, const Rational& s)
606  	   {
607  	      r.rationalErrorMessage();
608  	      return false;
609  	   };
610  	   inline friend bool operator==(const Rational& r, const Rational& s)
611  	   {
612  	      r.rationalErrorMessage();
613  	      return false;
614  	   };
615  	   inline friend bool operator<(const Rational& r, const Rational& s)
616  	   {
617  	      r.rationalErrorMessage();
618  	      return false;
619  	   };
620  	   inline friend bool operator<=(const Rational& r, const Rational& s)
621  	   {
622  	      r.rationalErrorMessage();
623  	      return false;
624  	   };
625  	   inline friend bool operator>(const Rational& r, const Rational& s)
626  	   {
627  	      r.rationalErrorMessage();
628  	      return false;
629  	   };
630  	   inline friend bool operator>=(const Rational& r, const Rational& s)
631  	   {
632  	      r.rationalErrorMessage();
633  	      return false;
634  	   };
635  	
636  	   inline friend bool operator!=(const Rational& r, const double& s)
637  	   {
638  	      r.rationalErrorMessage();
639  	      return false;
640  	   };
641  	   inline friend bool operator==(const Rational& r, const double& s)
642  	   {
643  	      r.rationalErrorMessage();
644  	      return false;
645  	   };
646  	   inline friend bool operator<(const Rational& r, const double& s)
647  	   {
648  	      r.rationalErrorMessage();
649  	      return false;
650  	   };
651  	   inline friend bool operator<=(const Rational& r, const double& s)
652  	   {
653  	      r.rationalErrorMessage();
654  	      return false;
655  	   };
656  	   inline friend bool operator>(const Rational& r, const double& s)
657  	   {
658  	      r.rationalErrorMessage();
659  	      return false;
660  	   };
661  	   inline friend bool operator>=(const Rational& r, const double& s)
662  	   {
663  	      r.rationalErrorMessage();
664  	      return false;
665  	   };
666  	
667  	   inline friend bool operator!=(const double& r, const Rational& s)
668  	   {
669  	      s.rationalErrorMessage();
670  	      return false;
671  	   };
672  	   inline friend bool operator==(const double& r, const Rational& s)
673  	   {
674  	      s.rationalErrorMessage();
675  	      return false;
676  	   };
677  	   inline friend bool operator<(const double& r, const Rational& s)
678  	   {
679  	      s.rationalErrorMessage();
680  	      return false;
681  	   };
682  	   inline friend bool operator<=(const double& r, const Rational& s)
683  	   {
684  	      s.rationalErrorMessage();
685  	      return false;
686  	   };
687  	   inline friend bool operator>(const double& r, const Rational& s)
688  	   {
689  	      s.rationalErrorMessage();
690  	      return false;
691  	   };
692  	   inline friend bool operator>=(const double& r, const Rational& s)
693  	   {
694  	      s.rationalErrorMessage();
695  	      return false;
696  	   };
697  	
698  	   inline friend bool operator!=(const Rational& r, const long double& s)
699  	   {
700  	      r.rationalErrorMessage();
701  	      return false;
702  	   };
703  	   inline friend bool operator==(const Rational& r, const long double& s)
704  	   {
705  	      r.rationalErrorMessage();
706  	      return false;
707  	   };
708  	   inline friend bool operator<(const Rational& r, const long double& s)
709  	   {
710  	      r.rationalErrorMessage();
711  	      return false;
712  	   };
713  	   inline friend bool operator<=(const Rational& r, const long double& s)
714  	   {
715  	      r.rationalErrorMessage();
716  	      return false;
717  	   };
718  	   inline friend bool operator>(const Rational& r, const long double& s)
719  	   {
720  	      r.rationalErrorMessage();
721  	      return false;
722  	   };
723  	   inline friend bool operator>=(const Rational& r, const long double& s)
724  	   {
725  	      r.rationalErrorMessage();
726  	      return false;
727  	   };
728  	
729  	   inline friend bool operator!=(const long double& r, const Rational& s)
730  	   {
731  	      s.rationalErrorMessage();
732  	      return false;
733  	   };
734  	   inline friend bool operator==(const long double& r, const Rational& s)
735  	   {
736  	      s.rationalErrorMessage();
737  	      return false;
738  	   };
739  	   inline friend bool operator<(const long double& r, const Rational& s)
740  	   {
741  	      s.rationalErrorMessage();
742  	      return false;
743  	   };
744  	   inline friend bool operator<=(const long double& r, const Rational& s)
745  	   {
746  	      s.rationalErrorMessage();
747  	      return false;
748  	   };
749  	   inline friend bool operator>(const long double& r, const Rational& s)
750  	   {
751  	      s.rationalErrorMessage();
752  	      return false;
753  	   };
754  	   inline friend bool operator>=(const long double& r, const Rational& s)
755  	   {
756  	      s.rationalErrorMessage();
757  	      return false;
758  	   };
759  	
760  	   inline friend bool operator!=(const Rational& r, const float& s)
761  	   {
762  	      r.rationalErrorMessage();
763  	      return false;
764  	   };
765  	   inline friend bool operator==(const Rational& r, const float& s)
766  	   {
767  	      r.rationalErrorMessage();
768  	      return false;
769  	   };
770  	   inline friend bool operator<(const Rational& r, const float& s)
771  	   {
772  	      r.rationalErrorMessage();
773  	      return false;
774  	   };
775  	   inline friend bool operator<=(const Rational& r, const float& s)
776  	   {
777  	      r.rationalErrorMessage();
778  	      return false;
779  	   };
780  	   inline friend bool operator>(const Rational& r, const float& s)
781  	   {
782  	      r.rationalErrorMessage();
783  	      return false;
784  	   };
785  	   inline friend bool operator>=(const Rational& r, const float& s)
786  	   {
787  	      r.rationalErrorMessage();
788  	      return false;
789  	   };
790  	
791  	   inline friend bool operator!=(const float& r, const Rational& s)
792  	   {
793  	      s.rationalErrorMessage();
794  	      return false;
795  	   };
796  	   inline friend bool operator==(const float& r, const Rational& s)
797  	   {
798  	      s.rationalErrorMessage();
799  	      return false;
800  	   };
801  	   inline friend bool operator<(const float& r, const Rational& s)
802  	   {
803  	      s.rationalErrorMessage();
804  	      return false;
805  	   };
806  	   inline friend bool operator<=(const float& r, const Rational& s)
807  	   {
808  	      s.rationalErrorMessage();
809  	      return false;
810  	   };
811  	   inline friend bool operator>(const float& r, const Rational& s)
812  	   {
813  	      s.rationalErrorMessage();
814  	      return false;
815  	   };
816  	   inline friend bool operator>=(const float& r, const Rational& s)
817  	   {
818  	      s.rationalErrorMessage();
819  	      return false;
820  	   };
821  	
822  	   inline friend Rational operator+(const double& d, const Rational& r)
823  	   {
824  	      r.rationalErrorMessage();
825  	      return r;
826  	   };
827  	   inline friend Rational operator-(const double& d, const Rational& r)
828  	   {
829  	      r.rationalErrorMessage();
830  	      return r;
831  	   };
832  	   inline friend Rational operator*(const double& d, const Rational& r)
833  	   {
834  	      r.rationalErrorMessage();
835  	      return r;
836  	   };
837  	   inline friend Rational operator/(const double& d, const Rational& r)
838  	   {
839  	      r.rationalErrorMessage();
840  	      return r;
841  	   };
842  	
843  	   inline friend bool operator!=(const Rational& r, const int& s)
844  	   {
845  	      r.rationalErrorMessage();
846  	      return false;
847  	   };
848  	   inline friend bool operator==(const Rational& r, const int& s)
849  	   {
850  	      r.rationalErrorMessage();
851  	      return false;
852  	   };
853  	   inline friend bool operator<(const Rational& r, const int& s)
854  	   {
855  	      r.rationalErrorMessage();
856  	      return false;
857  	   };
858  	   inline friend bool operator<=(const Rational& r, const int& s)
859  	   {
860  	      r.rationalErrorMessage();
861  	      return false;
862  	   };
863  	   inline friend bool operator>(const Rational& r, const int& s)
864  	   {
865  	      r.rationalErrorMessage();
866  	      return false;
867  	   };
868  	   inline friend bool operator>=(const Rational& r, const int& s)
869  	   {
870  	      r.rationalErrorMessage();
871  	      return false;
872  	   };
873  	
874  	   inline friend bool operator!=(const int& r, const Rational& s)
875  	   {
876  	      s.rationalErrorMessage();
877  	      return false;
878  	   };
879  	   inline friend bool operator==(const int& r, const Rational& s)
880  	   {
881  	      s.rationalErrorMessage();
882  	      return false;
883  	   };
884  	   inline friend bool operator<(const int& r, const Rational& s)
885  	   {
886  	      s.rationalErrorMessage();
887  	      return false;
888  	   };
889  	   inline friend bool operator<=(const int& r, const Rational& s)
890  	   {
891  	      s.rationalErrorMessage();
892  	      return false;
893  	   };
894  	   inline friend bool operator>(const int& r, const Rational& s)
895  	   {
896  	      s.rationalErrorMessage();
897  	      return false;
898  	   };
899  	   inline friend bool operator>=(const int& r, const Rational& s)
900  	   {
901  	      s.rationalErrorMessage();
902  	      return false;
903  	   };
904  	
905  	   inline friend Rational operator+(const int& d, const Rational& r)
906  	   {
907  	      r.rationalErrorMessage();
908  	      return r;
909  	   };
910  	   inline friend Rational operator-(const int& d, const Rational& r)
911  	   {
912  	      r.rationalErrorMessage();
913  	      return r;
914  	   };
915  	   inline friend Rational operator*(const int& d, const Rational& r)
916  	   {
917  	      r.rationalErrorMessage();
918  	      return r;
919  	   };
920  	   inline friend Rational operator/(const int& d, const Rational& r)
921  	   {
922  	      r.rationalErrorMessage();
923  	      return r;
924  	   };
925  	
926  	   inline friend Rational spxAbs(const Rational& r)
927  	   {
928  	      r.rationalErrorMessage();
929  	      return r;
930  	   };
931  	   inline friend int sign(const Rational& r)
932  	   {
933  	      r.rationalErrorMessage();
934  	      return 0;
935  	   };
936  	   inline friend Rational operator-(const Rational& q)
937  	   {
938  	      q.rationalErrorMessage();
939  	      return q;
940  	   };///@name Construction and destruction
941  	   ///@{
942  	};
943  	
944  	inline Integer numerator(const Rational& r)
945  	{
946  	   r.rationalErrorMessage();
947  	   return 0;
948  	}
949  	inline Integer denominator(const Rational& r)
950  	{
951  	   r.rationalErrorMessage();
952  	   return 0;
953  	}
954  	inline Rational ratFromString(const char* desc)
955  	{
956  	   return Rational();
957  	}
958  	inline void SpxLcm(Integer& result, Integer a, Integer b) {}
959  	inline void SpxGcd(Integer& result, Integer a, Integer b) {}
960  	inline void divide_qr(Integer& result, Integer& result2, Integer a, Integer b) {}
961  	inline void invert(Rational& r)
962  	{
963  	   r.rationalErrorMessage();
964  	}
965  	inline void powRound(Rational& r)
966  	{
967  	   r.rationalErrorMessage();
968  	}
969  	#endif
970  	
971  	namespace soplex
972  	{
973  	
974  	/// Size in specified base (bit size for base 2)
975  	inline int sizeInBase(const Rational R, const int base)
976  	{
977  	   assert(base == 2);
978  	
979  	#ifndef SOPLEX_WITH_BOOST
980  	   MSG_ERROR(std::cerr << "ERROR: rational solve without Boost not defined!" << std::endl;)
981  	   return 0;
982  	#else
983  	   size_t densize = msb(denominator(R)) + 1;
984  	   size_t numsize = msb(numerator(R)) + 1;
985  	
986  	   return (int)(densize + numsize);
987  	#endif
988  	}
989  	/// Total size of rational vector.
990  	inline int totalSizeRational(const Rational* vector, const int length, const int base)
991  	{
992  	   assert(vector != 0);
993  	   assert(length >= 0);
994  	   assert(base >= 0);
995  	
996  	   int size = 0;
997  	
998  	   for(int i = 0; i < length; i++)
999  	      size += sizeInBase(vector[i], base);
1000 	
1001 	   return size;
1002 	}
1003 	
1004 	/// Size of least common multiple of denominators in rational vector.
1005 	inline int dlcmSizeRational(const Rational* vector, const int length, const int base)
1006 	{
1007 	   assert(vector != 0);
1008 	   assert(length >= 0);
1009 	   assert(base == 2);
1010 	
1011 	#ifndef SOPLEX_WITH_BOOST
1012 	   MSG_ERROR(std::cerr << "ERROR: rational solve without Boost not defined!" << std::endl;)
1013 	   return 0;
1014 	#else
1015 	
1016 	   Integer lcm;
1017 	
1018 	   for(int i = 0; i < length; i++)
1019 	      SpxLcm(lcm, lcm, denominator(vector[i]));
1020 	
1021 	   int size = msb(lcm) + 1;
1022 	
1023 	   return size;
1024 	#endif
1025 	}
1026 	
1027 	/// Size of largest denominator in rational vector.
1028 	inline int dmaxSizeRational(const Rational* vector, const int length, const int base)
1029 	{
1030 	   assert(vector != 0);
1031 	   assert(length >= 0);
1032 	   assert(base == 2);
1033 	#ifndef SOPLEX_WITH_BOOST
1034 	   MSG_ERROR(std::cerr << "ERROR: rational solve without Boost not defined!" << std::endl;)
1035 	   return 0;
1036 	#else
1037 	
1038 	   size_t dmax = 0;
1039 	
1040 	   for(int i = 0; i < length; i++)
1041 	   {
1042 	      size_t dsize = msb(denominator(vector[i])) + 1;
1043 	
1044 	      if(dsize > dmax)
1045 	         dmax = dsize;
1046 	   }
1047 	
1048 	   return (int)dmax;
1049 	#endif
1050 	}
1051 	
1052 	} // namespace soplex
1053 	#endif
1054 	//}
1055