codac 1.5.6
Loading...
Searching...
No Matches
codac2_eigen.h
1#ifndef EIGEN_NO_DEBUG
2/* Disables Eigen's assertions if defined.
3 * Not defined by default, unless the NDEBUG macro is defined
4 * (this is a standard C++ macro which disables all asserts).
5 * https://eigen.tuxfamily.org/dox/TopicPreprocessorDirectives.html
6 */
7#define EIGEN_NO_DEBUG
8#endif
9
10#ifndef __CODAC2_EIGEN_H__
11#define __CODAC2_EIGEN_H__
12
13#include <Eigen/Core>
14#include <Eigen/Dense>
15#include "codac2_Interval.h"
16
17namespace Eigen
18{
19 template<> struct NumTraits<codac2::Interval>
20 : NumTraits<double> // permits to get the epsilon, dummy_precision, lowest, highest functions
21 {
22 typedef codac2::Interval Real;
23 typedef codac2::Interval NonInteger;
24 typedef codac2::Interval Nested;
25
26 enum {
27 IsComplex = 0,
28 IsInteger = 0,
29 IsSigned = 1,
30 RequireInitialization = 1,
31 ReadCost = 1,
32 AddCost = 3,
33 MulCost = 3
34 };
35 };
36}
37
38namespace codac2
39{
40 inline const Interval& conj(const Interval& x) { return x; }
41 inline const Interval& real(const Interval& x) { return x; }
42 inline Interval imag(const Interval&) { return 0.; }
43 inline Interval abs(const Interval& x) { return ibex::abs(x); }
44 inline Interval abs2(const Interval& x) { return ibex::sqr(x); }
45
46} // namespace codac
47
48#endif