31template<
typename U=Scalar>
32 requires IsIntervalDomain<U>
39 for(Index i = 0 ; i < this->rows() ; i++)
40 for(Index j = 0 ; j < this->cols() ; j++)
44 v += std::log((*
this)(i,j).
diam());
58 for(Index i = 0 ; i < rows() ; i++)
59 for(Index j = 0 ; j < cols() ; j++)
69#define degenerate_mat(op) \
70 Matrix<double,RowsAtCompileTime,ColsAtCompileTime> m(this->rows(),this->cols()); \
72 if(this->is_empty()) \
73 m.init(std::numeric_limits<double>::quiet_NaN()); \
77 for(Index i = 0 ; i < this->rows() ; i++) \
78 for(Index j = 0 ; j < this->cols() ; j++) \
79 m(i,j) = (*this)(i,j).op(); \
89template<
typename U=Scalar>
90 requires IsIntervalDomain<U>
101template<
typename U=Scalar>
102 requires IsIntervalDomain<U>
103inline auto ub()
const
115template<
typename U=Scalar>
116 requires IsIntervalDomain<U>
129template<
typename U=Scalar>
130 requires IsIntervalDomain<U>
141template<
typename U=Scalar>
142 requires IsIntervalDomain<U>
155template<
typename U=Scalar>
156 requires IsIntervalDomain<U>
167template<
typename U=Scalar>
168 requires IsIntervalDomain<U>
181template<
typename U=Scalar>
182 requires IsIntervalDomain<U>
195template<
typename U=Scalar>
196 requires IsIntervalDomain<U>
209template<
typename U=Scalar>
210 requires IsIntervalDomain<U>
222 requires IsIntervalDomain<Scalar>
233 requires IsIntervalDomain<Scalar>
244 requires IsIntervalDomain<Scalar>
255 requires IsIntervalDomain<Scalar>
266 requires IsIntervalDomain<Scalar>
277 requires IsIntervalDomain<Scalar>
299 requires IsIntervalDomain<Scalar>
305 double d = min ? codac2::oo : -1;
306 int selected_index = -1;
307 bool unbounded =
false;
308 assert_release(!this->
is_empty() &&
"Diameter of an empty IntervalVector is undefined");
312 for(i = 0 ; i < this->size() ; i++)
321 double w = coeff(i).diam();
330 if(min && selected_index == -1)
339 if(unbounded && (!min || selected_index == -1))
341 double pt = min ? -codac2::oo : codac2::oo;
344 for(; i < this->size() ; i++)
346 if(coeff(i).
lb() == -codac2::oo)
348 if(coeff(i).
ub() == codac2::oo)
355 if((min && (-coeff(i).
ub() > pt)) || (!min && (-coeff(i).
ub() < pt)))
362 else if(coeff(i).
ub() == codac2::oo)
363 if((min && (coeff(i).
lb() > pt)) || (!min && (coeff(i).
lb() < pt)))
371 return selected_index;
393template<
typename OtherDerived>
394inline bool contains(
const MatrixBase<OtherDerived>& x)
const
405 assert_release(x.size() == this->size());
410 for(Index i = 0 ; i < this->rows() ; i++)
411 for(Index j = 0 ; j < this->cols() ; j++)
437template<
typename OtherDerived>
449 assert_release(x.size() == this->size());
454 for(Index i = 0 ; i < this->rows() ; i++)
455 for(Index j = 0 ; j < this->cols() ; j++)
470 for(Index i = 0 ; i < this->rows() ; i++)
471 for(Index j = 0 ; j < this->cols() ; j++)
486 for(Index i = 0 ; i < this->rows() ; i++)
487 for(Index j = 0 ; j < this->cols() ; j++)
504 for(Index i = 0 ; i < this->rows() ; i++)
505 for(Index j = 0 ; j < this->cols() ; j++)
530template<
typename OtherDerived>
531inline bool intersects(
const MatrixBase<OtherDerived>& x)
const
539template<
typename OtherDerived>
542 assert_release(this->size() == x.size());
547 for(Index i = 0 ; i < this->rows() ; i++)
548 for(Index j = 0 ; j < this->cols() ; j++)
574template<
typename OtherDerived>
583template<
typename OtherDerived>
586 assert_release(this->size() == x.size());
591 for(Index i = 0 ; i < this->rows() ; i++)
592 for(Index j = 0 ; j < this->cols() ; j++)
618template<
typename OtherDerived>
619inline bool overlaps(
const MatrixBase<OtherDerived>& x)
const
627template<
typename OtherDerived>
628inline bool _overlaps(
const MatrixBase<OtherDerived>& x)
const
630 assert_release(this->size() == x.size());
635 for(Index i = 0 ; i < this->rows() ; i++)
636 for(Index j = 0 ; j < this->cols() ; j++)
663template<
typename OtherDerived>
664inline bool is_subset(
const MatrixBase<OtherDerived>& x)
const
675 assert_release(this->size() == x.size());
680 for(Index i = 0 ; i < this->rows() ; i++)
681 for(Index j = 0 ; j < this->cols() ; j++)
707template<
typename OtherDerived>
719 assert_release(this->size() == x.size());
727 for(Index i = 0 ; i < this->rows() ; i++)
728 for(Index j = 0 ; j < this->cols() ; j++)
754template<
typename OtherDerived>
763template<
typename OtherDerived>
766 assert_release(this->size() == x.size());
771 for(Index i = 0 ; i < this->rows() ; i++)
772 for(Index j = 0 ; j < this->cols() ; j++)
799template<
typename OtherDerived>
808template<
typename OtherDerived>
811 assert_release(this->size() == x.size());
816 for(Index i = 0 ; i < this->rows() ; i++)
817 for(Index j = 0 ; j < this->cols() ; j++)
843template<
typename OtherDerived>
852template<
typename OtherDerived>
855 assert_release(this->size() == x.size());
860 for(Index i = 0 ; i < this->rows() ; i++)
861 for(Index j = 0 ; j < this->cols() ; j++)
888template<
typename OtherDerived>
897template<
typename OtherDerived>
900 assert_release(this->size() == x.size());
908 for(Index i = 0 ; i < this->rows() ; i++)
909 for(Index j = 0 ; j < this->cols() ; j++)
925 for(Index i = 0 ; i < this->rows() ; i++)
926 for(Index j = 0 ; j < this->cols() ; j++)
939 for(Index i = 0 ; i < this->rows() ; i++)
940 for(Index j = 0 ; j < this->cols() ; j++)
Matrix(const Matrix< double, R, C > &lb, const Matrix< double, R, C > &ub)
Constructs an interval matrix from lower and upper bound matrices.
Definition codac2_Matrix_addons_IntervalMatrixBase.h:50
bool overlaps(const Matrix< codac2::Interval, RowsAtCompileTime, ColsAtCompileTime > &x) const
Checks whether this matrix overlaps with another.
Definition codac2_MatrixBase_addons_IntervalMatrixBase.h:607
auto lb() const
Returns a matrix containing the lower bounds of each interval element.
Definition codac2_MatrixBase_addons_IntervalMatrixBase.h:91
bool is_strict_superset(const Matrix< codac2::Interval, RowsAtCompileTime, ColsAtCompileTime > &x) const
Checks whether this matrix is a strict superset of another matrix.
Definition codac2_MatrixBase_addons_IntervalMatrixBase.h:877
auto mid() const
Returns a matrix containing the midpoints of each interval element.
Definition codac2_MatrixBase_addons_IntervalMatrixBase.h:117
bool is_degenerated() const
Checks if the interval matrix is degenerated.
Definition codac2_MatrixBase_addons_IntervalMatrixBase.h:484
bool is_superset(const Matrix< codac2::Interval, RowsAtCompileTime, ColsAtCompileTime > &x) const
Checks whether this matrix is a superset of another interval matrix.
Definition codac2_MatrixBase_addons_IntervalMatrixBase.h:832
auto smig() const
Returns a matrix containing the signed mignitudes of each interval element.
Definition codac2_MatrixBase_addons_IntervalMatrixBase.h:169
bool is_unbounded() const
Checks if the interval matrix contains any unbounded intervals.
Definition codac2_MatrixBase_addons_IntervalMatrixBase.h:467
auto mag() const
Returns a matrix containing the magnitudes of each interval element.
Definition codac2_MatrixBase_addons_IntervalMatrixBase.h:131
bool _is_subset(const T &x) const
Internal helper for subset check.
Definition codac2_MatrixBase_addons_IntervalMatrixBase.h:673
bool is_interior_subset(const Matrix< codac2::Interval, RowsAtCompileTime, ColsAtCompileTime > &x) const
Checks whether this matrix is an interior subset of another.
Definition codac2_MatrixBase_addons_IntervalMatrixBase.h:743
bool is_strict_subset(const Matrix< codac2::Interval, RowsAtCompileTime, ColsAtCompileTime > &x) const
Checks whether this matrix is a strict subset of another matrix.
Definition codac2_MatrixBase_addons_IntervalMatrixBase.h:696
auto diam() const
Returns a matrix containing the diameters of each interval element.
Definition codac2_MatrixBase_addons_IntervalMatrixBase.h:211
bool is_empty() const
Checks whether the interval matrix is empty.
Definition codac2_MatrixBase_addons_IntervalMatrixBase.h:56
Index max_diam_index() const
Returns the index of the element with the maximum diameter.
Definition codac2_MatrixBase_addons_IntervalMatrixBase.h:276
bool _is_strict_subset(const T &x) const
Internal helper for strict subset check.
Definition codac2_MatrixBase_addons_IntervalMatrixBase.h:717
bool interior_contains(const Matrix< double, RowsAtCompileTime, ColsAtCompileTime > &x) const
Checks if the interior of this interval matrix contains the specified matrix x.
Definition codac2_MatrixBase_addons_IntervalMatrixBase.h:426
double min_diam() const
Returns the minimum diameter among the interval elements.
Definition codac2_MatrixBase_addons_IntervalMatrixBase.h:243
bool is_subset(const Matrix< codac2::Interval, RowsAtCompileTime, ColsAtCompileTime > &x) const
Checks whether this matrix is a subset of another interval matrix.
Definition codac2_MatrixBase_addons_IntervalMatrixBase.h:652
bool _overlaps(const MatrixBase< OtherDerived > &x) const
Internal helper to check overlap.
Definition codac2_MatrixBase_addons_IntervalMatrixBase.h:628
auto smag() const
Returns a matrix containing the signed magnitudes of each interval element.
Definition codac2_MatrixBase_addons_IntervalMatrixBase.h:157
bool is_disjoint(const Matrix< codac2::Interval, RowsAtCompileTime, ColsAtCompileTime > &x) const
Checks if this matrix is disjoint with another matrix of intervals.
Definition codac2_MatrixBase_addons_IntervalMatrixBase.h:563
auto mig() const
Returns a matrix containing the mignitudes of each interval element.
Definition codac2_MatrixBase_addons_IntervalMatrixBase.h:143
bool _is_interior_subset(const MatrixBase< OtherDerived > &x) const
Internal helper for interior subset checking.
Definition codac2_MatrixBase_addons_IntervalMatrixBase.h:764
double min_rad() const
Returns the minimum radius among the interval elements.
Definition codac2_MatrixBase_addons_IntervalMatrixBase.h:221
#define degenerate_mat(op)
Helper macro to create a matrix from a specific operation applied to each interval element.
Definition codac2_MatrixBase_addons_IntervalMatrixBase.h:69
bool _interior_contains(const T &x) const
Internal helper function to check interior containment.
Definition codac2_MatrixBase_addons_IntervalMatrixBase.h:447
bool is_strict_interior_subset(const Matrix< codac2::Interval, RowsAtCompileTime, ColsAtCompileTime > &x) const
Checks whether this matrix is a strict interior subset of another matrix.
Definition codac2_MatrixBase_addons_IntervalMatrixBase.h:788
bool _is_strict_interior_subset(const MatrixBase< OtherDerived > &x) const
Internal helper for strict interior subset relation.
Definition codac2_MatrixBase_addons_IntervalMatrixBase.h:809
bool is_flat() const
Checks if the interval matrix is flat.
Definition codac2_MatrixBase_addons_IntervalMatrixBase.h:501
bool is_bisectable() const
Checks whether at least one interval in the matrix is bisectable.
Definition codac2_MatrixBase_addons_IntervalMatrixBase.h:923
bool _is_superset(const MatrixBase< OtherDerived > &x) const
Internal helper for superset check.
Definition codac2_MatrixBase_addons_IntervalMatrixBase.h:853
auto ub() const
Returns a matrix containing the upper bounds of each interval element.
Definition codac2_MatrixBase_addons_IntervalMatrixBase.h:103
auto rand() const
Returns a matrix with random values chosen inside each interval element.
Definition codac2_MatrixBase_addons_IntervalMatrixBase.h:183
bool _contains(const T &x) const
Internal helper function to check containment.
Definition codac2_MatrixBase_addons_IntervalMatrixBase.h:403
Index extr_diam_index(bool min) const
Returns the index of the element with the minimum or maximum diameter.
Definition codac2_MatrixBase_addons_IntervalMatrixBase.h:298
bool has_integer_bounds() const
Checks whether all intervals in the matrix have integer lower and upper bounds.
Definition codac2_MatrixBase_addons_IntervalMatrixBase.h:937
bool contains(const Matrix< double, RowsAtCompileTime, ColsAtCompileTime > &x) const
Checks if this interval matrix contains the specified matrix x.
Definition codac2_MatrixBase_addons_IntervalMatrixBase.h:382
auto rad() const
Returns a matrix containing the radii of each interval element.
Definition codac2_MatrixBase_addons_IntervalMatrixBase.h:197
bool _intersects(const MatrixBase< OtherDerived > &x) const
Internal helper that performs intersection checking.
Definition codac2_MatrixBase_addons_IntervalMatrixBase.h:540
Index min_diam_index() const
Returns the index of the element with the minimum diameter.
Definition codac2_MatrixBase_addons_IntervalMatrixBase.h:265
double max_diam() const
Returns the maximum diameter among the interval elements.
Definition codac2_MatrixBase_addons_IntervalMatrixBase.h:254
double volume() const
Computes the volume of the interval matrix.
Definition codac2_MatrixBase_addons_IntervalMatrixBase.h:33
bool _is_disjoint(const MatrixBase< OtherDerived > &x) const
Internal helper for disjointness checking.
Definition codac2_MatrixBase_addons_IntervalMatrixBase.h:584
double max_rad() const
Returns the maximum radius among the interval elements.
Definition codac2_MatrixBase_addons_IntervalMatrixBase.h:232
bool intersects(const Matrix< codac2::Interval, RowsAtCompileTime, ColsAtCompileTime > &x) const
Checks whether this matrix intersects with another matrix of intervals.
Definition codac2_MatrixBase_addons_IntervalMatrixBase.h:519
bool _is_strict_superset(const MatrixBase< OtherDerived > &x) const
Internal helper for strict superset check.
Definition codac2_MatrixBase_addons_IntervalMatrixBase.h:898