codac 1.5.6
Loading...
Searching...
No Matches
codac2_set_operations.h
Go to the documentation of this file.
1
9
10#pragma once
11
12#include <memory>
16
17namespace codac2
18{
19 using SetExpr_ptr = std::shared_ptr<SetExpr>;
20
21 inline SetExpr_ptr
22 operator&(const SetExpr_ptr& x1, const SetExpr_ptr& x2)
23 {
24 return std::make_shared<SetOperationExpr<InterSetOp,SetExpr,SetExpr>>(x1,x2);
25 }
26
27 inline SetExpr_ptr
28 operator&(const IntervalVector& x1, const SetExpr_ptr& x2)
29 {
30 return std::make_shared<SetOperationExpr<InterSetOp,SetExpr,SetExpr>>(const_set(x1),x2);
31 }
32
33 inline SetExpr_ptr
34 operator&(const SetExpr_ptr& x1, const IntervalVector& x2)
35 {
36 return std::make_shared<SetOperationExpr<InterSetOp,SetExpr,SetExpr>>(x1,const_set(x2));
37 }
38
39 inline SetExpr_ptr
40 operator|(const SetExpr_ptr& x1, const SetExpr_ptr& x2)
41 {
42 return std::make_shared<SetOperationExpr<UnionSetOp,SetExpr,SetExpr>>(x1,x2);
43 }
44
45 inline SetExpr_ptr
46 operator|(const IntervalVector& x1, const SetExpr_ptr& x2)
47 {
48 return std::make_shared<SetOperationExpr<UnionSetOp,SetExpr,SetExpr>>(const_set(x1),x2);
49 }
50
51 inline SetExpr_ptr
52 operator|(const SetExpr_ptr& x1, const IntervalVector& x2)
53 {
54 return std::make_shared<SetOperationExpr<UnionSetOp,SetExpr,SetExpr>>(x1,const_set(x2));
55 }
56
57 inline SetExpr_ptr
58 proj(const SetExpr_ptr& x1, const std::vector<Index>& proj_indices, double eps = 0.01)
59 {
60 return std::make_shared<SetOperationExpr<ProjSetOp,SetExpr>>(x1,proj_indices,eps);
61 }
62
63 inline SetExpr_ptr
64 proj(const SetExpr_ptr& x1, const std::vector<Index>& proj_indices, const IntervalVector& y, double eps = 0.01)
65 {
66 return std::make_shared<SetOperationExpr<ProjSetOp,SetExpr>>(x1,proj_indices,y,eps);
67 }
68
69 inline SetExpr_ptr
70 cart_prod(const SetExpr_ptr& x1, const SetExpr_ptr& x2)
71 {
72 return std::make_shared<SetOperationExpr<CartProdSetOp,SetExpr,SetExpr>>(x1,x2);
73 }
74
75 inline SetExpr_ptr
76 cart_prod(const SetExpr_ptr& x1, const IntervalVector& x2)
77 {
78 return std::make_shared<SetOperationExpr<CartProdSetOp,SetExpr,SetExpr>>(x1,const_set(x2));
79 }
80
81 inline SetExpr_ptr
82 cart_prod(const IntervalVector& x1, const SetExpr_ptr& x2)
83 {
84 return std::make_shared<SetOperationExpr<CartProdSetOp,SetExpr,SetExpr>>(const_set(x1),x2);
85 }
86
87 inline SetExpr_ptr
88 inverse(const AnalyticFunction<VectorType>& f, const SetExpr_ptr& x1)
89 {
90 return std::make_shared<SetOperationExpr<InverseSetOp,SetExpr>>(f,x1);
91 }
92
93 inline SetExpr_ptr
94 inverse(const AnalyticFunction<VectorType>& f, const IntervalVector& x1)
95 {
96 return std::make_shared<SetOperationExpr<InverseSetOp,SetExpr>>(f,const_set(x1));
97 }
98
99 inline SetExpr_ptr
100 operator!(const IntervalVector& x1)
101 {
102 return std::make_shared<SetOperationExpr<NotSetOp,SetExpr>>(const_set(x1));
103 }
104
105 inline SetExpr_ptr
106 operator!(const SetExpr_ptr& x1)
107 {
108 return std::make_shared<SetOperationExpr<NotSetOp,SetExpr>>(x1);
109 }
110
111 inline std::shared_ptr<SetExpr>
112 OctaSym::operator()(const std::shared_ptr<SetExpr>& x1) const
113 {
114 return std::make_shared<SetOperationExpr<ActionSetOp,SetExpr>>(*this,x1);
115 }
116}