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

vector-matrix product

anacondgame
Beginner
353 Views
Hi,

I have need to implement the vector-matrix product (not matrix-vector product).
which function can I use?

I have tried with dgemv (with the parameter trans = 112) but it doesn't work.
I have the following matrix and vectors:

  x	= -1.2  -0.8  1.0

0 0.4 0.6
 M 	=  -0.4	 0    0.4
 	   -0.6	 0    0.6

I wont compute x*M as M'*x' .
M'*v' = -0.28 -0.48 -0.44
This is the code example:
double alpha = 1.0;
double beta = 0.0;
int incx = 1;
int incy = 1;
CBLAS_ORDER order = CblasRowMajor;
CBLAS_TRANSPOSE trans = CblasTrans;
int r = 3;
int c = 3;
int lda = 3;

cblas_dgemv(order,trans,r,c,alpha,M,lda,x,incx,beta,y,incy);
But the result "y" is incorrect !!?
The result y is following:
y = (-2656984258037080400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.0, 94150893907688424300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.0, 0.0)
Help me!
0 Kudos
1 Reply
Intel_C_Intel
Employee
353 Views

I don't see anything about y in your code. Remember that dgemv does the following operation:

y = alpha*A*x + beta*y.

y must be a vector. To get the values you seek, y must by zeroed.

I tried this out using sgemv (not the cblas version) and got the answers you think you should get.

If you still have problems, I will look at this anew.

Bruce

0 Kudos
Reply