Skip to content

Commit ca96d8e

Browse files
authored
type 1 fix with std::complex (#6346)
1 parent 47bfd69 commit ca96d8e

File tree

132 files changed

+541
-541
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

132 files changed

+541
-541
lines changed

source/module_lr/esolver_lrtd_lcao.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,12 @@ void LR::ESolver_LR<std::complex<double>>::move_exx_lri(std::shared_ptr<Exx_LRI<
3636
template<>
3737
void LR::ESolver_LR<std::complex<double>>::move_exx_lri(std::shared_ptr<Exx_LRI<double>>& exx_ks)
3838
{
39-
throw std::runtime_error("ESolver_LR<std::complex<double>>::move_exx_lri: cannot move double to complex<double>");
39+
throw std::runtime_error("ESolver_LR<std::complex<double>>::move_exx_lri: cannot move double to std::complex<double>");
4040
}
4141
template<>
4242
void LR::ESolver_LR<double>::move_exx_lri(std::shared_ptr<Exx_LRI<std::complex<double>>>& exx_ks)
4343
{
44-
throw std::runtime_error("ESolver_LR<double>::move_exx_lri: cannot move complex<double> to double");
44+
throw std::runtime_error("ESolver_LR<double>::move_exx_lri: cannot move std::complex<double> to double");
4545
}
4646
#endif
4747
template<>void LR::ESolver_LR<double>::set_gint() { this->gint_ = &this->gint_g_;this->gint_g_.gridt = &this->gt_; }

source/module_lr/utils/lr_util.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ namespace LR_Util
132132

133133
void diag_lapack(const int& n, std::complex<double>* mat, double* eig)
134134
{
135-
ModuleBase::TITLE("LR_Util", "diag_lapack<complex<double>>");
135+
ModuleBase::TITLE("LR_Util", "diag_lapack <std::complex<double>>");
136136
int lwork = 2 * n;
137137
std::complex<double>* work2 = new std::complex<double>[lwork];
138138
double* rwork = new double[3 * n - 2];
@@ -167,7 +167,7 @@ namespace LR_Util
167167

168168
void diag_lapack_nh(const int& n, std::complex<double>* mat, std::complex<double>* eig)
169169
{
170-
ModuleBase::TITLE("LR_Util", "diag_lapack_nh<complex<double>>");
170+
ModuleBase::TITLE("LR_Util", "diag_lapack_nh <std::complex<double>>");
171171
int lwork = 2 * n;
172172
std::vector<std::complex<double>> work2(lwork);
173173
std::vector<double> rwork(3 * n - 2);

source/source_base/complexmatrix.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ class ComplexMatrix
5454
//==================
5555
// member function:
5656
//==================
57-
//set all elements to be complex<double> {0.0,0.0}
57+
//set all elements to be std::complex<double> {0.0,0.0}
5858
void zero_out(void);
5959
//set to be a unit matrix,
6060
void set_as_identity_matrix(void);

source/source_base/parallel_reduce.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
#include <cassert>
99
#include <complex>
1010

11-
using std::complex;
11+
// using std::complex;
1212

1313
namespace Parallel_Reduce
1414
{

source/source_basis/module_pw/pw_basis.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ class PW_Basis
243243
// done first; false: y-fft For gamma_only, true: we use half x; false: we use half y
244244
int ng_xeq0 = 0; //only used when xprime = true, number of g whose gx = 0
245245
int nmaxgr = 0; // Gamma_only: max between npw and (nrxx+1)/2, others: max between npw and nrxx
246-
// Thus complex<double>[nmaxgr] is able to contain either reciprocal or real data
246+
// Thus std::complex<double>[nmaxgr] is able to contain either reciprocal or real data
247247
// FFT ft;
248248
FFT_Bundle fft_bundle;
249249
//The position of pointer in and out can be equal(in-place transform) or different(out-of-place transform).

source/source_basis/module_pw/pw_transform.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ namespace ModulePW
1818
* @brief transform real space to reciprocal space
1919
* @details c(g)=\int dr*f(r)*exp(-ig*r)
2020
* Here we calculate c(g)
21-
* @param in: (nplane,ny,nx), complex<double> data
22-
* @param out: (nz, ns), complex<double> data
21+
* @param in: (nplane,ny,nx), std::complex<double> data
22+
* @param out: (nz, ns), std::complex<double> data
2323
*/
2424
template <typename FPTYPE>
2525
void PW_Basis::real2recip(const std::complex<FPTYPE>* in,
@@ -73,7 +73,7 @@ void PW_Basis::real2recip(const std::complex<FPTYPE>* in,
7373
* @details c(g)=\int dr*f(r)*exp(-ig*r)
7474
* Here we calculate c(g)
7575
* @param in: (nplane,ny,nx), double data
76-
* @param out: (nz, ns), complex<double> data
76+
* @param out: (nz, ns), std::complex<double> data
7777
*/
7878
template <typename FPTYPE>
7979
void PW_Basis::real2recip(const FPTYPE* in, std::complex<FPTYPE>* out, const bool add, const FPTYPE factor) const
@@ -139,8 +139,8 @@ void PW_Basis::real2recip(const FPTYPE* in, std::complex<FPTYPE>* out, const boo
139139
* @brief transform reciprocal space to real space
140140
* @details f(r)=1/V * \sum_{g} c(g)*exp(ig*r)
141141
* Here we calculate f(r)
142-
* @param in: (nz,ns), complex<double>
143-
* @param out: (nplane, ny, nx), complex<double>
142+
* @param in: (nz,ns), std::complex<double>
143+
* @param out: (nplane, ny, nx), std::complex<double>
144144
*/
145145
template <typename FPTYPE>
146146
void PW_Basis::recip2real(const std::complex<FPTYPE>* in,
@@ -198,7 +198,7 @@ void PW_Basis::recip2real(const std::complex<FPTYPE>* in,
198198
* @brief transform reciprocal space to real space
199199
* @details f(r)=1/V * \sum_{g} c(g)*exp(ig*r)
200200
* Here we calculate f(r)
201-
* @param in: (nz,ns), complex<double>
201+
* @param in: (nz,ns), std::complex<double>
202202
* @param out: (nplane, ny, nx), double
203203
*/
204204
template <typename FPTYPE>

source/source_basis/module_pw/pw_transform_k.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ namespace ModulePW
1919
* c(k,g)=\int dr*f'(k,r)*exp(-ig*r)
2020
*
2121
* This function tranform f'(r) to c(k,g).
22-
* @param in: (nplane,ny,nx), complex<double> data
23-
* @param out: (nz, ns), complex<double> data
22+
* @param in: (nplane,ny,nx), std::complex<double> data
23+
* @param out: (nz, ns), std::complex<double> data
2424
*/
2525
template <typename FPTYPE>
2626
void PW_Basis_K::real2recip(const std::complex<FPTYPE>* in,
@@ -85,7 +85,7 @@ void PW_Basis_K::real2recip(const std::complex<FPTYPE>* in,
8585
*
8686
* This function tranform f'(r) to c(k,g).
8787
* @param in: (nplane,ny,nx), double data
88-
* @param out: (nz, ns), complex<double> data
88+
* @param out: (nz, ns), std::complex<double> data
8989
*/
9090
template <typename FPTYPE>
9191
void PW_Basis_K::real2recip(const FPTYPE* in,
@@ -158,8 +158,8 @@ void PW_Basis_K::real2recip(const FPTYPE* in,
158158
* c(k,g)=\int dr*f'(k,r)*exp(-ig*r)
159159
*
160160
* This function tranform c(k,g) to f'(r).
161-
* @param in: (nz,ns), complex<double>
162-
* @param out: (nplane, ny, nx), complex<double>
161+
* @param in: (nz,ns), std::complex<double>
162+
* @param out: (nplane, ny, nx), std::complex<double>
163163
*/
164164
template <typename FPTYPE>
165165
void PW_Basis_K::recip2real(const std::complex<FPTYPE>* in,
@@ -221,7 +221,7 @@ void PW_Basis_K::recip2real(const std::complex<FPTYPE>* in,
221221
* c(k,g)=\int dr*f'(k,r)*exp(-ig*r)
222222
*
223223
* This function tranform c(k,g) to f'(r).
224-
* @param in: (nz,ns), complex<double>
224+
* @param in: (nz,ns), std::complex<double>
225225
* @param out: (nplane, ny, nx), double
226226
*/
227227
template <typename FPTYPE>

source/source_basis/module_pw/pw_transform_k_dsp.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ void PW_Basis_K::real2recip_dsp(const std::complex<double>* in,
4040

4141
const int startig = ik * this->npwk_max;
4242
const int npw_k = this->npwk[ik];
43-
// copy the in into the auxr with complex<double>
43+
// copy the in into the auxr with std::complex<double>
4444
memcpy(auxr, in, this->nrxx * 2 * 8);
4545

4646
// 3d fft

source/source_basis/module_pw/test/test-other.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ TEST_F(PWTEST,test_other)
4747
pwktest.setuptransform();
4848
pwktest.collect_local_pw();
4949
const int nrxx = pwktest.nrxx;
50-
complex<double> * rhor1 = new complex<double> [nrxx];
51-
complex<double> * rhor2 = new complex<double> [nrxx];
50+
std::complex<double> * rhor1 = new std::complex<double> [nrxx];
51+
std::complex<double> * rhor2 = new std::complex<double> [nrxx];
5252
#ifdef __ENABLE_FLOAT_FFTW
5353
complex<float> * rhofr1 = new complex<float> [nrxx];
5454
complex<float> * rhofr2 = new complex<float> [nrxx];
@@ -57,8 +57,8 @@ TEST_F(PWTEST,test_other)
5757
for(int ik = 0; ik < nks; ++ik)
5858
{
5959
const int npwk = pwktest.npwk[ik];
60-
complex<double> * rhog1 = new complex<double> [npwk];
61-
complex<double> * rhog2 = new complex<double> [npwk];
60+
std::complex<double> * rhog1 = new std::complex<double> [npwk];
61+
std::complex<double> * rhog2 = new std::complex<double> [npwk];
6262
#ifdef __ENABLE_FLOAT_FFTW
6363
complex<float> * rhofg1 = new complex<float> [npwk];
6464
complex<float> * rhofg2 = new complex<float> [npwk];

source/source_basis/module_pw/test/test1-2-2.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ TEST_F(PWTEST,test1_2_2)
5454
GT = latvec.Inverse();
5555
G = GT.Transpose();
5656
GGT = G * GT;
57-
complex<double> *tmp = new complex<double> [nx*ny*nz];
57+
std::complex<double> *tmp = new std::complex<double> [nx*ny*nz];
5858
if(rank_in_pool == 0)
5959
{
6060
for(int ix = 0 ; ix < nx ; ++ix)
@@ -91,7 +91,7 @@ TEST_F(PWTEST,test1_2_2)
9191
int iy = ixy % ny;
9292
ModuleBase::Vector3<double> real_r(ix, iy, iz);
9393
double phase_im = -delta_g * real_r;
94-
complex<double> phase(0,ModuleBase::TWO_PI * phase_im);
94+
std::complex<double> phase(0,ModuleBase::TWO_PI * phase_im);
9595
tmp[ixy * nz + iz] *= exp(phase);
9696
}
9797
}
@@ -100,9 +100,9 @@ TEST_F(PWTEST,test1_2_2)
100100
MPI_Bcast(tmp,2*nx*ny*nz,MPI_DOUBLE,0,POOL_WORLD);
101101
#endif
102102

103-
complex<double> * rhog = new complex<double> [npw];
104-
complex<double> * rhogr = new complex<double> [nmaxgr];
105-
complex<double> * rhogout = new complex<double> [npw];
103+
std::complex<double> * rhog = new std::complex<double> [npw];
104+
std::complex<double> * rhogr = new std::complex<double> [nmaxgr];
105+
std::complex<double> * rhogout = new std::complex<double> [npw];
106106
for(int ig = 0 ; ig < npw ; ++ig)
107107
{
108108
rhog[ig] = 1.0/(pwtest.gg[ig]+1);

0 commit comments

Comments
 (0)