36 int first_nonzero_g_index)
37 : first_nonzero_g_index_(first_nonzero_g_index) {
38 weights_.assign(g_squared.size(), 1.0);
39 for (std::size_t g_index =
static_cast<std::size_t
>(first_nonzero_g_index);
40 g_index < g_squared.size();
42 weights_[g_index] = g_squared[g_index] / (g_squared[g_index] + q0_squared);
46 [[nodiscard]] std::string
name()
const override {
50 void apply(std::vector<Complex>& residual_g)
const override {
51 std::size_t count = std::min(residual_g.size(), weights_.size());
52 for (std::size_t g_index =
static_cast<std::size_t
>(first_nonzero_g_index_);
55 residual_g[g_index] *= weights_[g_index];
60 [[nodiscard]]
const std::vector<Real>&
weights()
const {
65 std::vector<Real> weights_;
66 int first_nonzero_g_index_{0};
Diagonal G²/(G²+q0²) residual filter.
const std::vector< Real > & weights() const
The filter values, exposed for the local-TF inner preconditioner and for tests.
KerkerPreconditioner(const std::vector< Real > &g_squared, Real q0_squared, int first_nonzero_g_index)
std::string name() const override
void apply(std::vector< Complex > &residual_g) const override
Abstract base class for all SCF residual preconditioners.