Intel® oneAPI Math Kernel Library
Ask questions and share information with other developers who use Intel® Math Kernel Library.

Better way to compute phi0 + sigma*vector?

Fiori
Beginner
877 Views

Hello!

I want to compute this quantity prob = phi0 + sigma*atilde, where phi0 and sigma are scalars and atilde a vector 1xind. I have computed it like this:

for(i=0;i<ind;i++){ones = 1.0;}

 cblas_dcopy(ind, ones, 1, B, 1);
 cblas_dscal(ind, phi0, B, 1);
 cblas_dcopy(ind, atilde, 1, Bcan, 1);
 cblas_dscal(ind, sqrt(sigma2), Bcan, 1);
 vdAdd(ind, B, Bcan, prob);
     

I would like to ask if there is a better way to do it.

Thank you very much.

0 Kudos
1 Solution
Andrey_N_Intel
Employee
877 Views

Hi,

you might want to have a look at Intel MKL VM v?LinearFrac() function with shifta=phi, scalea=sigma, a=atilde, scaleb=0, b declared, and shiftb=1.The additional details on the function and respective examples are available https://software.intel.com/en-us/node/521774

Andrey

View solution in original post

0 Kudos
2 Replies
Andrey_N_Intel
Employee
878 Views

Hi,

you might want to have a look at Intel MKL VM v?LinearFrac() function with shifta=phi, scalea=sigma, a=atilde, scaleb=0, b declared, and shiftb=1.The additional details on the function and respective examples are available https://software.intel.com/en-us/node/521774

Andrey

0 Kudos
Fiori
Beginner
877 Views

You are the best!!! Thanks a lot!!!

0 Kudos
Reply