27 static Interval fwd(
const Interval& x1,
const Interval& x2);
28 static ScalarType fwd_natural(
const ScalarType& x1,
const ScalarType& x2);
29 static ScalarType fwd_centered(
const ScalarType& x1,
const ScalarType& x2);
30 static void bwd(
const Interval& y, Interval& x1, Interval& x2);
32 static IntervalVector fwd(
const Interval& x1,
const IntervalVector& x2);
33 static VectorType fwd_natural(
const ScalarType& x1,
const VectorType& x2);
34 static VectorType fwd_centered(
const ScalarType& x1,
const VectorType& x2);
35 static void bwd(
const IntervalVector& y, Interval& x1, IntervalVector& x2);
37 static IntervalVector fwd(
const IntervalVector& x1,
const Interval& x2);
38 static VectorType fwd_natural(
const VectorType& x1,
const ScalarType& x2);
39 static VectorType fwd_centered(
const VectorType& x1,
const ScalarType& x2);
40 static void bwd(
const IntervalVector& y, IntervalVector& x1, Interval& x2);
42 static Interval fwd(
const IntervalRow& x1,
const IntervalVector& x2);
44 static void bwd(
const Interval& y, IntervalRow& x1, IntervalVector& x2);
46 static IntervalMatrix fwd(
const Interval& x1,
const IntervalMatrix& x2);
47 static MatrixType fwd_natural(
const ScalarType& x1,
const MatrixType& x2);
48 static MatrixType fwd_centered(
const ScalarType& x1,
const MatrixType& x2);
49 static void bwd(
const IntervalMatrix& y, Interval& x1, IntervalMatrix& x2);
51 static IntervalVector fwd(
const IntervalMatrix& x1,
const IntervalVector& x2);
52 static VectorType fwd_natural(
const MatrixType& x1,
const VectorType& x2);
53 static VectorType fwd_centered(
const MatrixType& x1,
const VectorType& x2);
54 static void bwd(
const IntervalVector& y, IntervalMatrix& x1, IntervalVector& x2);
56 static IntervalMatrix fwd(
const IntervalMatrix& x1,
const IntervalMatrix& x2);
57 static MatrixType fwd_natural(
const MatrixType& x1,
const MatrixType& x2);
58 static MatrixType fwd_centered(
const MatrixType& x1,
const MatrixType& x2);
59 static void bwd(
const IntervalMatrix& y, IntervalMatrix& x1, IntervalMatrix& x2);
66 operator*(
const ScalarExpr& x1,
const ScalarExpr& x2)
68 return { std::make_shared<AnalyticOperationExpr<MulOp,ScalarType,ScalarType,ScalarType>>(x1,x2) };
72 operator*(
const ScalarExpr& x1,
const VectorExpr& x2)
74 return { std::make_shared<AnalyticOperationExpr<MulOp,VectorType,ScalarType,VectorType>>(x1,x2) };
78 operator*(
const VectorExpr& x1,
const ScalarExpr& x2)
80 return { std::make_shared<AnalyticOperationExpr<MulOp,VectorType,VectorType,ScalarType>>(x1,x2) };
84 operator*(
const ScalarExpr& x1,
const MatrixExpr& x2)
86 return { std::make_shared<AnalyticOperationExpr<MulOp,MatrixType,ScalarType,MatrixType>>(x1,x2) };
90 operator*(
const MatrixExpr& x1,
const VectorExpr& x2)
92 return { std::make_shared<AnalyticOperationExpr<MulOp,VectorType,MatrixType,VectorType>>(x1,x2) };
96 operator*(
const MatrixExpr& x1,
const MatrixExpr& x2)
98 return { std::make_shared<AnalyticOperationExpr<MulOp,MatrixType,MatrixType,MatrixType>>(x1,x2) };
108 inline ScalarType MulOp::fwd_natural(
const ScalarType& x1,
const ScalarType& x2)
112 x1.def_domain && x2.def_domain
116 inline ScalarType MulOp::fwd_centered(
const ScalarType& x1,
const ScalarType& x2)
118 if(centered_form_not_available_for_args(x1,x2))
119 return fwd_natural(x1,x2);
121 assert(x1.da.rows() == 1);
122 assert(x1.da.rows() == x2.da.rows() && x1.da.cols() == x2.da.cols());
124 IntervalMatrix d(1,x1.da.cols());
125 for(Index i = 0 ; i < d.size() ; i++)
126 d(0,i) = x1.da(0,i)*x2.a + x1.a*x2.da(0,i);
132 x1.def_domain && x2.def_domain
138 x1 = gaol::div_rel(y, x2, x1);
139 x2 = gaol::div_rel(y, x1, x2);
142 inline IntervalVector MulOp::fwd(
const Interval& x1,
const IntervalVector& x2)
147 inline VectorType MulOp::fwd_natural(
const ScalarType& x1,
const VectorType& x2)
151 x1.def_domain && x2.def_domain
155 inline VectorType MulOp::fwd_centered(
const ScalarType& x1,
const VectorType& x2)
157 if(centered_form_not_available_for_args(x1,x2))
158 return fwd_natural(x1,x2);
160 assert(x1.da.rows() == 1);
161 assert(x1.da.cols() == x2.da.cols());
162 assert(x2.a.size() == x2.da.rows());
164 IntervalMatrix d(x2.da.rows(),x2.da.cols());
165 for(Index i = 0 ; i < d.rows() ; i++)
166 for(Index j = 0 ; j < d.cols() ; j++)
167 d(i,j) = x1.da(0,j)*x2.a[i]+x1.a*x2.da(i,j);
173 x1.def_domain && x2.def_domain
177 inline void MulOp::bwd(
const IntervalVector& y,
Interval& x1, IntervalVector& x2)
179 assert(y.size() == x2.size());
180 for(Index i = 0 ; i < x2.size() ; i++)
181 MulOp::bwd(y[i], x1, x2[i]);
184 inline IntervalVector MulOp::fwd(
const IntervalVector& x1,
const Interval& x2)
186 return MulOp::fwd(x2,x1);
189 inline VectorType MulOp::fwd_natural(
const VectorType& x1,
const ScalarType& x2)
191 return MulOp::fwd_natural(x2,x1);
194 inline VectorType MulOp::fwd_centered(
const VectorType& x1,
const ScalarType& x2)
196 return MulOp::fwd_centered(x2,x1);
199 inline void MulOp::bwd(
const IntervalVector& y, IntervalVector& x1,
Interval& x2)
201 MulOp::bwd(y, x2, x1);
204 inline Interval MulOp::fwd(
const IntervalRow& x1,
const IntervalVector& x2)
206 assert(x1.size() == x2.size());
208 for(Index i = 0 ; i < x1.size() ; i++)
218 inline IntervalMatrix MulOp::fwd(
const Interval& x1,
const IntervalMatrix& x2)
223 inline MatrixType MulOp::fwd_natural(
const ScalarType& x1,
const MatrixType& x2)
227 x1.def_domain && x2.def_domain
231 inline MatrixType MulOp::fwd_centered(
const ScalarType& x1,
const MatrixType& x2)
233 if(centered_form_not_available_for_args(x1,x2))
234 return fwd_natural(x1,x2);
239 IntervalMatrix::zero(0,0),
240 x1.def_domain && x2.def_domain
244 inline void MulOp::bwd([[maybe_unused]]
const IntervalMatrix& y, [[maybe_unused]]
Interval& x1, [[maybe_unused]] IntervalMatrix& x2)
249 inline IntervalVector MulOp::fwd(
const IntervalMatrix& x1,
const IntervalVector& x2)
251 assert(x1.cols() == x2.size());
255 inline VectorType MulOp::fwd_natural(
const MatrixType& x1,
const VectorType& x2)
259 x1.def_domain && x2.def_domain
263 inline VectorType MulOp::fwd_centered(
const MatrixType& x1,
const VectorType& x2)
265 if(centered_form_not_available_for_args(x1,x2))
266 return fwd_natural(x1,x2);
271 IntervalMatrix::zero(0,0),
272 x1.def_domain && x2.def_domain
276 inline IntervalMatrix MulOp::fwd(
const IntervalMatrix& x1,
const IntervalMatrix& x2)
278 assert(x1.cols() == x2.rows());
282 inline MatrixType MulOp::fwd_natural(
const MatrixType& x1,
const MatrixType& x2)
286 x1.def_domain && x2.def_domain
290 inline MatrixType MulOp::fwd_centered(
const MatrixType& x1,
const MatrixType& x2)
292 if(centered_form_not_available_for_args(x1,x2))
293 return fwd_natural(x1,x2);
298 IntervalMatrix::zero(0,0),
299 x1.def_domain && x2.def_domain
303 inline void MulOp::bwd([[maybe_unused]]
const IntervalMatrix& y, [[maybe_unused]] IntervalMatrix& x1, [[maybe_unused]] IntervalMatrix& x2)
305 assert(x1.rows() == x2.cols());
306 assert(y.rows() == x1.rows() && y.cols() == x2.cols());
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:412