131 assert_release(A.is_squared());
134 auto A_ = A.template cast<Interval>();
136 Eigen::FullPivLU<Matrix> lu(A_.mid());
138 auto P = lu.permutationP();
139 auto Q = lu.permutationQ();
147 Matrix mLU = lu.matrixLU();
148 for (
int i=0;i<N;i++) {
149 if (std::fabs(mLU(i,i))<1e-5) {
150 mLU(i,i)=(mLU(i,i)<0.0 ? -1e-5 : 1e-5);
154 = IntervalMatrix::Zero(N,N);
155 for (
int c=0;c<N;c++) {
156 for (
int r=c+1;r<N;r++) {
158 for (
int k=c+1;k<r;k++) {
159 s += mLU(r,k)*ImLU(k,c);
164 for (
int c=0;c<N;c++) {
171 for (
int k=r+1;k<c;k++) {
172 s += mLU(r,k)*ImLU(k,c);
174 ImLU(r,c)=-s/mLU(r,r);
178 IntervalMatrix::Identity(N,N);
179 InvL.triangularView<Eigen::StrictlyLower>() = ImLU;
181 IntervalMatrix::Identity(N,N);
182 InvU.triangularView<Eigen::Upper>() = ImLU;
183 pMq = InvL * pMq * InvU;
200 Linv.block(c+1,0,N-1-c,c+1) -=
201 pMq.block(c+1,c,N-1-c,1)*Linv.block(c,0,1,c+1)/pivot;
202 Uinv.block(0,c+1,c+1,N-1-c) -=
203 Uinv.block(0,c,c+1,1)*pMq.block(c,c+1,1,N-1-c)/pivot;
204 pMq.bottomRightCorner(N-1-c,N-1-c) -=
205 pMq.block(c+1,c,N-1-c,1)*pMq.block(c,c+1,1,N-1-c)/pivot;
206 pMq.block(c+1,c,N-1-c,1).fill(0.0);
207 pMq.block(c,c+1,1,N-1-c).fill(0.0);
214 if (lastcol==N-1) lastcol=N;
219 for (Index c=0;c<lastcol-1;c++) {
220 tmp[c+1] = tmp[c]*pMq(c,c);
222 det = tmp[lastcol-1]*pMq(lastcol-1,lastcol-1);
223 for (Index c=lastcol-1;c>=1;c--) {
224 std::swap(tmp[c],pMq(c,c));
231 Interval det2 = pMq(N-1,N-1)*pMq(N-2,N-2)-pMq(N-1,N-2)*pMq(N-2,N-1);
232 for (Index l=0;l<lastcol;l++) {
235 pMq.bottomRightCorner(2,2) *= det;
236 std::swap(pMq(N-1,N-1),pMq(N-2,N-2));
237 std::swap(pMq(N-1,N-2),pMq(N-2,N-1));
238 pMq(N-1,N-2)=-pMq(N-1,N-2);
239 pMq(N-2,N-1)=-pMq(N-2,N-1);
244 for (Index c=lastcol;c<N;c++) {
245 Interval nrm = pMq.block(lastcol,c,a,1).norm();
246 if (nrm.
ub()>eps.
ub()) eps=nrm;
250 for (Index l=0;l<lastcol;l++) {
253 pMq.bottomRightCorner(a,a).fill(v1*det);
256 pMq = InvL.transpose()*Linv.transpose()*pMq*Uinv.transpose()*InvU.transpose();
258 P.determinant()*Q.determinant()*
260 P.determinant()*Q.determinant()*det