blob: 1463648210e431a021f9caf3fb2309222351587d [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 <>
11struct NumTraits<mpq_class>
12 : GenericNumTraits<mpq_class> {
13 typedef mpq_class Real;
14 typedef mpq_class Literal;
15 typedef mpq_class NonInteger;
16 typedef mpq_class Nested;
17
18 enum {
19 IsComplex = 0,
20 IsInteger = 0,
21 IsSigned = 1,
22 RequireInitialization = 1,
23 ReadCost = 1,
24 AddCost = 3,
25 MulCost = 9
26 };
27
28 static inline Real dummy_precision() { return mpq_class(0); }
29 static inline Real epsilon() { return mpq_class(0); }
30 static inline int digits10() { return 0; }
31};
32
33} // namespace Eigen
34
35#endif // AOS_EVENTS_LOGGING_EIGEN_MPQ_H_