24 template<
typename Y,
typename... X>
25 requires (
sizeof...(X) > 0)
26 class CtcInverse : public Ctc<CtcInverse<Y,X...>,X...>
30 using Ctc<CtcInverse<Y,X...>,X...>::contract;
33 requires IsCtcBaseOrPtr<C,Y>
34 CtcInverse(
const AnalyticFunction<
typename ExprType<Y>::Type>& f,
const C& ctc_y,
bool with_centered_form =
true,
bool is_not_in =
false,
double freq = 0.)
35 : Ctc<CtcInverse<Y,X...>,X...>(f.args()[0]->size()), _f(f), _ctc_y(ctc_y), _with_centered_form(with_centered_form), _is_not_in(is_not_in), _freq(freq)
37 assert_release([&]() {
return f.output_size() == size_of(ctc_y); }()
38 &&
"CtcInverse: invalid dimension of image argument ('y' or 'ctc_y')");
41 CtcInverse(
const AnalyticFunction<
typename ExprType<Y>::Type>& f,
const Y& y,
bool with_centered_form =
true,
bool is_not_in =
false,
double freq = 0.)
42 : CtcInverse(f, CtcWrapper<Y,Y>(y), with_centered_form, is_not_in, freq)
45 void contract(X&... x)
const
47 return contract_(*_ctc_y.front(), x...);
50 void contract_(
const Y& y, X&... x)
const
52 return contract_(CtcWrapper<Y,Y>(y), x...);
55 void contract_(
const CtcBase<Y>& ctc_y, X&... x)
const
61bool using_centered =
true;
65 _f.fill_from_args(v, x...);
70 _f.expr()->fwd_eval(v, _f.args().total_size(), !using_centered);
71 auto& val_expr = _f.expr()->value(v);
73 if(_is_not_in && !val_expr.def_domain)
81 ctc_y.contract(val_expr.a);
91 _f.expr()->bwd_eval(v);
92 _f.intersect_from_args(v, x...);
102 using X0 = std::tuple_element_t<0, std::tuple<X...>>;
104 if constexpr(
sizeof...(X) == 1 && std::is_same_v<X0,IntervalVector>)
106 X0& x_ = std::get<0>(std::tie(x...));
107 X0 x_mid = X0(x_.mid());
109 assert(val_expr.a.size() == val_expr.m.size());
111 if constexpr(std::is_same_v<Y,IntervalMatrix>)
113 std::cout <<
"CtcInverse: matrices expressions not (yet) supported with centered form" << std::endl;
120 MulOp::bwd(fm, val_expr.da, p);
141 const AnalyticFunction<typename ExprType<Y>::Type>& function()
const
150 bool _both_then_one =
true;
154 const AnalyticFunction<typename ExprType<Y>::Type> _f;
155 const Collection<CtcBase<Y>> _ctc_y;
156 bool _with_centered_form;
157 bool _is_not_in =
false;
165 CtcInverse(
const AnalyticFunction<ScalarType>&, std::initializer_list<double>,
bool =
true,
bool =
false) ->
166 CtcInverse<Interval,IntervalVector>;
169 CtcInverse(
const AnalyticFunction<ScalarType>&, std::initializer_list<Y>,
bool =
true,
bool =
false) ->
170 CtcInverse<Interval,IntervalVector>;
172 CtcInverse(
const AnalyticFunction<ScalarType>&,
const Interval&,
bool =
true,
bool =
false) ->
173 CtcInverse<Interval,IntervalVector>;
175 CtcInverse(
const AnalyticFunction<ScalarType>&,
double,
bool =
true,
bool =
false) ->
176 CtcInverse<Interval,IntervalVector>;
179 requires IsCtcBaseOrPtr<C,Interval>
180 CtcInverse(
const AnalyticFunction<ScalarType>&,
const C&,
bool =
true,
bool =
false) ->
181 CtcInverse<Interval,IntervalVector>;
185 CtcInverse(
const AnalyticFunction<VectorType>&, std::initializer_list<double>,
bool =
true,
bool =
false) ->
186 CtcInverse<IntervalVector,IntervalVector>;
188 CtcInverse(
const AnalyticFunction<VectorType>&, std::initializer_list<std::initializer_list<double>>,
bool =
true,
bool =
false) ->
189 CtcInverse<IntervalVector,IntervalVector>;
191 CtcInverse(
const AnalyticFunction<VectorType>&,
const Vector&,
bool =
true,
bool =
false) ->
192 CtcInverse<IntervalVector,IntervalVector>;
194 CtcInverse(
const AnalyticFunction<VectorType>&,
const IntervalVector&,
bool =
true,
bool =
false) ->
195 CtcInverse<IntervalVector,IntervalVector>;
197 template<
typename OtherDerived>
198 requires (OtherDerived::RowsAtCompileTime == -1 && OtherDerived::ColsAtCompileTime == 1)
199 CtcInverse(
const AnalyticFunction<VectorType>&,
const Eigen::MatrixBase<OtherDerived>&,
bool =
true,
bool =
false) ->
200 CtcInverse<IntervalVector,IntervalVector>;
203 requires IsCtcBaseOrPtr<C,IntervalVector>
204 CtcInverse(
const AnalyticFunction<VectorType>&,
const C&,
bool =
true,
bool =
false) ->
205 CtcInverse<IntervalVector,IntervalVector>;
209 CtcInverse(
const AnalyticFunction<MatrixType>&, std::initializer_list<std::initializer_list<double>>,
bool =
true,
bool =
false) ->
210 CtcInverse<IntervalMatrix,IntervalVector>;
212 CtcInverse(
const AnalyticFunction<MatrixType>&, std::initializer_list<std::initializer_list<std::initializer_list<double>>>,
bool =
true,
bool =
false) ->
213 CtcInverse<IntervalMatrix,IntervalVector>;
215 template<
typename OtherDerived>
216 requires (OtherDerived::RowsAtCompileTime == -1 && OtherDerived::ColsAtCompileTime == -1)
217 CtcInverse(
const AnalyticFunction<MatrixType>&,
const Eigen::MatrixBase<OtherDerived>&,
bool =
true,
bool =
false) ->
218 CtcInverse<IntervalMatrix,IntervalVector>;
221 requires IsCtcBaseOrPtr<C,IntervalMatrix>
222 CtcInverse(
const AnalyticFunction<MatrixType>&,
const C&,
bool =
true,
bool =
false) ->
223 CtcInverse<IntervalMatrix,IntervalVector>;
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