25 class CtcInverse :
public Ctc<CtcInverse<Y_,X0,X...>,X0,X...>
30 using Y =
typename Wrapper<Y_>::Domain;
31 using OutputType =
typename ExprType<Y>::Type;
34 requires IsCtcBaseOrPtr<C,Y>
35 CtcInverse(
const AnalyticFunction<OutputType>& f,
const C& ctc_y,
bool with_centered_form =
true,
bool is_not_in =
false)
36 : Ctc<CtcInverse<Y,X0,X...>,X0,X...>(f.input_size()), _f(f), _ctc_y(ctc_y), _with_centered_form(with_centered_form), _is_not_in(is_not_in)
38 assert_release([&]() {
return f.output_size() == size_of(ctc_y); }()
39 &&
"CtcInverse: invalid dimension of image argument ('y' or 'ctc_y')");
42 CtcInverse(
const AnalyticFunction<OutputType>& f,
const Y& y,
bool with_centered_form =
true,
bool is_not_in =
false)
43 : CtcInverse(f, CtcWrapper<Y,Y>(y), with_centered_form, is_not_in)
46 void contract(X0& x0, X&... x)
const
48 return contract_(*_ctc_y.front(), x0, x...);
51 void contract_(
const Y& y, X0& x0, X&... x)
const
53 return contract_(CtcWrapper<Y,Y>(y), x0, x...);
56 void contract_(
const CtcBase<Y>& ctc_y, X0& x0, X&... x)
const
60 _f.fill_from_args(v, x0, x...);
65 _f.expr()->fwd_eval(v, _f.input_size(), !_with_centered_form);
66 auto& val_expr = _f.expr()->value(v);
68 if(_is_not_in && !val_expr.def_domain)
76 ctc_y.contract(val_expr.a);
83 if(_with_centered_form && val_expr.def_domain && !val_expr.da.is_unbounded() && val_expr.da.size() != 0)
88 if constexpr(
sizeof...(X) == 0 && std::is_same_v<X0,IntervalVector>)
90 X0 x_mid = X0(x0.mid());
92 assert(val_expr.a.size() == val_expr.m.size());
95 if constexpr(std::is_same_v<Y,IntervalMatrix>)
97 std::cout <<
"CtcInverse: matrices expressions not (yet) supported with centered form" << std::endl;
103 MulOp::bwd(fm, val_expr.da, p);
115 _f.expr()->bwd_eval(v);
116 _f.intersect_from_args(v, x0, x...);
119 const AnalyticFunction<OutputType>& fnc()
const
126 const AnalyticFunction<OutputType> _f;
127 const Collection<CtcBase<Y>> _ctc_y;
128 bool _with_centered_form;
129 bool _is_not_in =
false;
137 CtcInverse(
const AnalyticFunction<ScalarType>&, std::initializer_list<double>,
bool =
true,
bool =
false) ->
138 CtcInverse<Interval,IntervalVector>;
141 CtcInverse(
const AnalyticFunction<ScalarType>&, std::initializer_list<Y>,
bool =
true,
bool =
false) ->
142 CtcInverse<Interval,IntervalVector>;
144 CtcInverse(
const AnalyticFunction<ScalarType>&,
const Interval&,
bool =
true,
bool =
false) ->
145 CtcInverse<Interval,IntervalVector>;
147 CtcInverse(
const AnalyticFunction<ScalarType>&,
double,
bool =
true,
bool =
false) ->
148 CtcInverse<Interval,IntervalVector>;
151 requires IsCtcBaseOrPtr<C,Interval>
152 CtcInverse(
const AnalyticFunction<ScalarType>&,
const C&,
bool =
true,
bool =
false) ->
153 CtcInverse<Interval,IntervalVector>;
157 CtcInverse(
const AnalyticFunction<VectorType>&, std::initializer_list<double>,
bool =
true,
bool =
false) ->
158 CtcInverse<IntervalVector,IntervalVector>;
160 CtcInverse(
const AnalyticFunction<VectorType>&, std::initializer_list<std::initializer_list<double>>,
bool =
true,
bool =
false) ->
161 CtcInverse<IntervalVector,IntervalVector>;
163 CtcInverse(
const AnalyticFunction<VectorType>&,
const Vector&,
bool =
true,
bool =
false) ->
164 CtcInverse<IntervalVector,IntervalVector>;
166 CtcInverse(
const AnalyticFunction<VectorType>&,
const IntervalVector&,
bool =
true,
bool =
false) ->
167 CtcInverse<IntervalVector,IntervalVector>;
169 template<
typename OtherDerived>
170 requires (OtherDerived::RowsAtCompileTime == -1 && OtherDerived::ColsAtCompileTime == 1)
171 CtcInverse(
const AnalyticFunction<VectorType>&,
const Eigen::MatrixBase<OtherDerived>&,
bool =
true,
bool =
false) ->
172 CtcInverse<IntervalVector,IntervalVector>;
175 requires IsCtcBaseOrPtr<C,IntervalVector>
176 CtcInverse(
const AnalyticFunction<VectorType>&,
const C&,
bool =
true,
bool =
false) ->
177 CtcInverse<IntervalVector,IntervalVector>;
181 CtcInverse(
const AnalyticFunction<MatrixType>&, std::initializer_list<std::initializer_list<double>>,
bool =
true,
bool =
false) ->
182 CtcInverse<IntervalMatrix,IntervalVector>;
184 CtcInverse(
const AnalyticFunction<MatrixType>&, std::initializer_list<std::initializer_list<std::initializer_list<double>>>,
bool =
true,
bool =
false) ->
185 CtcInverse<IntervalMatrix,IntervalVector>;
187 template<
typename OtherDerived>
188 requires (OtherDerived::RowsAtCompileTime == -1 && OtherDerived::ColsAtCompileTime == -1)
189 CtcInverse(
const AnalyticFunction<MatrixType>&,
const Eigen::MatrixBase<OtherDerived>&,
bool =
true,
bool =
false) ->
190 CtcInverse<IntervalMatrix,IntervalVector>;
193 requires IsCtcBaseOrPtr<C,IntervalMatrix>
194 CtcInverse(
const AnalyticFunction<MatrixType>&,
const C&,
bool =
true,
bool =
false) ->
195 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