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 {};
125 template<
typename OtherDerived>
126 inline auto abs(
const Eigen::MatrixBase<OtherDerived>& x)
128 using M = Eigen::MatrixBase<OtherDerived>;
129 Eigen::Matrix<typename M::Scalar,M::RowsAtCompileTime,M::ColsAtCompileTime> a(x.rows(),x.cols());
131 for(Index i = 0 ; i < x.rows() ; i++)
132 for(Index j = 0 ; j < x.cols() ; j++)
134 if constexpr(std::is_same_v<typename M::Scalar,double>)
135 a(i,j) = fabs(x(i,j));
137 a(i,j) =
abs(x(i,j));
154 template<
typename OtherDerived>
155 requires (!Eigen::IsIntervalDomain<typename OtherDerived::Scalar>)
156 inline auto floor(
const Eigen::MatrixBase<OtherDerived>& x)
158 return x.array().floor().matrix();
172 template<
typename OtherDerived>
173 requires (!Eigen::IsIntervalDomain<typename OtherDerived::Scalar>)
174 inline auto ceil(
const Eigen::MatrixBase<OtherDerived>& x)
176 return x.array().ceil().matrix();
190 template<
typename OtherDerived>
191 requires (!Eigen::IsIntervalDomain<typename OtherDerived::Scalar>)
192 inline auto round(
const Eigen::MatrixBase<OtherDerived>& x)
194 return x.array().round().matrix();
207 return Eigen::IOFormat(Eigen::StreamPrecision, Eigen::DontAlignCols,
" ",
"",
"",
"",
"[ ",
" ]");
220 return Eigen::IOFormat(Eigen::StreamPrecision, Eigen::DontAlignCols,
"",
" ; ",
"",
"",
"[ ",
" ]");
234 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
Eigen::Matrix< double,-1,-1 > Matrix
Alias for a dynamic-size matrix of doubles.
Definition codac2_Matrix.h:26
auto round(const Eigen::MatrixBase< OtherDerived > &x)
Compute the element-wise rounding of a matrix.
Definition codac2_matrices.h:192
Eigen::IOFormat codac_vector_fmt()
Provides an Eigen IOFormat for formatting column vectors.
Definition codac2_matrices.h:218
Eigen::IOFormat codac_row_fmt()
Provides an Eigen IOFormat for formatting row vectors.
Definition codac2_matrices.h:205
Eigen::IOFormat codac_matrix_fmt()
Provides an Eigen IOFormat for formatting matrices.
Definition codac2_matrices.h:232