From 3e60df1bb1b235a285a204c12c17805ef2b3e78b Mon Sep 17 00:00:00 2001 From: kronbichler Date: Sun, 11 May 2014 09:57:47 +0000 Subject: [PATCH] Sort eigenvalues. git-svn-id: https://svn.dealii.org/trunk@32898 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/include/deal.II/lac/solver_gmres.h | 16 +++++++++++++++- tests/lac/gmres_eigenvalues.output | 8 ++++---- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/deal.II/include/deal.II/lac/solver_gmres.h b/deal.II/include/deal.II/lac/solver_gmres.h index 84133ceace..4c76e8c984 100644 --- a/deal.II/include/deal.II/lac/solver_gmres.h +++ b/deal.II/include/deal.II/lac/solver_gmres.h @@ -441,6 +441,13 @@ namespace internal } return *data[i-offset]; } + + // A comparator for better printing eigenvalues + bool complex_less_pred(const std::complex &x, + const std::complex &y) + { + return x.real() < y.real() || (x.real() == y.real() && x.imag() < y.imag()); + } } } @@ -831,9 +838,16 @@ SolverGMRES::solve (const MATRIX &A, for (unsigned int j=0; j > eigenvalues(dim); + for (unsigned int i=0; i