20 template<
typename X1,
typename X2>
21 static std::string str(
const X1& x1,
const X2& x2)
23 return "min(" + x1->str() +
"," + x2->str() +
")";
26 template<
typename X1,
typename X2>
27 static std::pair<Index,Index> output_shape([[maybe_unused]]
const X1& s1, [[maybe_unused]]
const X2& s2)
32 static Interval fwd(
const Interval& x1,
const Interval& x2);
33 static ScalarType fwd_natural(
const ScalarType& x1,
const ScalarType& x2);
34 static ScalarType fwd_centered(
const ScalarType& x1,
const ScalarType& x2);
35 static void bwd(
const Interval& y, Interval& x1, Interval& x2);
42 min(
const ScalarExpr& x1,
const ScalarExpr& x2)
44 return { std::make_shared<AnalyticOperationExpr<MinOp,ScalarType,ScalarType,ScalarType>>(x1,x2) };
54 inline ScalarType MinOp::fwd_natural(
const ScalarType& x1,
const ScalarType& x2)
58 x1.def_domain && x2.def_domain
62 inline ScalarType MinOp::fwd_centered(
const ScalarType& x1,
const ScalarType& x2)
64 if(centered_form_not_available_for_args(x1,x2))
65 return fwd_natural(x1,x2);
67 assert(x1.da.rows() == 1);
68 assert(x1.da.rows() == x2.da.rows() && x1.da.cols() == x2.da.cols());
70 IntervalMatrix d(1,x1.da.cols());
71 for(Index i = 0 ; i < d.size() ; i++)
72 d(0,i) =
chi(x1.a-x2.a, x1.da(0,i), x2.da(0,i));
78 x1.def_domain && x2.def_domain
92 MaxOp::bwd(-y,mx1,mx2);
94 if(mx1.is_empty() || mx2.is_empty())
Interval class, for representing closed and connected subsets of .
Definition codac2_Interval.h:62
Interval chi(const Interval &x, const Interval &y, const Interval &z)
Return if , if , else.
Definition codac2_Interval_operations_impl.h:299
Interval min(const Interval &x, const Interval &y)
Returns .
Definition codac2_Interval_operations_impl.h:269