void precond(IntervalMatrix& A) { int n=(A.nb_rows()); assert(n == A.nb_cols()); //throw NotSquareMatrixException(); // not well-constraint problem Matrix C(n,n); try { real_inverse(A.mid(), C); } catch (SingularMatrixException&) { try { real_inverse(A.lb(), C); } catch (SingularMatrixException&) { real_inverse(A.ub(), C); } } A = C*A; }
void precond(IntervalMatrix& A, IntervalVector& b) { int n=(A.nb_rows()); assert(n == A.nb_cols()); //throw NotSquareMatrixException(); // not well-constraint problem assert(n == b.size()); Matrix C(n,n); try { real_inverse(A.mid(), C); } catch (SingularMatrixException&) { try { real_inverse(A.lb(), C); } catch (SingularMatrixException&) { real_inverse(A.ub(), C); } } // cout << "A=" << (A.nb_cols()) << "x" << (A.nb_rows()) << " " << "b=" << (b.size()) << " " << "C=" // << (C.nb_cols()) << "x" << (C.nb_rows()) << endl; //cout << "C=" << C << endl; A = C*A; b = C*b; }