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
18 changes: 9 additions & 9 deletions source/module_hsolver/diago_dav_subspace.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ Diago_DavSubspace<T, Device>::Diago_DavSubspace(const std::vector<Real>& precond
{
this->device = base_device::get_device_type<Device>(this->ctx);

this->one = this->cs.one;
this->zero = this->cs.zero;
this->neg_one = this->cs.neg_one;
this->one = &one_;
this->zero = &zero_;
this->neg_one = &neg_one_;

assert(david_ndim_in > 1);
assert(david_ndim_in * nband_in < nbasis_in * this->diag_comm.nproc);
Expand Down Expand Up @@ -559,8 +559,8 @@ void Diago_DavSubspace<T, Device>::diag_zhegvx(const int& nbase,
}
else
{
std::vector<std::vector<T>> h_diag(nbase, std::vector<T>(nbase, cs.zero[0]));
std::vector<std::vector<T>> s_diag(nbase, std::vector<T>(nbase, cs.zero[0]));
std::vector<std::vector<T>> h_diag(nbase, std::vector<T>(nbase, *this->zero));
std::vector<std::vector<T>> s_diag(nbase, std::vector<T>(nbase, *this->zero));

for (size_t i = 0; i < nbase; i++)
{
Expand Down Expand Up @@ -589,10 +589,10 @@ void Diago_DavSubspace<T, Device>::diag_zhegvx(const int& nbase,

for (size_t j = nbase; j < this->nbase_x; j++)
{
hcc[i * this->nbase_x + j] = cs.zero[0];
hcc[j * this->nbase_x + i] = cs.zero[0];
scc[i * this->nbase_x + j] = cs.zero[0];
scc[j * this->nbase_x + i] = cs.zero[0];
hcc[i * this->nbase_x + j] = *this->zero;
hcc[j * this->nbase_x + i] = *this->zero;
scc[i * this->nbase_x + j] = *this->zero;
scc[j * this->nbase_x + i] = *this->zero;
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion source/module_hsolver/diago_dav_subspace.h
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,8 @@ class Diago_DavSubspace
using syncmem_h2d_op = base_device::memory::synchronize_memory_op<T, Device, base_device::DEVICE_CPU>;
using syncmem_d2h_op = base_device::memory::synchronize_memory_op<T, base_device::DEVICE_CPU, Device>;

const_nums<T> cs;
const T *one = nullptr, *zero = nullptr, *neg_one = nullptr;
const T one_ = static_cast<T>(1.0), zero_ = static_cast<T>(0.0), neg_one_ = static_cast<T>(-1.0);
};

} // namespace hsolver
Expand Down
Loading