Austin Schuh | 2f8fd75 | 2020-09-01 22:38:28 -0700 | [diff] [blame] | 1 | #ifndef AOS_EVENTS_LOGGING_EIGEN_MPQ_H_ |
| 2 | #define AOS_EVENTS_LOGGING_EIGEN_MPQ_H_ |
| 3 | |
| 4 | #include "Eigen/Dense" |
| 5 | #include "third_party/gmp/gmpxx.h" |
| 6 | |
| 7 | namespace Eigen { |
| 8 | |
| 9 | // TypeTraits for mpq_class. This is only really enough to use inverse(). |
| 10 | template <> |
Brian Silverman | d90905f | 2020-09-23 14:42:56 -0700 | [diff] [blame] | 11 | struct NumTraits<mpq_class> : GenericNumTraits<mpq_class> { |
Austin Schuh | 2f8fd75 | 2020-09-01 22:38:28 -0700 | [diff] [blame] | 12 | typedef mpq_class Real; |
| 13 | typedef mpq_class Literal; |
| 14 | typedef mpq_class NonInteger; |
| 15 | typedef mpq_class Nested; |
| 16 | |
| 17 | enum { |
| 18 | IsComplex = 0, |
| 19 | IsInteger = 0, |
| 20 | IsSigned = 1, |
| 21 | RequireInitialization = 1, |
| 22 | ReadCost = 1, |
| 23 | AddCost = 3, |
| 24 | MulCost = 9 |
| 25 | }; |
| 26 | |
| 27 | static inline Real dummy_precision() { return mpq_class(0); } |
| 28 | static inline Real epsilon() { return mpq_class(0); } |
| 29 | static inline int digits10() { return 0; } |
| 30 | }; |
| 31 | |
| 32 | } // namespace Eigen |
| 33 | |
| 34 | #endif // AOS_EVENTS_LOGGING_EIGEN_MPQ_H_ |