'Efficient matrix times column vector for each column

I have a matrix

1 2 3
1 2 3
1 2 3

that I need to multiply with a column vector

[2
 3
 4]

to get

2 4 6
3 6 9
4 8 12

Now, I can make the vector into a matrix and do an element-wise multiplication, but is there also an efficient way to do this in MKL / CBLAS?



Solution 1:[1]

Could you please check the information provided below if it helps depending on your requirement.

For vector-vector operations, please refer the below link.

https://www.intel.com/content/www/us/en/develop/documentation/onemkl-developer-reference-c/top/blas-and-sparse-blas-routines/blas-routines/blas-level-1-routines-and-functions.html#blas-level-1-routines-and-functions

For matrix-vector operations, please refer the below link.

https://www.intel.com/content/www/us/en/develop/documentation/onemkl-developer-reference-c/top/blas-and-sparse-blas-routines/blas-routines/blas-level-2-routines.html#blas-level-2-routines l For matrix-matrixoperations, please refer the below link.

https://www.intel.com/content/www/us/en/develop/documentation/onemkl-developer-reference-c/top/blas-and-sparse-blas-routines/blas-routines/blas-level-3-routines.html#blas-level-3-routines

The question mark in the group name corresponds to different character codes indicating the data type (s, d, c, and z or their combination)

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Shanmukh-Intel