fixed C-fortran index shift in cblas_idamax etc.

This commit is contained in:
2025-01-22 15:57:30 +01:00
parent 4cf7dbb8c7
commit 9bb4fc883b
5 changed files with 44 additions and 31 deletions

12
vec.h
View File

@@ -1874,10 +1874,10 @@ inline const double NRVec<double>::amax() const {
#ifdef CUDALA
if(location == cpu){
#endif
ret = v[cblas_idamax(nn, v, 1) - 1];
ret = v[cblas_idamax(nn, v, 1)];
#ifdef CUDALA
}else{
const int pozice = cublasIdamax(nn, v, 1) - 1;
const int pozice = cublasIdamax(nn, v, 1) ;
TEST_CUBLAS("cublasIdamax");
gpuget(1, sizeof(double), v + pozice, &ret);
@@ -1906,7 +1906,7 @@ inline const double NRVec<double>::amin() const {
ret = v[index];
#ifdef CUDALA
}else{
const int pozice = cublasIdamin(nn, v, 1) - 1;
const int pozice = cublasIdamin(nn, v, 1);
TEST_CUBLAS("cublasIdamin");
gpuget(1, sizeof(double), v + pozice, &ret);
}
@@ -1925,10 +1925,10 @@ inline const std::complex<double> NRVec<std::complex<double> >::amax() const {
#ifdef CUDALA
if(location == cpu){
#endif
ret = v[cblas_izamax(nn, v, 1) - 1];
ret = v[cblas_izamax(nn, v, 1) ];
#ifdef CUDALA
}else{
const int pozice = cublasIzamax(nn, (cuDoubleComplex*)v, 1) - 1;
const int pozice = cublasIzamax(nn, (cuDoubleComplex*)v, 1);
TEST_CUBLAS("cublasIzamax");
gpuget(1, sizeof(std::complex<double>), v + pozice, &ret);
}
@@ -1960,7 +1960,7 @@ inline const std::complex<double> NRVec<std::complex<double> >::amin() const {
ret = v[index];
#ifdef CUDALA
}else{
const int pozice = cublasIzamin(nn, (cuDoubleComplex*)v, 1) - 1;
const int pozice = cublasIzamin(nn, (cuDoubleComplex*)v, 1);
TEST_CUBLAS("cublasIzamin");
gpuget(1, sizeof(std::complex<double>), v + pozice, &ret);
}