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"
56 template<>
struct NumTraits<codac2::Interval>
59 typedef codac2::Interval Real;
60 typedef codac2::Interval NonInteger;
61 typedef codac2::Interval Nested;
62 typedef codac2::Interval Scalar;
63 typedef double RealScalar;
69 RequireInitialization = 1,
76 template<
typename BinOp>
77 struct ScalarBinaryOpTraits<codac2::Interval,double,BinOp>
78 {
typedef codac2::Interval ReturnType; };
80 template<
typename BinOp>
81 struct ScalarBinaryOpTraits<double,codac2::Interval,BinOp>
82 {
typedef codac2::Interval ReturnType; };
95 template<
typename Scalar,
int R,
int C>
96 using Mat = Eigen::Matrix<Scalar,R,C>;
99 struct is_interval_based<Eigen::Matrix<double,R,C>> : std::false_type {};
101 template<
int R,
int C>
102 struct is_interval_based<Eigen::Matrix<Interval,R,C>> : std::true_type {};
104 template<
typename T,
int R,
int C>
105 struct is_ctc<Eigen::Matrix<T,R,C>> : std::false_type {};
107 template<
typename T,
int R,
int C>
108 struct is_sep<Eigen::Matrix<T,R,C>> : std::false_type {};
113 template<
typename OtherDerived>
114 inline auto abs(
const Eigen::MatrixBase<OtherDerived>& x)
116 using M = Eigen::MatrixBase<OtherDerived>;
117 Eigen::Matrix<typename M::Scalar,M::RowsAtCompileTime,M::ColsAtCompileTime> a(x.rows(),x.cols());
119 for(Index i = 0 ; i < x.rows() ; i++)
120 for(Index j = 0 ; j < x.cols() ; j++)
122 if constexpr(std::is_same_v<typename M::Scalar,double>)
123 a(i,j) = fabs(x(i,j));
125 a(i,j) =
abs(x(i,j));
131 template<
typename OtherDerived>
132 requires (!Eigen::IsIntervalDomain<typename OtherDerived::Scalar>)
133 inline auto floor(
const Eigen::MatrixBase<OtherDerived>& x)
135 return x.array().floor().matrix();
138 template<
typename OtherDerived>
139 requires (!Eigen::IsIntervalDomain<typename OtherDerived::Scalar>)
140 inline auto ceil(
const Eigen::MatrixBase<OtherDerived>& x)
142 return x.array().ceil().matrix();
145 template<
typename OtherDerived>
146 requires (!Eigen::IsIntervalDomain<typename OtherDerived::Scalar>)
147 inline auto round(
const Eigen::MatrixBase<OtherDerived>& x)
149 return x.array().round().matrix();
152 inline Eigen::IOFormat codac_row_fmt()
154 return Eigen::IOFormat(Eigen::StreamPrecision, Eigen::DontAlignCols,
" ",
"",
"",
"",
"[ ",
" ]");
157 inline Eigen::IOFormat codac_vector_fmt()
159 return Eigen::IOFormat(Eigen::StreamPrecision, Eigen::DontAlignCols,
"",
" ; ",
"",
"",
"[ ",
" ]");
162 inline Eigen::IOFormat codac_matrix_fmt()
164 return Eigen::IOFormat(Eigen::StreamPrecision, 0,
" , ",
"\n",
"[ ",
" ]",
"[",
"]");
Interval class, for representing closed and connected subsets of .
Definition codac2_Interval.h:49
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