23 static Interval fwd(
const Interval& x1);
24 static ScalarType fwd_natural(
const ScalarType& x1);
25 static ScalarType fwd_centered(
const ScalarType& x1);
26 static void bwd(
const Interval& y, Interval& x1);
28 static IntervalVector fwd(
const IntervalVector& x1);
29 static VectorType fwd_natural(
const VectorType& x1);
30 static VectorType fwd_centered(
const VectorType& x1);
31 static void bwd(
const IntervalVector& y, IntervalVector& x1);
33 static IntervalMatrix fwd(
const IntervalMatrix& x1);
34 static MatrixType fwd_natural(
const MatrixType& x1);
35 static MatrixType fwd_centered(
const MatrixType& x1);
36 static void bwd(
const IntervalMatrix& y, IntervalMatrix& x1);
39 static Interval fwd(
const Interval& x1,
const Interval& x2);
40 static ScalarType fwd_natural(
const ScalarType& x1,
const ScalarType& x2);
41 static ScalarType fwd_centered(
const ScalarType& x1,
const ScalarType& x2);
42 static void bwd(
const Interval& y, Interval& x1, Interval& x2);
44 static IntervalVector fwd(
const IntervalVector& x1,
const IntervalVector& x2);
45 static VectorType fwd_natural(
const VectorType& x1,
const VectorType& x2);
46 static VectorType fwd_centered(
const VectorType& x1,
const VectorType& x2);
47 static void bwd(
const IntervalVector& y, IntervalVector& x1, IntervalVector& x2);
49 static IntervalMatrix fwd(
const IntervalMatrix& x1,
const IntervalMatrix& x2);
50 static MatrixType fwd_natural(
const MatrixType& x1,
const MatrixType& x2);
51 static MatrixType fwd_centered(
const MatrixType& x1,
const MatrixType& x2);
52 static void bwd(
const IntervalMatrix& y, IntervalMatrix& x1, IntervalMatrix& x2);
61 return { std::make_shared<AnalyticOperationExpr<SubOp,ScalarType,ScalarType>>(x1) };
67 return { std::make_shared<AnalyticOperationExpr<SubOp,VectorType,VectorType>>(x1) };
73 return { std::make_shared<AnalyticOperationExpr<SubOp,MatrixType,MatrixType>>(x1) };
80 operator-(
const ScalarExpr& x1,
const ScalarExpr& x2)
82 return { std::make_shared<AnalyticOperationExpr<SubOp,ScalarType,ScalarType,ScalarType>>(x1,x2) };
86 operator-(
const VectorExpr& x1,
const VectorExpr& x2)
88 return { std::make_shared<AnalyticOperationExpr<SubOp,VectorType,VectorType,VectorType>>(x1,x2) };
92 operator-(
const MatrixExpr& x1,
const MatrixExpr& x2)
94 return { std::make_shared<AnalyticOperationExpr<SubOp,MatrixType,MatrixType,MatrixType>>(x1,x2) };
104 inline ScalarType SubOp::fwd_natural(
const ScalarType& x1)
112 inline ScalarType SubOp::fwd_centered(
const ScalarType& x1)
125 SubOp::bwd(y, x2_, x1);
128 inline IntervalVector SubOp::fwd(
const IntervalVector& x1)
133 inline VectorType SubOp::fwd_natural(
const VectorType& x1)
141 inline VectorType SubOp::fwd_centered(
const VectorType& x1)
151 inline void SubOp::bwd(
const IntervalVector& y, IntervalVector& x1)
153 assert(y.size() == x1.size());
154 for(Index i = 0 ; i < y.size() ; i++)
158 inline IntervalMatrix SubOp::fwd(
const IntervalMatrix& x1)
163 inline MatrixType SubOp::fwd_natural(
const MatrixType& x1)
171 inline MatrixType SubOp::fwd_centered(
const MatrixType& x1)
181 inline void SubOp::bwd(
const IntervalMatrix& y, IntervalMatrix& x1)
183 assert(y.size() == x1.size());
184 for(Index i = 0 ; i < y.size() ; i++)
185 SubOp::bwd(*(y.data()+i), *(x1.data()+i));
193 inline ScalarType SubOp::fwd_natural(
const ScalarType& x1,
const ScalarType& x2)
197 x1.def_domain && x2.def_domain
201 inline ScalarType SubOp::fwd_centered(
const ScalarType& x1,
const ScalarType& x2)
203 if(centered_form_not_available_for_args(x1,x2))
204 return fwd_natural(x1,x2);
206 assert(x1.da.rows() == x2.da.rows() && x1.da.cols() == x2.da.cols());
211 x1.def_domain && x2.def_domain
217 if((x1 &= y+x2).is_empty())
220 else if((x2 &= x1-y).is_empty())
224 inline IntervalVector SubOp::fwd(
const IntervalVector& x1,
const IntervalVector& x2)
226 assert(x1.size() == x2.size());
230 inline VectorType SubOp::fwd_natural(
const VectorType& x1,
const VectorType& x2)
234 x1.def_domain && x2.def_domain
238 inline VectorType SubOp::fwd_centered(
const VectorType& x1,
const VectorType& x2)
240 if(centered_form_not_available_for_args(x1,x2))
241 return fwd_natural(x1,x2);
243 assert(x1.da.rows() == x2.da.rows() && x1.da.cols() == x2.da.cols());
248 x1.def_domain && x2.def_domain
252 inline void SubOp::bwd(
const IntervalVector& y, IntervalVector& x1, IntervalVector& x2)
254 assert(y.size() == x1.size() && y.size() == x2.size());
255 for(Index i = 0 ; i < y.size() ; i++)
256 SubOp::bwd(y[i], x1[i], x2[i]);
259 inline IntervalMatrix SubOp::fwd(
const IntervalMatrix& x1,
const IntervalMatrix& x2)
261 assert(x1.size() == x2.size());
265 inline MatrixType SubOp::fwd_natural(
const MatrixType& x1,
const MatrixType& x2)
267 assert(x1.a.cols() == x2.a.cols() && x1.a.rows() == x2.a.rows());
270 x1.def_domain && x2.def_domain
274 inline MatrixType SubOp::fwd_centered(
const MatrixType& x1,
const MatrixType& x2)
276 assert(x1.a.cols() == x2.a.cols() && x1.a.rows() == x2.a.rows());
281 x1.def_domain && x2.def_domain
285 inline void SubOp::bwd(
const IntervalMatrix& y, IntervalMatrix& x1, IntervalMatrix& x2)
287 assert(y.size() == x1.size() && y.size() == x2.size());
288 for(Index i = 0 ; i < y.size() ; i++)
289 SubOp::bwd(*(y.data()+i), *(x1.data()+i), *(x2.data()+i));
Interval class, for representing closed and connected subsets of .
Definition codac2_Interval.h:62
Interval operator-(const Interval &x, double y)
Returns with .
Definition codac2_Interval_impl.h:389