codac 1.5.6
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 ValueType<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 ValueType<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}