Skip to content

Commit f6c2263

Browse files
committed
Modify pointer usage
1 parent 5150d3f commit f6c2263

File tree

2 files changed

+21
-21
lines changed

2 files changed

+21
-21
lines changed

source/module_hsolver/diag_const_nums.cpp

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@ const_nums<double>::const_nums()
1313
{
1414
base_device::memory::resize_memory_op<double, base_device::DEVICE_CPU>()(
1515
this->cpu_ctx, this->zero, 1);
16-
*this->zero = 0.0;
16+
this->zero[0] = 0.0;
1717
base_device::memory::resize_memory_op<double, base_device::DEVICE_CPU>()(
1818
this->cpu_ctx, this->one, 1);
19-
*this->one = 1.0;
19+
this->one[0] = 1.0;
2020
base_device::memory::resize_memory_op<double, base_device::DEVICE_CPU>()(
2121
this->cpu_ctx, this->neg_one, 1);
22-
*this->neg_one = -1.0;
22+
this->neg_one[0] = -1.0;
2323
}
2424

2525
// Specialize templates to support double types
@@ -28,13 +28,13 @@ const_nums<float>::const_nums()
2828
{
2929
base_device::memory::resize_memory_op<float, base_device::DEVICE_CPU>()(
3030
this->cpu_ctx, this->zero, 1);
31-
*this->zero = 0.0;
31+
this->zero[0] = 0.0;
3232
base_device::memory::resize_memory_op<float, base_device::DEVICE_CPU>()(
3333
this->cpu_ctx, this->one, 1);
34-
*this->one = 1.0;
34+
this->one[0] = 1.0;
3535
base_device::memory::resize_memory_op<float, base_device::DEVICE_CPU>()(
3636
this->cpu_ctx, this->neg_one, 1);
37-
*this->neg_one = -1.0;
37+
this->neg_one[0] = -1.0;
3838
}
3939

4040
// Specialized templates to support std:: complex<double>types
@@ -43,13 +43,13 @@ const_nums<std::complex<double>>::const_nums()
4343
{
4444
base_device::memory::resize_memory_op<std::complex<double>, base_device::DEVICE_CPU>()(
4545
this->cpu_ctx, this->zero, 1);
46-
*this->zero = std::complex<double>(0.0, 0.0);
46+
this->zero[0] = std::complex<double>(0.0, 0.0);
4747
base_device::memory::resize_memory_op<std::complex<double>, base_device::DEVICE_CPU>()(
4848
this->cpu_ctx, this->one, 1);
49-
*this->one = std::complex<double>(1.0, 0.0);
49+
this->one[0] = std::complex<double>(1.0, 0.0);
5050
base_device::memory::resize_memory_op<std::complex<double>, base_device::DEVICE_CPU>()(
5151
this->cpu_ctx, this->neg_one, 1);
52-
*this->neg_one = std::complex<double>(-1.0, 0.0);
52+
this->neg_one[0] = std::complex<double>(-1.0, 0.0);
5353
}
5454

5555
// Specialized templates to support std:: complex<float>types
@@ -58,11 +58,11 @@ const_nums<std::complex<float>>::const_nums()
5858
{
5959
base_device::memory::resize_memory_op<std::complex<float>, base_device::DEVICE_CPU>()(
6060
this->cpu_ctx, this->zero, 1);
61-
*this->zero = std::complex<float>(0.0, 0.0);
61+
this->zero[0] = std::complex<float>(0.0, 0.0);
6262
base_device::memory::resize_memory_op<std::complex<float>, base_device::DEVICE_CPU>()(
6363
this->cpu_ctx, this->one, 1);
64-
*this->one = std::complex<float>(1.0, 0.0);
64+
this->one[0] = std::complex<float>(1.0, 0.0);
6565
base_device::memory::resize_memory_op<std::complex<float>, base_device::DEVICE_CPU>()(
6666
this->cpu_ctx, this->neg_one, 1);
67-
*this->neg_one = std::complex<float>(-1.0, 0.0);
67+
this->neg_one[0] = std::complex<float>(-1.0, 0.0);
6868
}

source/module_hsolver/diago_dav_subspace.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ Diago_DavSubspace<T, Device>::Diago_DavSubspace(const std::vector<Real>& precond
2525
{
2626
this->device = base_device::get_device_type<Device>(this->ctx);
2727

28-
this->one = this->cs.one;
29-
this->zero = this->cs.zero;
30-
this->neg_one = this->cs.neg_one;
28+
this->one = this->cs.one[0];
29+
this->zero = this->cs.zero[0];
30+
this->neg_one = this->cs.neg_one[0];
3131

3232
assert(david_ndim_in > 1);
3333
assert(david_ndim_in * nband_in < nbasis_in * this->diag_comm.nproc);
@@ -534,8 +534,8 @@ void Diago_DavSubspace<T, Device>::diag_zhegvx(const int& nbase,
534534
}
535535
else
536536
{
537-
std::vector<std::vector<T>> h_diag(nbase, std::vector<T>(nbase, *cs.zero));
538-
std::vector<std::vector<T>> s_diag(nbase, std::vector<T>(nbase, *cs.zero));
537+
std::vector<std::vector<T>> h_diag(nbase, std::vector<T>(nbase, cs.zero[0]));
538+
std::vector<std::vector<T>> s_diag(nbase, std::vector<T>(nbase, cs.zero[0]));
539539

540540
for (size_t i = 0; i < nbase; i++)
541541
{
@@ -564,10 +564,10 @@ void Diago_DavSubspace<T, Device>::diag_zhegvx(const int& nbase,
564564

565565
for (size_t j = nbase; j < this->nbase_x; j++)
566566
{
567-
hcc[i * this->nbase_x + j] = *cs.zero;
568-
hcc[j * this->nbase_x + i] = *cs.zero;
569-
scc[i * this->nbase_x + j] = *cs.zero;
570-
scc[j * this->nbase_x + i] = *cs.zero;
567+
hcc[i * this->nbase_x + j] = cs.zero[0];
568+
hcc[j * this->nbase_x + i] = cs.zero[0];
569+
scc[i * this->nbase_x + j] = cs.zero[0];
570+
scc[j * this->nbase_x + i] = cs.zero[0];
571571
}
572572
}
573573
}

0 commit comments

Comments
 (0)