Skip to content
Snippets Groups Projects
Commit 38acfeac authored by Ian Bell's avatar Ian Bell
Browse files

Add runtime check in rootfinding

parent 9eb01d3c
No related branches found
No related tags found
No related merge requests found
......@@ -18,6 +18,9 @@ auto NewtonRaphson(Callable f, const Inputs& args, double tol) {
Eigen::ArrayXd v = J.colPivHouseholderQr().solve(-r0.matrix());
x += v;
auto err = r0.matrix().norm();
if (!std::isfinite(err)){
throw std::invalid_argument("err is now NaN");
}
if (err < tol) {
break;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment