Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions source/module_hsolver/diago_david.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,21 +30,19 @@ class DiagoDavid : public DiagH<T, Device>

// declare type of matrix-blockvector functions.
// the function type is defined as a std::function object.
// notice that hpsi and spsi functions require
// !different! order of input and output blockvectors.
/**
* @brief A function type representing the HX function.
*
* This function type is used to define a matrix-blockvector operator H.
* For eigenvalue problem HX = λX or generalized eigenvalue problem HX = λSX,
* this function computes the product of the Hamiltonian matrix H and a blockvector X.
*
* @param[out] X Pointer to input blockvector of type `T*`.
* @param[in] HX Pointer to output blockvector of type `T*`.
* @param[in] neig Number of eigebpairs required.
* @param[in] dim Dimension of matrix.
* @param[in] id_start Start index of blockvector.
* @param[in] id_end End index of blockvector.
* @param[out] X Pointer to input blockvector of type `T*`.
* @param[in] HX Pointer to output blockvector of type `T*`.
* @param[in] nvec Number of eigebpairs, i.e. number of vectors in a block.
* @param[in] dim Dimension of matrix.
* @param[in] id_start Start index of blockvector.
* @param[in] id_end End index of blockvector.
*/
using HPsiFunc = std::function<void(T*, T*, const int, const int, const int, const int)>;

Expand All @@ -60,6 +58,8 @@ class DiagoDavid : public DiagH<T, Device>
* @param[in] nrow Dimension of SX: nbands * nrow.
* @param[in] npw Number of plane waves.
* @param[in] nbands Number of bands.
*
* @note called as spsi(in, out, dim, dim, 1)
*/
using SPsiFunc = std::function<void(T*, T*, const int, const int, const int)>;

Expand Down
6 changes: 3 additions & 3 deletions source/module_hsolver/hsolver_pw.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ void HSolverPW<T, Device>::hamiltSolvePsiK(hamilt::Hamilt<T, Device>* hm,

if (this->method == "cg")
{
// warp the subspace_func into a lambda function
// wrap the subspace_func into a lambda function
auto ngk_pointer = psi.get_ngk_pointer();
auto subspace_func = [hm, ngk_pointer](const ct::Tensor& psi_in, ct::Tensor& psi_out) {
// psi_in should be a 2D tensor:
Expand Down Expand Up @@ -355,10 +355,10 @@ void HSolverPW<T, Device>::hamiltSolvePsiK(hamilt::Hamilt<T, Device>* hm,
this->diag_iter_max,
this->nproc_in_pool);

// warp the hpsi_func and spsi_func into a lambda function
// wrap the hpsi_func and spsi_func into a lambda function
using ct_Device = typename ct::PsiToContainer<Device>::type;

// warp the hpsi_func and spsi_func into a lambda function
// wrap the hpsi_func and spsi_func into a lambda function
auto hpsi_func = [hm, ngk_pointer](const ct::Tensor& psi_in, ct::Tensor& hpsi_out) {
ModuleBase::timer::tick("DiagoCG_New", "hpsi_func");
// psi_in should be a 2D tensor:
Expand Down