From: Toby D. Young Date: Wed, 21 Aug 2013 10:39:34 +0000 (+0000) Subject: Can not compute residual norms if no eigenvectors have converged. X-Git-Tag: v8.1.0~1026 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=426489da7cf5de0ff2875a01d188bf8c15e41aca;p=dealii.git Can not compute residual norms if no eigenvectors have converged. git-svn-id: https://svn.dealii.org/trunk@30369 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/source/lac/slepc_solver.cc b/deal.II/source/lac/slepc_solver.cc index 4c2576646d..fe91deb0b0 100644 --- a/deal.II/source/lac/slepc_solver.cc +++ b/deal.II/source/lac/slepc_solver.cc @@ -187,11 +187,11 @@ namespace SLEPcWrappers // get number of converged eigenstates ierr = EPSGetConverged (solver_data->eps, - reinterpret_cast(n_converged)); + reinterpret_cast(n_converged)); AssertThrow (ierr == 0, ExcSLEPcError(ierr)); - PetscInt n_iterations = 0; - double residual_norm = 1e300; + PetscInt n_iterations = 0; + PetscReal residual_norm = 1.e300; // @todo Investigate elaborating on some of this to act on the // complete eigenspectrum @@ -200,9 +200,13 @@ namespace SLEPcWrappers ierr = EPSGetIterationNumber (solver_data->eps, &n_iterations); AssertThrow (ierr == 0, ExcSLEPcError(ierr)); - // get the residual norm of the most extreme eigenvalue - ierr = EPSComputeResidualNorm (solver_data->eps, 0, &residual_norm); - AssertThrow (ierr == 0, ExcSLEPcError(ierr)); + // get the residual norm of the most extreme eigenvalue if and + // only if at least one eigenvector has converged. + if ((*n_converged)>0) + { + ierr = EPSComputeResidualNorm (solver_data->eps, 0, &residual_norm); + AssertThrow (ierr == 0, ExcSLEPcError(ierr)); + } // check the solver state const SolverControl::State state