49template < OperatorLike OperatorT >
74 const std::vector< SolutionVectorType >& tmps,
75 const int iterations = 1,
76 const int max_ev_power_iterations = 50 )
78 , inverse_diagonal_( inverse_diagonal )
79 , iterations_( iterations )
81 , max_ev_power_iterations_( max_ev_power_iterations )
82 , need_max_ev_estimation_( true )
86 Kokkos::abort(
"Chebyshev order must be at least 1." );
89 if ( tmps_.size() < 2 )
91 Kokkos::abort(
"Chebyshev requires at least 2 tmp vectors." );
102 if ( need_max_ev_estimation_ )
104 estimate_max_eigenvalues( A );
105 need_max_ev_estimation_ =
false;
111 const auto lambda_max = 1.5 * max_ev_estimate_;
112 const auto lambda_min = 0.1 * max_ev_estimate_;
114 const auto theta = 0.5 * ( lambda_max + lambda_min );
115 const auto delta = 0.5 * ( lambda_max - lambda_min );
117 const auto sigma = theta / delta;
118 auto rho = 1.0 / sigma;
120 for (
int iteration = 0; iteration < iterations_; ++iteration )
126 lincomb( z, { 1.0, -1.0 }, { b, z } );
132 lincomb( d, { 1.0 / theta }, { z } );
133 lincomb( x, { 1.0, 1.0 }, { x, d } );
137 for (
int i = 2; i <= order_; ++i )
139 const auto rho_new = 1.0 / ( 2.0 * sigma - rho );
141 const auto beta = rho_new * rho;
142 const auto alpha = 2.0 * rho_new / delta;
145 lincomb( z, { 1.0, -1.0 }, { b, z } );
151 lincomb( d, { alpha, beta }, { z, d } );
152 lincomb( x, { 1.0, 1.0 }, { x, d } );
173 std::vector< SolutionVectorType > tmps_;
174 int max_ev_power_iterations_;
175 bool need_max_ev_estimation_;
180static_assert( SolverLike< Chebyshev< linalg::detail::DummyConcreteOperator > > );
Given some operator and a vector , this operator is equivalent to an operator defined as.
Definition diagonally_scaled_operator.hpp:16
Chebyshev accelerated Jacobi iterative solver for linear systems.
Definition chebyshev.hpp:51
void refresh_max_eigenvalue_estimate_in_next_solve()
Definition chebyshev.hpp:161
SrcOf< OperatorType > SolutionVectorType
Solution vector type.
Definition chebyshev.hpp:56
SolutionVectorType::ScalarType ScalarType
Scalar type for computations.
Definition chebyshev.hpp:61
Chebyshev(const int order, const SolutionVectorType &inverse_diagonal, const std::vector< SolutionVectorType > &tmps, const int iterations=1, const int max_ev_power_iterations=50)
Construct a Chebyshev accelerated Jacobi solver.
Definition chebyshev.hpp:71
void solve_impl(OperatorType &A, SolutionVectorType &x, const RHSVectorType &b)
Solve the linear system using the Chebyshev iteration. Applies the update rule for the specified numb...
Definition chebyshev.hpp:100
DstOf< OperatorType > RHSVectorType
Right-hand side vector type.
Definition chebyshev.hpp:58
OperatorT OperatorType
Operator type to be solved.
Definition chebyshev.hpp:54
SolutionVectorType & get_inverse_diagonal()
Definition chebyshev.hpp:159
Definition block_preconditioner_2x2.hpp:7
double power_iteration(OperatorT &op, SrcOf< OperatorT > &tmpIt, SrcOf< OperatorT > &tmpAux, const int iterations)
Power iteration to estimate the largest eigenvalue of a row-normalized operator D^{-1}A,...
Definition power_iteration.hpp:13
void lincomb(Vector &y, const std::vector< ScalarOf< Vector > > &c, const std::vector< Vector > &x, const ScalarOf< Vector > &c0)
Compute a linear combination of vectors. Implements: .
Definition vector.hpp:72
Operator::SrcVectorType SrcOf
Alias for the source vector type of an operator.
Definition operator.hpp:145
void apply(LinearForm &L, typename LinearForm::DstVectorType &dst)
Apply a linear form and write to a destination vector.
Definition linear_form.hpp:37
Operator::DstVectorType DstOf
Alias for the destination vector type of an operator.
Definition operator.hpp:149
void scale_in_place(Vector &y, const Vector &x)
Scale a vector in place with another vector. For each entry , computes .
Definition vector.hpp:137