30 concept IsVectorOrRow = (C == 1 || R == 1);
32 template<
typename Scalar>
33 concept IsIntervalDomain = std::is_same_v<Scalar,codac2::Interval>;
36#define EIGEN_MATRIXBASE_PLUGIN "codac2_MatrixBase_addons_include.h"
37#define EIGEN_MATRIX_PLUGIN "codac2_Matrix_addons_include.h"
53 template<>
struct NumTraits<codac2::Interval>
56 typedef codac2::Interval Real;
57 typedef codac2::Interval NonInteger;
58 typedef codac2::Interval Nested;
59 typedef codac2::Interval Scalar;
60 typedef double RealScalar;
66 RequireInitialization = 1,
73 template<
typename BinOp>
74 struct ScalarBinaryOpTraits<codac2::Interval,double,BinOp>
75 {
typedef codac2::Interval ReturnType; };
77 template<
typename BinOp>
78 struct ScalarBinaryOpTraits<double,codac2::Interval,BinOp>
79 {
typedef codac2::Interval ReturnType; };
92 template<
typename Scalar,
int R,
int C>
93 using Mat = Eigen::Matrix<Scalar,R,C>;
96 struct is_interval_based<Eigen::Matrix<double,R,C>> : std::false_type {};
99 struct is_interval_based<Eigen::Matrix<Interval,R,C>> : std::true_type {};
101 template<
typename T,
int R,
int C>
102 struct is_ctc<Eigen::Matrix<T,R,C>> : std::false_type {};
104 template<
typename T,
int R,
int C>
105 struct is_sep<Eigen::Matrix<T,R,C>> : std::false_type {};
110 template<
typename OtherDerived>
111 inline auto abs(
const Eigen::MatrixBase<OtherDerived>& x)
113 using M = Eigen::MatrixBase<OtherDerived>;
114 Eigen::Matrix<typename M::Scalar,M::RowsAtCompileTime,M::ColsAtCompileTime> a(x.rows(),x.cols());
116 for(Index i = 0 ; i < x.rows() ; i++)
117 for(Index j = 0 ; j < x.cols() ; j++)
119 if constexpr(std::is_same_v<typename M::Scalar,double>)
120 a(i,j) = fabs(x(i,j));
122 a(i,j) =
abs(x(i,j));
128 template<
typename OtherDerived>
129 requires (!Eigen::IsIntervalDomain<typename OtherDerived::Scalar>)
130 inline auto floor(
const Eigen::MatrixBase<OtherDerived>& x)
132 return x.array().floor().matrix();
135 template<
typename OtherDerived>
136 requires (!Eigen::IsIntervalDomain<typename OtherDerived::Scalar>)
137 inline auto ceil(
const Eigen::MatrixBase<OtherDerived>& x)
139 return x.array().ceil().matrix();
142 template<
typename OtherDerived>
143 requires (!Eigen::IsIntervalDomain<typename OtherDerived::Scalar>)
144 inline auto round(
const Eigen::MatrixBase<OtherDerived>& x)
146 return x.array().round().matrix();
149 inline Eigen::IOFormat codac_row_fmt()
151 return Eigen::IOFormat(Eigen::StreamPrecision, Eigen::DontAlignCols,
" ",
"",
"",
"",
"[ ",
" ]");
154 inline Eigen::IOFormat codac_vector_fmt()
156 return Eigen::IOFormat(Eigen::StreamPrecision, Eigen::DontAlignCols,
"",
" ; ",
"",
"",
"[ ",
" ]");
159 inline Eigen::IOFormat codac_matrix_fmt()
161 return Eigen::IOFormat(Eigen::StreamPrecision, 0,
" , ",
"\n",
"[ ",
" ]",
"[",
"]");
Interval class, for representing closed and connected subsets of .
Definition codac2_Interval.h:62
Interval ceil(const Interval &x)
Returns ceil of .
Definition codac2_Interval_operations_impl.h:294
Interval floor(const Interval &x)
Returns floor of .
Definition codac2_Interval_operations_impl.h:289
Interval sqr(const Interval &x)
Returns .
Definition codac2_Interval_operations_impl.h:21
Interval abs(const Interval &x)
Returns .
Definition codac2_Interval_operations_impl.h:264