Skip to content
Snippets Groups Projects
Commit ee3f3951 authored by Dmitri Naumov's avatar Dmitri Naumov
Browse files

[MaL] Move eigen solver compute call to solve().

parent 0389b6c7
No related branches found
No related tags found
No related merge requests found
......@@ -32,16 +32,17 @@ public:
explicit EigenDirectLinearSolver(EigenMatrix::RawMatrixType &A) : _A(A)
{
INFO("-> initialize with the coefficient matrix");
_solver.compute(A);
if(_solver.info()!=Eigen::Success) {
ERR("Failed during Eigen linear solver initialization");
return;
}
}
void solve(EigenVector::RawVectorType &b, EigenVector::RawVectorType &x, EigenOption &/*opt*/) override
{
INFO("-> solve");
_solver.compute(_A);
if(_solver.info()!=Eigen::Success) {
ERR("Failed during Eigen linear solver initialization");
return;
}
x = _solver.solve(b);
if(_solver.info()!=Eigen::Success) {
ERR("Failed during Eigen linear solve");
......@@ -62,11 +63,6 @@ public:
explicit EigenIterativeLinearSolver(EigenMatrix::RawMatrixType &A) : _A(A)
{
INFO("-> initialize with the coefficient matrix");
_solver.compute(A);
if(_solver.info()!=Eigen::Success) {
ERR("Failed during Eigen linear solver initialization");
return;
}
}
void solve(EigenVector::RawVectorType &b, EigenVector::RawVectorType &x, EigenOption &opt) override
......@@ -74,6 +70,11 @@ public:
INFO("-> solve");
_solver.setTolerance(opt.error_tolerance);
_solver.setMaxIterations(opt.max_iterations);
_solver.compute(_A);
if(_solver.info()!=Eigen::Success) {
ERR("Failed during Eigen linear solver initialization");
return;
}
x = _solver.solveWithGuess(b, x);
if(_solver.info()!=Eigen::Success) {
ERR("Failed during Eigen linear solve");
......
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