25 static Interval fwd(
const IntervalMatrix& x);
26 static ScalarType fwd_natural(
const MatrixType& x);
27 static ScalarType fwd_centered(
const MatrixType& x);
28 static void bwd(
const Interval& y, IntervalMatrix& x);
31 static Interval fwd(
const IntervalVector& x1,
const IntervalVector& x2);
32 static ScalarType fwd_natural(
const VectorType& x1,
const VectorType& x2);
33 static ScalarType fwd_centered(
const VectorType& x1,
const VectorType& x2);
34 static void bwd(
const Interval& y, IntervalVector& x1, IntervalVector& x2);
37 static Interval fwd(
const IntervalVector& x1,
const IntervalVector& x2,
const IntervalVector& x3);
38 static ScalarType fwd_natural(
const VectorType& x1,
const VectorType& x2,
const VectorType& x3);
39 static ScalarType fwd_centered(
const VectorType& x1,
const VectorType& x2,
const VectorType& x3);
40 static void bwd(
const Interval& y, IntervalVector& x1, IntervalVector& x2, IntervalVector& x3);
47 det(
const MatrixExpr& x1)
49 return { std::make_shared<AnalyticOperationExpr<DetOp,ScalarType,MatrixType>>(x1) };
53 det(
const VectorExpr& x1,
const VectorExpr& x2)
55 return { std::make_shared<AnalyticOperationExpr<DetOp,ScalarType,VectorType,VectorType>>(x1,x2) };
59 det(
const VectorExpr& x1,
const VectorExpr& x2,
const VectorExpr& x3)
61 return { std::make_shared<AnalyticOperationExpr<DetOp,ScalarType,VectorType,VectorType,VectorType>>(x1,x2,x3) };
66 inline Interval DetOp::fwd(
const IntervalMatrix& x)
68 assert_release(x.is_squared() &&
"can only compute determinants for a square matrix");
69 assert_release((x.rows() == 1 || x.rows() == 2) &&
"determinant not yet computable for n×n matrices, n>2");
74 else if(x.rows() == 2)
75 return x(0,0)*x(1,1)-x(0,1)*x(1,0);
81 inline ScalarType DetOp::fwd_natural(
const MatrixType& x)
89 inline ScalarType DetOp::fwd_centered(
const MatrixType& x)
99 inline void DetOp::bwd(
const Interval& y, IntervalMatrix& x)
101 assert_release(x.is_squared() &&
"can only compute determinants for a square matrix");
102 assert_release((x.rows() == 1 || x.rows() == 2) &&
"determinant not yet computable for n×n matrices, n>2");
107 else if(x.rows() == 2)
109 Interval z1 = x(0,0)*x(1,1), z2 = x(1,0)*x(0,1);
110 SubOp::bwd(y, z1, z2);
111 MulOp::bwd(z1, x(0,0), x(1,1));
112 MulOp::bwd(z2, x(1,0), x(0,1));
121 inline Interval DetOp::fwd(
const IntervalVector& x1,
const IntervalVector& x2)
123 assert_release(x1.size() == 2 && x2.size() == 2 &&
"determinant only computable for pairs of 2d vectors");
124 IntervalMatrix m(2,2);
125 m.col(0) = x1; m.col(1) = x2;
126 return DetOp::fwd(m);
129 inline ScalarType DetOp::fwd_natural(
const VectorType& x1,
const VectorType& x2)
131 IntervalMatrix a(2,2);
132 a.col(0) = x1.a; a.col(1) = x2.a;
136 x1.def_domain && x2.def_domain
140 inline ScalarType DetOp::fwd_centered(
const VectorType& x1,
const VectorType& x2)
142 if(centered_form_not_available_for_args(x1,x2))
143 return fwd_natural(x1,x2);
145 IntervalMatrix m(2,2);
146 m.col(0) = x1.m; m.col(1) = x2.m;
147 IntervalMatrix a(2,2);
148 a.col(0) = x1.a; a.col(1) = x2.a;
154 x1.def_domain && x2.def_domain
158 inline void DetOp::bwd(
const Interval& y, IntervalVector& x1, IntervalVector& x2)
160 assert_release(x1.size() == 2 && x2.size() == 2 &&
"determinant only computable for pairs of 2d vectors");
161 IntervalMatrix m(2,2);
162 m.col(0) = x1; m.col(1) = x2;
168 inline Interval DetOp::fwd(
const IntervalVector& x1,
const IntervalVector& x2,
const IntervalVector& x3)
170 assert_release(x1.size() == 3 && x2.size() == 3 && x3.size() == 3 &&
"determinant only computable for triplet of 3d vectors");
171 IntervalMatrix m(3,3);
172 m.col(0) = x1; m.col(1) = x2; m.col(2) = x3;
173 return DetOp::fwd(m);
176 inline ScalarType DetOp::fwd_natural(
const VectorType& x1,
const VectorType& x2,
const VectorType& x3)
178 IntervalMatrix a(3,3);
179 a.col(0) = x1.a; a.col(1) = x2.a; a.col(2) = x3.a;
183 x1.def_domain && x2.def_domain && x3.def_domain
187 inline ScalarType DetOp::fwd_centered(
const VectorType& x1,
const VectorType& x2,
const VectorType& x3)
189 if(centered_form_not_available_for_args(x1,x2,x3))
190 return fwd_natural(x1,x2,x3);
192 IntervalMatrix m(3,3);
193 m.col(0) = x1.m; m.col(1) = x2.m; m.col(2) = x3.m;
194 IntervalMatrix a(3,3);
195 a.col(0) = x1.a; a.col(1) = x2.a; a.col(2) = x3.a;
201 x1.def_domain && x2.def_domain && x3.def_domain
205 inline void DetOp::bwd(
const Interval& y, IntervalVector& x1, IntervalVector& x2, IntervalVector& x3)
207 assert_release(x1.size() == 3 && x2.size() == 3 && x3.size() == 3 &&
"determinant only computable for triplet of 3d vectors");
209 IntervalMatrix m(3,3);
210 m.col(0) = x1; m.col(1) = x2; m.col(2) = x3;
Interval class, for representing closed and connected subsets of .
Definition codac2_Interval.h:62
static Interval empty()
Provides an empty interval.
Definition codac2_Interval_impl.h:535