21 template<
typename... X>
22 static inline std::string str(
const X&... x)
24 std::string s = ((
"\t" + x->str() +
",\n") + ...);
25 s.pop_back(); s.pop_back();
26 return "[\n" + s +
"\n]";
29 template<
typename... X>
30 static std::pair<Index,Index> output_shape([[maybe_unused]]
const X&... x)
32 return {
sizeof...(X), 1 };
35 template<
typename... X>
36 requires (std::is_base_of_v<Interval,X> && ...)
37 static inline IntervalVector fwd(
const X&... x)
39 return IntervalVector({x...});
42 template<
typename... X>
43 requires (std::is_base_of_v<ScalarType,X> && ...)
44 static inline VectorType fwd_natural(
const X&... x)
46 bool def_domain =
true;
47 ((def_domain &= x.def_domain), ...);
55 template<
typename... X>
56 requires (std::is_base_of_v<ScalarType,X> && ...)
57 static inline VectorType fwd_centered(
const X&... x)
59 if(centered_form_not_available_for_args(x...))
60 return fwd_natural(x...);
62 IntervalMatrix d(
sizeof...(X),std::get<0>(std::tie(x...)).da.cols());
64 ((d.row(i++) = x.da), ...);
66 bool def_domain =
true;
67 ((def_domain &= x.def_domain), ...);
77 template<
typename... X>
78 requires (std::is_base_of_v<Interval,X> && ...)
79 static inline void bwd(
const IntervalVector& y, X&... x)
89 inline ScalarExpr _add_to_vec(
const ScalarExpr& x)
94 inline ScalarExpr _add_to_vec(
double x)
96 return const_value(x);
100 concept IsNotScalarExpr = !std::is_base_of_v<ScalarExpr,X>;
102 template<
typename X1>
103 requires IsNotScalarExpr<X1>
107 return { std::make_shared<AnalyticOperationExpr<VectorOp,VectorType,
112 template<
typename X1,
typename X2>
113 requires (IsNotScalarExpr<X1> && IsNotScalarExpr<X2>)
115 vec(
const X1& x1,
const X2& x2)
117 return { std::make_shared<AnalyticOperationExpr<VectorOp,VectorType,
118 ScalarType,ScalarType>>(
119 _add_to_vec(x1),_add_to_vec(x2)) };
122 template<
typename X1,
typename X2,
typename X3>
123 requires (IsNotScalarExpr<X1> && IsNotScalarExpr<X2> && IsNotScalarExpr<X3>)
125 vec(
const X1& x1,
const X2& x2,
const X3& x3)
127 return { std::make_shared<AnalyticOperationExpr<VectorOp,VectorType,
128 ScalarType,ScalarType,ScalarType>>(
129 _add_to_vec(x1),_add_to_vec(x2),_add_to_vec(x3)) };
132 template<
typename X1,
typename X2,
typename X3,
typename X4>
133 requires (IsNotScalarExpr<X1> && IsNotScalarExpr<X2> && IsNotScalarExpr<X3> && IsNotScalarExpr<X4>)
135 vec(
const X1& x1,
const X2& x2,
const X3& x3,
const X4& x4)
137 return { std::make_shared<AnalyticOperationExpr<VectorOp,VectorType,
138 ScalarType,ScalarType,ScalarType,ScalarType>>(
139 _add_to_vec(x1),_add_to_vec(x2),_add_to_vec(x3),_add_to_vec(x4)) };
142 template<
typename X1,
typename X2,
typename X3,
typename X4,
typename X5>
143 requires (IsNotScalarExpr<X1> && IsNotScalarExpr<X2> && IsNotScalarExpr<X3> && IsNotScalarExpr<X4> && IsNotScalarExpr<X5>)
145 vec(
const X1& x1,
const X2& x2,
const X3& x3,
const X4& x4,
const X5& x5)
147 return { std::make_shared<AnalyticOperationExpr<VectorOp,VectorType,
148 ScalarType,ScalarType,ScalarType,ScalarType,ScalarType>>(
149 _add_to_vec(x1),_add_to_vec(x2),_add_to_vec(x3),_add_to_vec(x4),_add_to_vec(x5)) };
152 template<
typename X1,
typename X2,
typename X3,
typename X4,
typename X5,
typename X6>
153 requires (IsNotScalarExpr<X1> && IsNotScalarExpr<X2> && IsNotScalarExpr<X3> && IsNotScalarExpr<X4> && IsNotScalarExpr<X5> && IsNotScalarExpr<X6>)
155 vec(
const X1& x1,
const X2& x2,
const X3& x3,
const X4& x4,
const X5& x5,
const X6& x6)
157 return { std::make_shared<AnalyticOperationExpr<VectorOp,VectorType,
158 ScalarType,ScalarType,ScalarType,ScalarType,ScalarType,ScalarType>>(
159 _add_to_vec(x1),_add_to_vec(x2),_add_to_vec(x3),_add_to_vec(x4),_add_to_vec(x5),_add_to_vec(x6)) };
162 template<
typename X1,
typename X2,
typename X3,
typename X4,
typename X5,
typename X6,
typename X7>
163 requires (IsNotScalarExpr<X1> && IsNotScalarExpr<X2> && IsNotScalarExpr<X3> && IsNotScalarExpr<X4> && IsNotScalarExpr<X5> && IsNotScalarExpr<X6> && IsNotScalarExpr<X7>)
165 vec(
const X1& x1,
const X2& x2,
const X3& x3,
const X4& x4,
const X5& x5,
const X6& x6,
const X7& x7)
167 return { std::make_shared<AnalyticOperationExpr<VectorOp,VectorType,
168 ScalarType,ScalarType,ScalarType,ScalarType,ScalarType,ScalarType,ScalarType>>(
169 _add_to_vec(x1),_add_to_vec(x2),_add_to_vec(x3),_add_to_vec(x4),_add_to_vec(x5),_add_to_vec(x6),_add_to_vec(x7)) };
172 template<
typename X1,
typename X2,
typename X3,
typename X4,
typename X5,
typename X6,
typename X7,
typename X8>
173 requires (IsNotScalarExpr<X1> && IsNotScalarExpr<X2> && IsNotScalarExpr<X3> && IsNotScalarExpr<X4> && IsNotScalarExpr<X5> && IsNotScalarExpr<X6> && IsNotScalarExpr<X7> && IsNotScalarExpr<X8>)
175 vec(
const X1& x1,
const X2& x2,
const X3& x3,
const X4& x4,
const X5& x5,
const X6& x6,
const X7& x7,
const X8& x8)
177 return { std::make_shared<AnalyticOperationExpr<VectorOp,VectorType,
178 ScalarType,ScalarType,ScalarType,ScalarType,ScalarType,ScalarType,ScalarType,ScalarType>>(
179 _add_to_vec(x1),_add_to_vec(x2),_add_to_vec(x3),_add_to_vec(x4),_add_to_vec(x5),_add_to_vec(x6),_add_to_vec(x7),_add_to_vec(x8)) };
182 template<
typename X1,
typename X2,
typename X3,
typename X4,
typename X5,
typename X6,
typename X7,
typename X8,
typename X9>
183 requires (IsNotScalarExpr<X1> && IsNotScalarExpr<X2> && IsNotScalarExpr<X3> && IsNotScalarExpr<X4> && IsNotScalarExpr<X5> && IsNotScalarExpr<X6> && IsNotScalarExpr<X7> && IsNotScalarExpr<X8> && IsNotScalarExpr<X9>)
185 vec(
const X1& x1,
const X2& x2,
const X3& x3,
const X4& x4,
const X5& x5,
const X6& x6,
const X7& x7,
const X8& x8,
const X9& x9)
187 return { std::make_shared<AnalyticOperationExpr<VectorOp,VectorType,
188 ScalarType,ScalarType,ScalarType,ScalarType,ScalarType,ScalarType,ScalarType,ScalarType,ScalarType>>(
189 _add_to_vec(x1),_add_to_vec(x2),_add_to_vec(x3),_add_to_vec(x4),_add_to_vec(x5),_add_to_vec(x6),_add_to_vec(x7),_add_to_vec(x8),_add_to_vec(x9)) };
192 template<
typename X1,
typename X2,
typename X3,
typename X4,
typename X5,
typename X6,
typename X7,
typename X8,
typename X9,
typename X10>
193 requires (IsNotScalarExpr<X1> && IsNotScalarExpr<X2> && IsNotScalarExpr<X3> && IsNotScalarExpr<X4> && IsNotScalarExpr<X5> && IsNotScalarExpr<X6> && IsNotScalarExpr<X7> && IsNotScalarExpr<X8> && IsNotScalarExpr<X9> && IsNotScalarExpr<X10>)
195 vec(
const X1& x1,
const X2& x2,
const X3& x3,
const X4& x4,
const X5& x5,
const X6& x6,
const X7& x7,
const X8& x8,
const X9& x9,
const X10& x10)
197 return { std::make_shared<AnalyticOperationExpr<VectorOp,VectorType,
198 ScalarType,ScalarType,ScalarType,ScalarType,ScalarType,ScalarType,ScalarType,ScalarType,ScalarType,ScalarType>>(
199 _add_to_vec(x1),_add_to_vec(x2),_add_to_vec(x3),_add_to_vec(x4),_add_to_vec(x5),_add_to_vec(x6),_add_to_vec(x7),_add_to_vec(x8),_add_to_vec(x9),_add_to_vec(x10)) };
204 template<
typename... X>
206 vec(
const AnalyticExprWrapper<X>&... x)
208 return { std::make_shared<AnalyticOperationExpr<VectorOp,VectorType,X...>>(x...) };