#include <lac/eigen.h>
#include <lac/precondition.h>
-
int main()
{
std::ofstream logfile("eigen.output");
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);
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;
}
--- /dev/null
+
+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