Skip to content

Commit f215024

Browse files
Apply PPCG S operator on active columns
1 parent 095ee27 commit f215024

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

source/source_hsolver/ppcg/diago_ppcg_diag.hpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ double DiagoPPCG<T, Device>::diag(const HPsiFunc& hpsi_func,
8787
record_residual(0, "initial_rr");
8888

8989
std::vector<T> w_active;
90+
std::vector<T> sw_active;
9091
std::vector<T> hw_active;
9192
std::vector<int> cols;
9293
SmallSubspace subspace;
@@ -98,17 +99,22 @@ double DiagoPPCG<T, Device>::diag(const HPsiFunc& hpsi_func,
9899

99100
// Precondition the residual.
100101
divide_by_preconditioner(active_cols, prec, w_);
101-
apply_s_current(w_.data(), sw_.data(), ncol);
102+
copy_cols(w_.data(), active_cols, w_active);
103+
sw_active.assign(ld_psi_ * nact, T(0));
104+
apply_s_current(w_active.data(), sw_active.data(), nact);
105+
scatter_cols(sw_.data(), active_cols, sw_active);
102106
project_against(psi_in, spsi_.data(), all_cols, w_, sw_, active_cols);
103107

104108
// Apply H to the search direction.
105109
copy_cols(w_.data(), active_cols, w_active);
106110
force_g0_real(w_active.data(), nact);
107111
hw_active.assign(ld_psi_ * nact, T(0));
112+
sw_active.assign(ld_psi_ * nact, T(0));
108113
scatter_cols(w_.data(), active_cols, w_active);
109114
apply_h(hpsi_func, w_active.data(), hw_active.data(), nact);
115+
apply_s_current(w_active.data(), sw_active.data(), nact);
110116
scatter_cols(hw_.data(), active_cols, hw_active);
111-
apply_s_current(w_.data(), sw_.data(), ncol);
117+
scatter_cols(sw_.data(), active_cols, sw_active);
112118

113119
avg_iter += static_cast<double>(nact) / static_cast<double>(ncol);
114120

0 commit comments

Comments
 (0)