]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Add sorting to eigenvalues in SolverGMRES 1121/head
authorSimon Sticko <simon.sticko@it.uu.se>
Sat, 11 Jul 2015 18:21:54 +0000 (20:21 +0200)
committerSimon Sticko <simon.sticko@it.uu.se>
Sat, 11 Jul 2015 18:27:00 +0000 (20:27 +0200)
The eigenvalues output through the eigenvalues signals was not sorted
previously. Add sorting according to
internal::SolverGMRES::complex_less_pred.

include/deal.II/lac/solver_gmres.h
tests/lac/solver_signals.output

index e7fe89d9df5f66ca1bea629966d704efaccb3b95..b1410a4dd19decdbf0710d37360c7d2be81b68ac 100644 (file)
@@ -714,12 +714,12 @@ SolverGMRES<VECTOR>::compute_eigs_and_cond(
           std::vector<std::complex<double> > eigenvalues(dim);
           for (unsigned int i=0; i<mat_eig.n(); ++i)
             eigenvalues[i] = mat_eig.eigenvalue(i);
+          //Sort eigenvalues for nicer output.
+          std::sort(eigenvalues.begin(), eigenvalues.end(),
+                    internal::SolverGMRES::complex_less_pred);
           eigenvalues_signal(eigenvalues);
           if (log_eigenvalues)
             {
-              //Sort eigenvalues for nicer output.
-              std::sort(eigenvalues.begin(), eigenvalues.end(),
-                        internal::SolverGMRES::complex_less_pred);
               deallog << "Eigenvalue estimate: ";
               for (unsigned int i=0; i<mat_eig.n(); ++i)
                 deallog << ' ' << eigenvalues[i];
index 4a591e2da1e66e83e44e3b6128a49d8562877117..caa51fc486d594c0be8b8e32393379bee26f1643 100644 (file)
@@ -120,12 +120,12 @@ DEAL:cg::Convergence step 40 value 0.0009064
 DEAL:cg::Final condition number: 364.1
 DEAL:cg::Final Eigenvalues:  0.02191 0.1088 0.1958 0.2789 0.3660 0.5253 0.6175 0.8323 0.9462 1.192 1.322 1.598 1.804 2.024 2.402 2.518 2.834 3.186 3.485 3.728 3.962 4.346 4.672 4.910 5.218 5.562 5.863 6.072 6.333 6.629 6.870 7.024 7.222 7.427 7.590 7.663 7.801 7.891 7.978
 DEAL:GMRES::Starting value 29.00
-DEAL:GMRES::Eigenvalues:  (7.954,0.000) (7.836,0.000) (7.665,0.000) (7.456,0.000) (7.216,0.000) (6.934,0.000) (6.609,0.000) (6.248,0.000) (5.860,0.000) (5.447,0.000) (5.012,0.000) (4.554,0.000) (0.02191,0.000) (0.1089,0.000) (0.2179,0.000) (0.2902,0.000) (0.5179,0.000) (0.6680,0.000) (0.8533,0.000) (1.202,0.000) (4.034,0.000) (3.685,0.000) (3.304,0.000) (1.587,0.000) (2.908,0.000) (2.520,0.000) (1.962,0.000) (2.224,0.000)
+DEAL:GMRES::Eigenvalues:  (0.02191,0.000) (0.1089,0.000) (0.2179,0.000) (0.2902,0.000) (0.5179,0.000) (0.6680,0.000) (0.8533,0.000) (1.202,0.000) (1.587,0.000) (1.962,0.000) (2.224,0.000) (2.520,0.000) (2.908,0.000) (3.304,0.000) (3.685,0.000) (4.034,0.000) (4.554,0.000) (5.012,0.000) (5.447,0.000) (5.860,0.000) (6.248,0.000) (6.609,0.000) (6.934,0.000) (7.216,0.000) (7.456,0.000) (7.665,0.000) (7.836,0.000) (7.954,0.000)
 DEAL:GMRES::Condition number: 363.0
-DEAL:GMRES::Eigenvalues:  (7.978,0.000) (7.891,0.000) (7.797,0.000) (7.647,0.000) (7.393,0.000) (7.129,0.000) (6.901,0.000) (6.553,0.000) (6.146,0.000) (5.741,0.000) (5.333,0.000) (4.910,0.000) (4.475,0.000) (4.075,0.000) (3.694,0.000) (3.205,0.000) (2.760,0.000) (0.02765,0.000) (0.1418,0.000) (0.2014,0.000) (0.3484,0.000) (0.5334,0.000) (0.6447,0.000) (1.032,0.000) (1.319,0.000) (2.310,0.000) (1.634,0.000) (1.937,0.000)
+DEAL:GMRES::Eigenvalues:  (0.02765,0.000) (0.1418,0.000) (0.2014,0.000) (0.3484,0.000) (0.5334,0.000) (0.6447,0.000) (1.032,0.000) (1.319,0.000) (1.634,0.000) (1.937,0.000) (2.310,0.000) (2.760,0.000) (3.205,0.000) (3.694,0.000) (4.075,0.000) (4.475,0.000) (4.910,0.000) (5.333,0.000) (5.741,0.000) (6.146,0.000) (6.553,0.000) (6.901,0.000) (7.129,0.000) (7.393,0.000) (7.647,0.000) (7.797,0.000) (7.891,0.000) (7.978,0.000)
 DEAL:GMRES::Condition number: 288.5
 DEAL:GMRES::Convergence step 65 value 0.0009799
-DEAL:GMRES::Eigenvalues:  (0.02681,0.000) (0.2333,0.000) (1.178,0.000) (2.161,0.000) (3.554,0.000) (4.930,0.000) (7.726,0.000) (7.170,0.000) (6.307,0.000)
+DEAL:GMRES::Eigenvalues:  (0.02681,0.000) (0.2333,0.000) (1.178,0.000) (2.161,0.000) (3.554,0.000) (4.930,0.000) (6.307,0.000) (7.170,0.000) (7.726,0.000)
 DEAL:GMRES::Condition number: 288.2
-DEAL:GMRES::Final Eigenvalues:  (0.02681,0.000) (0.2333,0.000) (1.178,0.000) (2.161,0.000) (3.554,0.000) (4.930,0.000) (7.726,0.000) (7.170,0.000) (6.307,0.000)
+DEAL:GMRES::Final Eigenvalues:  (0.02681,0.000) (0.2333,0.000) (1.178,0.000) (2.161,0.000) (3.554,0.000) (4.930,0.000) (6.307,0.000) (7.170,0.000) (7.726,0.000)
 DEAL:GMRES::Final condition number: 288.2

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.