std::complex in cuda_la.cc and noncblas.cc

This commit is contained in:
Jiri Pittner 2023-04-28 15:49:18 +02:00
parent 984c37721a
commit 5f1dd5f6e8
2 changed files with 7 additions and 7 deletions

View File

@ -48,15 +48,15 @@ double *gpuputdouble(const double &x){
return (double *)ptr; return (double *)ptr;
} }
complex<double> *gpuputcomplex(const complex<double> &x){ std::complex<double> *gpuputcomplex(const std::complex<double> &x){
void *ptr = NULL; void *ptr = NULL;
cublasAlloc(1, sizeof(complex<double>), &ptr); cublasAlloc(1, sizeof(std::complex<double>), &ptr);
TEST_CUBLAS("cublasAlloc"); TEST_CUBLAS("cublasAlloc");
cublasSetVector(1, sizeof(complex<double>), &x, 1, ptr, 1); cublasSetVector(1, sizeof(std::complex<double>), &x, 1, ptr, 1);
TEST_CUBLAS("cublasSetVector"); TEST_CUBLAS("cublasSetVector");
return (complex<double> *)ptr; return (std::complex<double> *)ptr;
} }

View File

@ -255,8 +255,8 @@ void cblas_zgerc(const CBLAS_ORDER Order, const int M, const int N,
{ {
if(Order!=CblasRowMajor) laerror("CblasRowMajor order asserted"); if(Order!=CblasRowMajor) laerror("CblasRowMajor order asserted");
//conjugate y //conjugate y
complex<double> *p; std::complex<double> *p;
p= (complex<double> *) Y; for(int i=0; i<N; ++i) {p->imag() = -p->imag(); p+= incY;} p= (std::complex<double> *) Y; for(int i=0; i<N; ++i) {p->imag(-p->imag()); p+= incY;}
#ifdef FORINT #ifdef FORINT
const FINT mtmp=M; const FINT mtmp=M;
const FINT ntmp=N; const FINT ntmp=N;
@ -268,7 +268,7 @@ p= (complex<double> *) Y; for(int i=0; i<N; ++i) {p->imag() = -p->imag(); p+= in
FORNAME(zgerc)(&N, &M, alpha, Y, &incY, X, &incX, A, &lda); FORNAME(zgerc)(&N, &M, alpha, Y, &incY, X, &incX, A, &lda);
#endif #endif
//conjugate y back //conjugate y back
p= (complex<double> *) Y; for(int i=0; i<N; ++i) {p->imag() = -p->imag(); p+= incY;} p= (std::complex<double> *) Y; for(int i=0; i<N; ++i) {p->imag(--p->imag()); p+= incY;}
} }