From: Martin Kronbichler Date: Wed, 9 May 2018 05:36:16 +0000 (+0200) Subject: Improve test lac/gmres_eigenvalues. X-Git-Tag: v9.1.0-rc1~1166^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F6553%2Fhead;p=dealii.git Improve test lac/gmres_eigenvalues. --- diff --git a/tests/lac/gmres_eigenvalues.cc b/tests/lac/gmres_eigenvalues.cc index 0eec36f281..0a9a312574 100644 --- a/tests/lac/gmres_eigenvalues.cc +++ b/tests/lac/gmres_eigenvalues.cc @@ -36,28 +36,25 @@ void output_eigenvalues(const std::vector &eigenvalues,const std::string template void test (unsigned int variant) { - const unsigned int n = variant % 2 == 0 ? 64 : 16; + const unsigned int n = variant < 3 ? 64 : 20; Vector rhs(n), sol(n); rhs = 1.; LAPACKFullMatrix matrix(n, n); - // put diagonal entries of different strengths. these are very challenging - // for GMRES and will usually take a lot of iterations until the Krylov - // subspace is complete enough if (variant == 0) for (unsigned int i=0; i >::AdditionalData data; - data.max_n_tmp_vectors = 100; + // always do exactly 5 (variant 1 which should have 5 eigenvalues) or 20 + // iterations -> set a tolerance that is too tight otherwise + IterationNumberControl control(variant == 1 ? 5 : 20, 1e-40); - SolverGMRES > solver(control, data); + SolverGMRES > solver(control); solver.connect_eigenvalues_slot( std::bind(output_eigenvalues>, std::placeholders::_1,"Eigenvalue estimate: ")); solver.solve(matrix, sol, rhs, PreconditionIdentity()); - if (variant == 0) + if (variant < 2) { - SolverCG > solver_cg(control); + IterationNumberControl cg_control(variant == 1 ? 6 : 21, 1e-40); + SolverCG > solver_cg(cg_control); solver_cg.connect_eigenvalues_slot( std::bind(output_eigenvalues, std::placeholders::_1,"Eigenvalue estimate: ")); @@ -123,4 +121,3 @@ int main() test(3); deallog.pop(); } - diff --git a/tests/lac/gmres_eigenvalues.with_lapack=true.output b/tests/lac/gmres_eigenvalues.with_lapack=true.output index 0701d10667..1c483507b6 100644 --- a/tests/lac/gmres_eigenvalues.with_lapack=true.output +++ b/tests/lac/gmres_eigenvalues.with_lapack=true.output @@ -1,17 +1,20 @@ DEAL:double:0:GMRES::Starting value 8.000000000 -DEAL:double:0:GMRES::Convergence step 65 value 3.128687318e-29 -DEAL:double:0:GMRES::Eigenvalue estimate: (-9.043798686e-16,0.000000000) (1.000000000,0.000000000) (2.000000000,0.000000000) (3.000000000,0.000000000) (4.000000000,0.000000000) (5.000000000,0.000000000) (6.000000000,0.000000000) (7.000000000,0.000000000) (8.000000000,0.000000000) (9.000000000,0.000000000) (10.00000000,0.000000000) (11.00000000,0.000000000) (12.00000000,0.000000000) (13.00000000,0.000000000) (14.00000000,0.000000000) (15.00000000,0.000000000) (16.00000000,0.000000000) (17.00000000,0.000000000) (18.00000000,0.000000000) (19.00000000,0.000000000) (20.00000000,0.000000000) (21.00000000,0.000000000) (22.00000000,0.000000000) (23.00000000,0.000000000) (24.00000000,0.000000000) (25.00000000,0.000000000) (26.00000000,0.000000000) (27.00000000,0.000000000) (28.00000000,0.000000000) (29.00000000,0.000000000) (30.00000000,0.000000000) (31.00000000,0.000000000) (32.00000000,0.000000000) (33.00000000,0.000000000) (34.00000000,0.000000000) (35.00000000,0.000000000) (36.00000000,0.000000000) (37.00000000,0.000000000) (38.00000000,0.000000000) (39.00000000,0.000000000) (40.00000000,0.000000000) (41.00000000,0.000000000) (42.00000000,0.000000000) (43.00000000,0.000000000) (44.00000000,0.000000000) (45.00000000,0.000000000) (46.00000000,0.000000000) (47.00000000,0.000000000) (48.00000000,0.000000000) (49.00000000,0.000000000) (50.00000000,0.000000000) (51.00000000,0.000000000) (52.00000000,0.000000000) (53.00000000,0.000000000) (54.00000000,0.000000000) (55.00000000,0.000000000) (56.00000000,0.000000000) (57.00000000,0.000000000) (58.00000000,0.000000000) (59.00000000,0.000000000) (60.00000000,0.000000000) (61.00000000,0.000000000) (62.00000000,0.000000000) (63.00000000,0.000000000) (64.00000000,0.000000000) +DEAL:double:0:GMRES::Convergence step 20 value 1.667398535e-07 +DEAL:double:0:GMRES::Eigenvalue estimate: (1.000000007,0.000000000) (1.414222708,0.000000000) (1.732962333,0.000000000) (2.016155542,0.000000000) (2.322284812,0.000000000) (2.683299886,0.000000000) (3.095745505,0.000000000) (3.547981048,0.000000000) (4.028012505,0.000000000) (4.523962256,0.000000000) (5.024034115,0.000000000) (5.516592544,0.000000000) (5.990322389,0.000000000) (6.434425838,0.000000000) (6.838831720,0.000000000) (7.194403115,0.000000000) (7.493137965,0.000000000) (7.728384559,0.000000000) (7.895373518,0.000000000) (7.996484460,0.000000000) DEAL:double:0:cg::Starting value 8.000000000 -DEAL:double:0:cg::Convergence step 59 value 6.813229079e-16 -DEAL:double:0:cg::Eigenvalue estimate: 1.000000000 2.000000000 3.000000000 4.000000000 5.000000000 6.000000000 7.000000000 8.000000000 9.000000001 10.00000001 11.00000020 12.00000251 13.00002497 14.00019419 15.00117887 16.00555763 17.02025697 18.05750489 19.13068896 20.24810850 21.41118642 22.61686166 23.86022811 25.13592486 26.43863511 27.76320267 29.10462361 30.45800841 31.81854331 33.18145702 34.54199190 35.89537670 37.23679763 38.56136517 39.86407541 41.13977214 42.38313856 43.58881376 44.75189164 45.86931113 46.94249517 47.97974306 48.99444238 49.99882114 50.99980581 51.99997503 52.99999749 53.99999980 54.99999999 56.00000000 57.00000000 58.00000000 59.00000000 60.00000000 61.00000000 62.00000000 63.00000000 64.00000000 -DEAL:double:1:GMRES::Starting value 4.000000000 -DEAL:double:1:GMRES::Convergence step 16 value 2.059370821e-12 -DEAL:double:1:GMRES::Eigenvalue estimate: (1.001000000,0.000000000) (16.01600000,0.000000000) (81.08100000,0.000000000) (256.2560000,0.000000000) (625.6250000,0.000000000) (1297.296000,0.000000000) (2403.401000,0.000000000) (4100.096000,0.000000000) (6567.561000,0.000000000) (10010.00000,0.000000000) (14655.64100,0.000000000) (20756.73600,0.000000000) (28589.56100,0.000000000) (38454.41600,0.000000000) (50675.62500,0.000000000) (65601.53600,0.000000000) +DEAL:double:0:cg::Convergence step 21 value 5.549894549e-08 +DEAL:double:0:cg::Eigenvalue estimate: 1.000000007 1.414222708 1.732962333 2.016155542 2.322284812 2.683299887 3.095745504 3.547981050 4.028012504 4.523962257 5.024034115 5.516592544 5.990322389 6.434425838 6.838831721 7.194403114 7.493137966 7.728384559 7.895373518 7.996484460 +DEAL:double:1:GMRES::Starting value 8.000000000 +DEAL:double:1:GMRES::Convergence step 5 value 5.324618648e-31 +DEAL:double:1:GMRES::Eigenvalue estimate: (3.003000000,0.000000000) (4.004000000,0.000000000) (5.005000000,0.000000000) (6.006000000,0.000000000) (7.007000000,0.000000000) +DEAL:double:1:cg::Starting value 8.000000000 +DEAL:double:1:cg::Convergence step 6 value 1.444358529e-17 +DEAL:double:1:cg::Eigenvalue estimate: 3.003000000 4.004000000 5.005000000 6.006000000 7.007000000 DEAL:double:2:GMRES::Starting value 8.000000000 -DEAL:double:2:GMRES::Convergence step 65 value 2.116664042e-29 -DEAL:double:2:GMRES::Eigenvalue estimate: (-63.00000000,0.000000000) (-61.00000000,0.000000000) (-59.00000000,0.000000000) (-57.00000000,0.000000000) (-55.00000000,0.000000000) (-53.00000000,0.000000000) (-51.00000000,0.000000000) (-49.00000000,0.000000000) (-47.00000000,0.000000000) (-45.00000000,0.000000000) (-43.00000000,0.000000000) (-41.00000000,0.000000000) (-39.00000000,0.000000000) (-37.00000000,0.000000000) (-35.00000000,0.000000000) (-33.00000000,0.000000000) (-31.00000000,0.000000000) (-29.00000000,0.000000000) (-27.00000000,0.000000000) (-25.00000000,0.000000000) (-23.00000000,0.000000000) (-21.00000000,0.000000000) (-19.00000000,0.000000000) (-17.00000000,0.000000000) (-15.00000000,0.000000000) (-13.00000000,0.000000000) (-11.00000000,0.000000000) (-9.000000000,0.000000000) (-7.000000000,0.000000000) (-5.000000000,0.000000000) (-3.000000000,0.000000000) (-1.000000000,0.000000000) (-1.866591586e-15,0.000000000) (2.000000000,0.000000000) (4.000000000,0.000000000) (6.000000000,0.000000000) (8.000000000,0.000000000) (10.00000000,0.000000000) (12.00000000,0.000000000) (14.00000000,0.000000000) (16.00000000,0.000000000) (18.00000000,0.000000000) (20.00000000,0.000000000) (22.00000000,0.000000000) (24.00000000,0.000000000) (26.00000000,0.000000000) (28.00000000,0.000000000) (30.00000000,0.000000000) (32.00000000,0.000000000) (34.00000000,0.000000000) (36.00000000,0.000000000) (38.00000000,0.000000000) (40.00000000,0.000000000) (42.00000000,0.000000000) (44.00000000,0.000000000) (46.00000000,0.000000000) (48.00000000,0.000000000) (50.00000000,0.000000000) (52.00000000,0.000000000) (54.00000000,0.000000000) (56.00000000,0.000000000) (58.00000000,0.000000000) (60.00000000,0.000000000) (62.00000000,0.000000000) (64.00000000,0.000000000) -DEAL:double:3:GMRES::Starting value 4.000000000 -DEAL:double:3:GMRES::Convergence step 20 value 5.460183135e-30 -DEAL:double:3:GMRES::Eigenvalue estimate: (-5.810337659e-16,-5.026887352e-16) (-5.810337659e-16,5.026887352e-16) (4.390738627e-16,0.000000000) (1.059398453e-15,0.000000000) (0.2721368793,-1.141629651) (0.2721368793,1.141629651) (1.524881768,-3.808490348) (1.524881768,3.808490348) (2.808060005,-3.706443363) (2.808060005,3.706443363) (4.495975596,-4.110246191) (4.495975596,4.110246191) (7.175640490,-5.379965252) (7.175640490,5.379965252) (10.26076740,-5.975843074) (10.26076740,5.975843074) (13.93423683,-5.924460400) (13.93423683,5.924460400) (18.52830103,-4.066775001) (18.52830103,4.066775001) -DEAL:double:3::Actual eigenvalues: (0.2721368793,-1.141629651) (0.2721368793,1.141629651) (1.524881768,-3.808490348) (1.524881768,3.808490348) (2.808060005,-3.706443363) (2.808060005,3.706443363) (4.495975596,-4.110246191) (4.495975596,4.110246191) (7.175640490,-5.379965252) (7.175640490,5.379965252) (10.26076740,-5.975843074) (10.26076740,5.975843074) (13.93423683,-5.924460400) (13.93423683,5.924460400) (18.52830103,-4.066775001) (18.52830103,4.066775001) +DEAL:double:2:GMRES::Convergence step 20 value 0.3551107715 +DEAL:double:2:GMRES::Eigenvalue estimate: (-7.926065650,0.000000000) (-7.694606169,0.000000000) (-7.304462968,0.000000000) (-6.754668729,0.000000000) (-6.057398742,0.000000000) (-5.229423498,0.000000000) (-4.291752657,0.000000000) (-3.270701488,0.000000000) (-2.201310856,0.000000000) (-1.097644710,0.000000000) (1.436723940,0.000000000) (2.347118372,0.000000000) (3.367064423,0.000000000) (4.371036372,0.000000000) (5.301069258,0.000000000) (6.125057374,0.000000000) (6.820050929,0.000000000) (7.368491234,0.000000000) (7.757829623,0.000000000) (7.988701359,0.000000000) +DEAL:double:3:GMRES::Starting value 4.472135955 +DEAL:double:3:GMRES::Convergence step 20 value 8.452962309e-31 +DEAL:double:3:GMRES::Eigenvalue estimate: (-10.73820625,-2.766084242) (-10.73820625,2.766084242) (-7.568923359,-5.626514292) (-7.568923359,5.626514292) (-4.680041124,-6.423458360) (-4.680041124,6.423458360) (-2.517885748,-6.946716800) (-2.517885748,6.946716800) (0.1188921681,-7.446342390) (0.1188921681,7.446342390) (1.814571787,-1.534115259) (1.814571787,1.534115259) (2.532932555,-7.153004003) (2.532932555,7.153004003) (3.107034485,-5.685978159) (3.107034485,5.685978159) (5.845443976,-6.211160626) (5.845443976,6.211160626) (9.792068366,-4.535174892) (9.792068366,4.535174892) +DEAL:double:3::Actual eigenvalues: (-10.73820625,-2.766084242) (-10.73820625,2.766084242) (-7.568923359,-5.626514292) (-7.568923359,5.626514292) (-4.680041124,-6.423458360) (-4.680041124,6.423458360) (-2.517885748,-6.946716800) (-2.517885748,6.946716800) (0.1188921681,-7.446342390) (0.1188921681,7.446342390) (1.814571787,-1.534115259) (1.814571787,1.534115259) (2.532932555,-7.153004003) (2.532932555,7.153004003) (3.107034485,-5.685978159) (3.107034485,5.685978159) (5.845443976,-6.211160626) (5.845443976,6.211160626) (9.792068366,-4.535174892) (9.792068366,4.535174892)