129 assert_release(A.is_squared());
132 auto A_ = A.template cast<Interval>();
134 Eigen::FullPivLU<Matrix> lu(A_.mid());
136 auto P = lu.permutationP();
137 auto Q = lu.permutationQ();
145 Matrix mLU = lu.matrixLU();
146 double threshold=lu.maxPivot()*lu.threshold();
147 for (
int i=0;i<N;i++) {
148 if (std::fabs(mLU(i,i))<threshold) {
149 mLU(i,i)=(mLU(i,i)<0.0 ? -threshold : threshold);
153 = IntervalMatrix::Zero(N,N);
154 for (
int c=0;c<N;c++) {
155 for (
int r=c+1;r<N;r++) {
157 for (
int k=c+1;k<r;k++) {
158 s += mLU(r,k)*ImLU(k,c);
163 for (
int c=0;c<N;c++) {
170 for (
int k=r+1;k<c;k++) {
171 s += mLU(r,k)*ImLU(k,c);
173 ImLU(r,c)=-s/mLU(r,r);
177 IntervalMatrix::Identity(N,N);
178 InvL.triangularView<Eigen::StrictlyLower>() = ImLU;
180 IntervalMatrix::Identity(N,N);
181 InvU.triangularView<Eigen::Upper>() = ImLU;
182 pMq = InvL * pMq * InvU;
199 Linv.block(c+1,0,N-1-c,c+1) -=
200 pMq.block(c+1,c,N-1-c,1)*Linv.block(c,0,1,c+1)/pivot;
201 Uinv.block(0,c+1,c+1,N-1-c) -=
202 Uinv.block(0,c,c+1,1)*pMq.block(c,c+1,1,N-1-c)/pivot;
203 pMq.bottomRightCorner(N-1-c,N-1-c) -=
204 pMq.block(c+1,c,N-1-c,1)*pMq.block(c,c+1,1,N-1-c)/pivot;
205 pMq.block(c+1,c,N-1-c,1).fill(0.0);
206 pMq.block(c,c+1,1,N-1-c).fill(0.0);
213 if (lastcol==N-1) lastcol=N;
218 for (Index c=0;c<lastcol-1;c++) {
219 tmp[c+1] = tmp[c]*pMq(c,c);
221 det = tmp[lastcol-1]*pMq(lastcol-1,lastcol-1);
222 for (Index c=lastcol-1;c>=1;c--) {
223 std::swap(tmp[c],pMq(c,c));
230 Interval det2 = pMq(N-1,N-1)*pMq(N-2,N-2)-pMq(N-1,N-2)*pMq(N-2,N-1);
231 for (Index l=0;l<lastcol;l++) {
234 pMq.bottomRightCorner(2,2) *= det;
235 std::swap(pMq(N-1,N-1),pMq(N-2,N-2));
236 std::swap(pMq(N-1,N-2),pMq(N-2,N-1));
237 pMq(N-1,N-2)=-pMq(N-1,N-2);
238 pMq(N-2,N-1)=-pMq(N-2,N-1);
243 for (Index c=lastcol;c<N;c++) {
244 Interval nrm = pMq.block(lastcol,c,a,1).norm();
245 if (nrm.
ub()>eps.
ub()) eps=nrm;
249 for (Index l=0;l<lastcol;l++) {
252 pMq.bottomRightCorner(a,a).fill(v1*det);
255 pMq = InvL.transpose()*Linv.transpose()*pMq*Uinv.transpose()*InvU.transpose();
257 P.determinant()*Q.determinant()*
259 P.determinant()*Q.determinant()*det