]> https://gitweb.dealii.org/ - dealii.git/commitdiff
test for eigenvector iterations
authorGuido Kanschat <dr.guido.kanschat@gmail.com>
Wed, 23 Apr 2003 09:31:11 +0000 (09:31 +0000)
committerGuido Kanschat <dr.guido.kanschat@gmail.com>
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

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;  
 }

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.