Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Fiori
Beginner
54 Views

Better way to compute phi0 + sigma*vector?

Jump to solution

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
54 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

2 Replies
Andrey_N_Intel
Employee
55 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

Fiori
Beginner
54 Views

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

Reply