Question

What is the difference between cblas_dcopy vs dcopy? I am mostly using the dcopy because it is presented in the official manual from Intel to copy my matrices.

double* a = (double*)mkl_malloc(4 * 4 * sizeof(double), 64);
double* b = (double*)mkl_malloc(4 * 4 * sizeof(double), 64);
... calculations/operations ...
int one = 1;
int sxtn = 16;

dcopy(&sxtn, a, &one, b, &one);

Is this wrong? I have come across another way recently in the online guide form of:

cblas_dcopy(16, a, 1, b, 1);

What's the difference and which one should I use if I am using C++?

Was it helpful?

Solution

dcopy() is a function prototype for Fortran, while cblas_dcopy() is for C as indicated in MLK ref manual.

Due to the similarity of Fortran and C, you can call Fortran functions in C code by providing each parameter's pointer, just like what you did.

Of couse using C interface is better for C++.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top