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

cblas_dgemm() calculating wrong product. Why?

satakarni_byngmail_c
496 Views

The following is the usage of cblas_dgemm() in my program.

cblas_dgemm( CblasRowMajor, CblasNoTrans, CblasNoTrans, N , N , N , 1.0, AReal, N , S1, N , 2.0, R1, N );

following is the declarations:
alpha = beta = 1;

AReal = (double *)calloc( (N+1)*N, sizeof( double ) );
S1 = (double *)calloc( (N+1)*N, sizeof( double ) );
R1 = (double *)calloc( (N+1)*N, sizeof( double ) );

The output is :


*** AReal Matrix *****

1.000000 1.000000 1.000000
1.000000 1.000000 1.000000
1.000000 1.000000 1.000000

**** S1 Matrix *****

-1.000000 -1.000000 -1.000000
-1.000000 -1.000000 -1.000000
-1.000000 -1.000000 -1.000000


**** Result R1 matrix *****
-3.000000 -2.000000 -1.000000
-3.000000 -1.000000 -2.000000
-3.000000 -2.000000 -1.000000
Press any key to continue . . .

why the resultant matrix is wrong? let me know.

0 Kudos
2 Replies
Gennady_F_Intel
Moderator
496 Views

Hi,

But I ve received the following results:

**** Result R1 matrix *****

RI = -3.000000 RI = -3.000000 RI = -3.000000

RI = -3.000000 RI = -3.000000 RI = -3.000000

RI = -3.000000 RI = -3.000000 RI = -3.000000

Press any key to continue . . .

1. version 10.1, win32

2. linking libraries: mkl_intel_c.lib mkl_intel_thread.lib mkl_core.lib libiomp5md.lib

--Gennady

0 Kudos
Gennady_F_Intel
Moderator
496 Views

Hi Satak, I 've answered to this question throuhg your QuAD reguest.

Please pay attention how innithialize the input arrays. Please check the result and let me know.

--Gennady

0 Kudos
Reply