]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
test for eigenvector iterations
authorguido <guido@0785d39b-7218-0410-832d-ea1e28bc413d>
Wed, 23 Apr 2003 09:31:11 +0000 (09:31 +0000)
committerguido <guido@0785d39b-7218-0410-832d-ea1e28bc413d>
Wed, 23 Apr 2003 09:31:11 +0000 (09:31 +0000)
git-svn-id: https://svn.dealii.org/trunk@7450 0785d39b-7218-0410-832d-ea1e28bc413d

tests/lac/Makefile
tests/lac/eigen.cc
tests/results/sparc-sun-solaris2.7+gcc2.95/lac/eigen.output [new file with mode: 0644]

index f50f5edbac48f32bb2e47fb87cb58777376d544c..1ec83d497f3adb1399cf05064e5e94b81e6a2dc9 100644 (file)
@@ -39,7 +39,7 @@ vector-vector.exe         : vector-vector.g.$(OBJEXT)                   $(librar
 tests = $(sort \
           sparse_matrices block_matrices block_vector block_vector_iterator \
           full_matrix \
-          matrix_out solver sparsity_pattern sparse_ilu \
+          matrix_out solver eigen sparsity_pattern sparse_ilu \
           vector-vector)
 
 ############################################################
index 9ed17e26c07b7cc5fe763c9bbd387d34bcb3b361..9a0cf931c65dc9d2634db06b3d5c4d401aaa4389 100644 (file)
@@ -25,7 +25,6 @@
 #include <lac/eigen.h>
 #include <lac/precondition.h>
 
-
 int main()
 {
     std::ofstream logfile("eigen.output");
@@ -39,6 +38,19 @@ int main()
   
   const unsigned int size = 10;
   const unsigned int dim = (size-1)*(size-1);
+
+                                  /*
+                                   * Compute minimal and maximal
+                                   * eigenvalues of the 5-point
+                                   * stencil matrix
+                                   * (Hackbusch:Iterative Lösung...,
+                                   * Satz 4.1.1)
+                                   */
+  const double h = 1./size;
+  const double s = std::sin(M_PI*h/2.);
+  const double c = std::cos(M_PI*h/2.);
+  const double lambda_max = 8.*c*c;
+  const double lambda_min = 8.*s*s;
   
   FDMatrix testproblem(size, size);
   SparsityPattern structure(dim, dim, 5);
@@ -53,24 +65,24 @@ int main()
 
   EigenPower<> mises(control, mem);
   mises.solve(lambda, A, u);
-  deallog << "Eigenvalue " << lambda << std::endl;
+  deallog << "Eigenvalue " << lambda << " Error " << lambda-lambda_max << std::endl;
 
   double lambda2;
   u = 1.;
   
   EigenPower<> mises2(control, mem, -1.5*lambda);
   mises2.solve(lambda2, A, u);
-  deallog << "Eigenvalue " << lambda2 << std::endl;
+  deallog << "Eigenvalue " << lambda2 << " Error " << lambda2-lambda_min << std::endl;
 
   u = 1.;
   lambda = 0.;
-  EigenInverse<> wieland(control, mem);
+  EigenInverse<> wielandt(control, mem);
   wieland.solve(lambda, A, u);
-  deallog << "Eigenvalue " << lambda << std::endl;  
+  deallog << "Eigenvalue " << lambda << " Error " << lambda-lambda_min << std::endl;  
 
   u = 1.;
   lambda = 10.;
-  EigenInverse<> wieland2(control, mem);
+  EigenInverse<> wielandt2(control, mem);
   wieland2.solve(lambda, A, u);
-  deallog << "Eigenvalue " << lambda << std::endl;  
+  deallog << "Eigenvalue " << lambda << " Error " << lambda-lambda_max << std::endl;  
 }
diff --git a/tests/results/sparc-sun-solaris2.7+gcc2.95/lac/eigen.output b/tests/results/sparc-sun-solaris2.7+gcc2.95/lac/eigen.output
new file mode 100644 (file)
index 0000000..8a13ce0
--- /dev/null
@@ -0,0 +1,15 @@
+
+DEAL:Power method::Starting value 1.246
+DEAL:Power method::Convergence step 44 value 9.310e-06
+DEAL::Eigenvalue 7.802 Error 0.002634
+DEAL:Power method::Starting value 0.02241
+DEAL:Power method::Convergence step 21 value 9.269e-06
+DEAL::Eigenvalue 0.2045 Error 0.008767
+DEAL:Wieland::Starting value 0.08568
+DEAL:Wieland::Convergence step 6 value 6.201e-06
+DEAL::Eigenvalue 0.1958 Error 1.511e-10
+DEAL:Wieland::Starting value 0.7500
+DEAL:Wieland::Convergence step 12 value 6.576e-06
+DEAL::Eigenvalue 7.804 Error -3.202e-08
+DEAL::GrowingVectorMemory:Overall allocated vectors: 88
+DEAL::GrowingVectorMemory:Maximum allocated vectors: 6

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.