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

problem about cblas_sgemv

shuchang_wang
Beginner
446 Views
Hi, I am a beginner to MKL.
I made a test about the library.
My IDE is VC++.net, and MKL is 8.0.1
Here is my test code:
float A[ ] ={1,21,3,4,5,6};
float B[ ] ={2,-1,1,3,4};
float Y[5]={0};
cblas_sgemv(CblasColMajor,CblasNoTrans,2,3,1.0f,A,1,B,1,0.0f,Y,1);
But the result is unexperted, I don't know why.
0 Kudos
1 Reply
ttppo
Beginner
446 Views
cblas_sgemv(CblasColMajor,CblasNoTrans,2,3,1.0f,A,??1??,B,1,0.0f,Y,1);

cblas_sgemv() is defined as,
void cblas_sgemv(const CBLAS_ORDER order,
const CBLAS_TRANSPOSE TransA, const int M, const int N,
const float alpha, const float *A, const int lda,
const float *X, const int incX, const float beta,
float *Y, const int incY);


The value of lda must be at least max(1, m)!

what is your lda? lda=1?

try it:

int m=2,n=3,lda=2,inc=1;
float f0=1.0,f1=0.0;

cblas_sgemv(CblasColMajor,CblasNoTrans, m,n,f0,A,lda,B,inc,f1,Y,inc);
0 Kudos
Reply