Moderator
|
renzh: since your matrix is singular, there is not a unique solution. Here the following solvers give me a solution with (A*x-b).cwiseAbs().maxCoeff() around 1e-11:
MatrixXcd A; VectorXcd x, b; SparseMatrix<double> S; loadMarket(S,"Krr_1.dat"); int n = S.cols(); A = MatrixXcd(S); x.setOnes(n); b = A*x; x.setZero(); x = SimplicialLDLT<SparseMatrix<double> >(S).solve(b); //x = A.ldlt().solve(b); //x = A.partialPivLu().solve(b); //x = A.colPivHouseholderQr().solve(b); std::cout << x.transpose() << "\n"; std::cout << (A*x-b).cwiseAbs().maxCoeff() << "\n"; |
Registered users: Baidu [Spider], Bing [Bot], Google [Bot], rblackwell