sigma  1.0.0
Loading...
Searching...
No Matches
eigen_compat.hpp
Go to the documentation of this file.
1#pragma once
2
6
7#ifdef ENABLE_EIGEN_SUPPORT
8#include <Eigen/Dense>
9
10// Foward Declarations
11namespace sigma {
12template<typename T>
13class Uncertain;
14template<typename T>
15class Interval;
16} // namespace sigma
17
21#define EIGEN_NUMTRAITS(float_type) \
22 \
23 template<> \
24 struct NumTraits<sigma::Uncertain<float_type>> : NumTraits<float_type> { \
25 \
26 using Uncertain = sigma::Uncertain<float_type>; \
27 \
28 using Real = Uncertain; \
29 \
30 using NonInteger = Uncertain; \
31 \
32 using Literal = Uncertain; \
33 \
34 using Nested = Uncertain; \
35 enum { \
36 IsComplex = 0, \
37 IsInteger = 0, \
38 IsSigned = 1, \
39 RequireInitialization = 1, \
40 ReadCost = 1, \
41 AddCost = 3, \
42 MulCost = 3 \
43 }; \
44 }
45
49#define EIGEN_NUMTRAITS_INTERVAL(float_type) \
50 \
51 template<> \
52 struct NumTraits<sigma::Interval<float_type>> : NumTraits<float_type> { \
53 \
54 using Interval = sigma::Interval<float_type>; \
55 \
56 using Real = Interval; \
57 \
58 using NonInteger = Interval; \
59 \
60 using Literal = Interval; \
61 \
62 using Nested = Interval; \
63 enum { \
64 IsComplex = 0, \
65 IsInteger = 0, \
66 IsSigned = 1, \
67 RequireInitialization = 1, \
68 ReadCost = 1, \
69 AddCost = 3, \
70 MulCost = 3 \
71 }; \
72 }
73
80namespace Eigen {
81
84
87
88} // namespace Eigen
89
90#undef EIGEN_NUMTRAITS
91#undef EIGEN_NUMTRAITS_INTERVAL
92#endif // ENABLE_EIGEN_SUPPORT
Models a numeric interval.
Definition interval.hpp:21
Models an unceratin variable.
Definition uncertain.hpp:33
#define EIGEN_NUMTRAITS(float_type)
Factorization for Eigen::NumTraits Specialization for Uncertain.
Definition eigen_compat.hpp:21
#define EIGEN_NUMTRAITS_INTERVAL(float_type)
Factorization for Eigen::NumTraits Specialization for Interval.
Definition eigen_compat.hpp:49
The namespace of the Eigen library.
The primary namespace for the sigma library.
Definition operation_common.hpp:10