codac 2.0.0
Loading...
Searching...
No Matches
codac2_CtcInverseNotIn.h
Go to the documentation of this file.
1
9
10#pragma once
11
12#include <map>
13#include "codac2_CtcUnion.h"
14#include "codac2_CtcInverse.h"
15
16namespace codac2
17{
18 template<typename Y,typename X=IntervalVector>
19 class CtcInverseNotIn : public CtcUnion<X>
20 {
21 public:
22
23 CtcInverseNotIn(const AnalyticFunction<typename ExprType<Y>::Type>& f, const Y& y, bool with_centered_form = true)
24 : CtcUnion<X>(f.args()[0]->size() /* f must have only one arg, see following assert */)
25 {
26 assert_release(f.args().size() == 1 && "f must have only one arg");
27 const bool is_not_in = true;
28
29 Y f_codomain(y);
30
31 if constexpr(std::is_same_v<X,Interval>)
32 f_codomain = f.eval(Interval());
33 else if constexpr(std::is_same_v<X,IntervalVector>)
34 f_codomain = f.eval(IntervalVector(f.args()[0]->size()));
35 else
36 std::cout << "CtcInverseNotIn: matrices expressions not (yet) supported" << std::endl;
37
38 for(const auto& complem_y : y.complementary())
39 {
40 Y w = complem_y & f_codomain;
41 if(!w.is_empty() && !w.is_subset(y))
42 *this |= CtcInverse<Y,X>(f, complem_y, with_centered_form, is_not_in);
43 }
44 }
45
46 template<typename C>
47 requires IsCtcBaseOrPtr<C,Y>
48 CtcInverseNotIn(const AnalyticFunction<typename ExprType<Y>::Type>& f, const C& ctc_compl, bool with_centered_form = true)
49 : CtcUnion<X>(f.args()[0]->size() /* f must have only one arg, see following assert */)
50 {
51 assert_release(f.args().size() == 1 && "f must have only one arg");
52 const bool is_not_in = true;
53
54 *this |= CtcInverse<Y,X>(f, ctc_compl, with_centered_form, is_not_in);
55 }
56
57 void contract(X& x) const
58 {
59 CtcUnion<X>::contract(x);
60 }
61 };
62
63 // Template deduction guides
64 // Same as CtcInverse
65
66 // ScalarType
67
68 CtcInverseNotIn(const AnalyticFunction<ScalarType>&, std::initializer_list<double>, bool = true, bool = false) ->
69 CtcInverseNotIn<Interval,IntervalVector>;
70
71 template<typename Y>
72 CtcInverseNotIn(const AnalyticFunction<ScalarType>&, std::initializer_list<Y>, bool = true, bool = false) ->
73 CtcInverseNotIn<Interval,IntervalVector>;
74
75 CtcInverseNotIn(const AnalyticFunction<ScalarType>&, const Interval&, bool = true, bool = false) ->
76 CtcInverseNotIn<Interval,IntervalVector>;
77
78 CtcInverseNotIn(const AnalyticFunction<ScalarType>&, double, bool = true, bool = false) ->
79 CtcInverseNotIn<Interval,IntervalVector>;
80
81 template<typename C>
82 requires IsCtcBaseOrPtr<C,Interval>
83 CtcInverseNotIn(const AnalyticFunction<ScalarType>&, const C&, bool = true, bool = false) ->
84 CtcInverseNotIn<Interval,IntervalVector>;
85
86 // VectorType
87
88 CtcInverseNotIn(const AnalyticFunction<VectorType>&, std::initializer_list<double>, bool = true, bool = false) ->
89 CtcInverseNotIn<IntervalVector,IntervalVector>;
90
91 CtcInverseNotIn(const AnalyticFunction<VectorType>&, std::initializer_list<std::initializer_list<double>>, bool = true, bool = false) ->
92 CtcInverseNotIn<IntervalVector,IntervalVector>;
93
94 CtcInverseNotIn(const AnalyticFunction<VectorType>&, const Vector&, bool = true, bool = false) ->
95 CtcInverseNotIn<IntervalVector,IntervalVector>;
96
97 CtcInverseNotIn(const AnalyticFunction<VectorType>&, const IntervalVector&, bool = true, bool = false) ->
98 CtcInverseNotIn<IntervalVector,IntervalVector>;
99
100 template<typename OtherDerived>
101 requires (OtherDerived::RowsAtCompileTime == -1 && OtherDerived::ColsAtCompileTime == 1)
102 CtcInverseNotIn(const AnalyticFunction<VectorType>&, const Eigen::MatrixBase<OtherDerived>&, bool = true, bool = false) ->
103 CtcInverseNotIn<IntervalVector,IntervalVector>;
104
105 template<typename C>
106 requires IsCtcBaseOrPtr<C,IntervalVector>
107 CtcInverseNotIn(const AnalyticFunction<VectorType>&, const C&, bool = true, bool = false) ->
108 CtcInverseNotIn<IntervalVector,IntervalVector>;
109
110 // MatrixType
111
112 CtcInverseNotIn(const AnalyticFunction<MatrixType>&, std::initializer_list<std::initializer_list<double>>, bool = true, bool = false) ->
113 CtcInverseNotIn<IntervalMatrix,IntervalVector>;
114
115 CtcInverseNotIn(const AnalyticFunction<MatrixType>&, std::initializer_list<std::initializer_list<std::initializer_list<double>>>, bool = true, bool = false) ->
116 CtcInverseNotIn<IntervalMatrix,IntervalVector>;
117
118 template<typename OtherDerived>
119 requires (OtherDerived::RowsAtCompileTime == -1 && OtherDerived::ColsAtCompileTime == -1)
120 CtcInverseNotIn(const AnalyticFunction<MatrixType>&, const Eigen::MatrixBase<OtherDerived>&, bool = true, bool = false) ->
121 CtcInverseNotIn<IntervalMatrix,IntervalVector>;
122
123 template<typename C>
124 requires IsCtcBaseOrPtr<C,IntervalMatrix>
125 CtcInverseNotIn(const AnalyticFunction<MatrixType>&, const C&, bool = true, bool = false) ->
126 CtcInverseNotIn<IntervalMatrix,IntervalVector>;
127}
Interval class, for representing closed and connected subsets of .
Definition codac2_Interval.h:49
Definition codac2_OctaSym.h:21
Eigen::Matrix< double,-1, 1 > Vector
Alias for a dynamically-sized column vector of doubles.
Definition codac2_Vector.h:24
Eigen::Matrix< Interval,-1, 1 > IntervalVector
Alias for a dynamic-size column vector of intervals.
Definition codac2_IntervalVector.h:25