@@ -302,14 +302,10 @@ void DiagoPPCG<T, Device>::update_one_block(
302302 }
303303 };
304304
305- auto combine = [&](const std::vector<T>& a,
306- const std::vector<T>& b,
307- const std::vector<T>& c,
305+ auto combine = [&](const std::vector<T>& basis,
308306 const std::vector<T>& coeff,
309307 std::vector<T>& out)
310308 {
311- std::vector<T> basis;
312- fill_basis (a, b, c, basis);
313309 const T one = T (1 );
314310 const T zero = T (0 );
315311 ModuleBase::gemm_op<T, Device>()(' N' ,
@@ -327,12 +323,19 @@ void DiagoPPCG<T, Device>::update_one_block(
327323 ld_psi_);
328324 };
329325
330- combine (psi_l, w_l, p_l, coeff_state, psi_new);
331- combine (spsi_l, sw_l, sp_l, coeff_state, spsi_new);
332- combine (hpsi_l, hw_l, hp_l, coeff_state, hpsi_new);
333- combine (psi_l, w_l, p_l, coeff_dir, p_new);
334- combine (spsi_l, sw_l, sp_l, coeff_dir, sp_new);
335- combine (hpsi_l, hw_l, hp_l, coeff_dir, hp_new);
326+ std::vector<T> psi_basis;
327+ std::vector<T> spsi_basis;
328+ std::vector<T> hpsi_basis;
329+ fill_basis (psi_l, w_l, p_l, psi_basis);
330+ fill_basis (spsi_l, sw_l, sp_l, spsi_basis);
331+ fill_basis (hpsi_l, hw_l, hp_l, hpsi_basis);
332+
333+ combine (psi_basis, coeff_state, psi_new);
334+ combine (spsi_basis, coeff_state, spsi_new);
335+ combine (hpsi_basis, coeff_state, hpsi_new);
336+ combine (psi_basis, coeff_dir, p_new);
337+ combine (spsi_basis, coeff_dir, sp_new);
338+ combine (hpsi_basis, coeff_dir, hp_new);
336339
337340 scatter_cols (psi, cols, psi_new);
338341 scatter_cols (spsi_.data (), cols, spsi_new);
0 commit comments