blob: 370d77e617c3526feb8458364625801c3bc116cb [file] [log] [blame]
Austin Schuh2f8fd752020-09-01 22:38:28 -07001#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
7namespace Eigen {
8
9// TypeTraits for mpq_class. This is only really enough to use inverse().
10template <>
Brian Silvermand90905f2020-09-23 14:42:56 -070011struct NumTraits<mpq_class> : GenericNumTraits<mpq_class> {
Austin Schuh2f8fd752020-09-01 22:38:28 -070012 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_