51template < OperatorLike OperatorT >
76 const std::vector< SolutionVectorType >& tmps,
77 const int iterations = 1,
78 const int max_ev_power_iterations = 50 )
80 , inverse_diagonal_( inverse_diagonal )
81 , iterations_( iterations )
83 , max_ev_power_iterations_( max_ev_power_iterations )
84 , need_max_ev_estimation_( true )
88 Kokkos::abort(
"Chebyshev order must be at least 1." );
91 if ( tmps_.size() < 2 )
93 Kokkos::abort(
"Chebyshev requires at least 2 tmp vectors." );
104 if ( need_max_ev_estimation_ )
106 estimate_max_eigenvalues( A );
107 need_max_ev_estimation_ =
false;
114 if ( !std::isfinite( max_ev_estimate_ ) || max_ev_estimate_ <=
ScalarType( 0 ) )
119 const auto lambda_max = 1.5 * max_ev_estimate_;
120 const auto lambda_min = 0.1 * max_ev_estimate_;
122 const auto theta = 0.5 * ( lambda_max + lambda_min );
123 const auto delta = 0.5 * ( lambda_max - lambda_min );
125 const auto sigma = theta / delta;
126 auto rho = 1.0 / sigma;
128 for (
int iteration = 0; iteration < iterations_; ++iteration )
134 lincomb( z, { 1.0, -1.0 }, { b, z } );
140 lincomb( d, { 1.0 / theta }, { z } );
141 lincomb( x, { 1.0, 1.0 }, { x, d } );
145 for (
int i = 2; i <= order_; ++i )
147 const auto rho_new = 1.0 / ( 2.0 * sigma - rho );
149 const auto beta = rho_new * rho;
150 const auto alpha = 2.0 * rho_new / delta;
153 lincomb( z, { 1.0, -1.0 }, { b, z } );
159 lincomb( d, { alpha, beta }, { z, d } );
160 lincomb( x, { 1.0, 1.0 }, { x, d } );
181 std::vector< SolutionVectorType > tmps_;
182 int max_ev_power_iterations_;
183 bool need_max_ev_estimation_;
188static_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:53
void refresh_max_eigenvalue_estimate_in_next_solve()
Definition chebyshev.hpp:169
SrcOf< OperatorType > SolutionVectorType
Solution vector type.
Definition chebyshev.hpp:58
SolutionVectorType::ScalarType ScalarType
Scalar type for computations.
Definition chebyshev.hpp:63
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:73
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:102
DstOf< OperatorType > RHSVectorType
Right-hand side vector type.
Definition chebyshev.hpp:60
OperatorT OperatorType
Operator type to be solved.
Definition chebyshev.hpp:56
SolutionVectorType & get_inverse_diagonal()
Definition chebyshev.hpp:167
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:15
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