From: Matthias Maier Date: Thu, 6 Apr 2017 21:26:56 +0000 (-0500) Subject: Use LinearOperator instead of ShiftedMatrix in eigen.h X-Git-Tag: v9.0.0-rc1~1713^2~2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=70d4a7679fb884003bf12024d8cb240972fb7db0;p=dealii.git Use LinearOperator instead of ShiftedMatrix in eigen.h --- diff --git a/include/deal.II/lac/eigen.h b/include/deal.II/lac/eigen.h index 9d874d234e..f459270ca3 100644 --- a/include/deal.II/lac/eigen.h +++ b/include/deal.II/lac/eigen.h @@ -18,14 +18,14 @@ #include -#include -#include -#include +#include +#include #include +#include #include +#include #include #include -#include #include @@ -334,7 +334,9 @@ EigenInverse::solve (double &value, SolverControl::State conv=SolverControl::iterate; // Prepare matrix for solver - ShiftedMatrix A_s(A, -value); + auto A_op = linear_operator(A); + double current_shift = -value; + auto A_s = A_op + current_shift * identity_operator(A_op); // Define solver ReductionControl inner_control (5000, 1.e-16, 1.e-5, false, false); @@ -385,13 +387,17 @@ EigenInverse::solve (double &value, // Compute unshifted eigenvalue value = (entry * x (i) < 0.) ? -length : length; value = 1./value; - value -= A_s.shift (); + value -= current_shift; if (iter==goal) { - const double new_shift = - additional_data.relaxation * value - + (1.-additional_data.relaxation) * A_s.shift(); - A_s.shift(new_shift); + const auto &relaxation = additional_data.relaxation; + const double new_shift = + relaxation * (-value) + (1. - relaxation) * current_shift; + + A_s = A_op + new_shift * identity_operator(A_op); + current_shift = new_shift; + ++goal; }