Advertisement

11.30.2008 at 08:24AM PST, ID: 23945031 | Points: 500
[x]
Attachment Details

cblas_dgemm() calculating wrong product. Why?

Tags:

Intel MKL C++, version 10, N/A

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.

Top Expert: Infinity08
Expert Since: 07/08/2003
Accepted Solutions: 3115
Computer Expertise: Advanced
Infinity08 has been an Expert for 5 years 6 months, during which he has posted 17591 comments and answered 3115 questions. Infinity08 is just one of 579 experts in the C Programming Language Zone.
 
 
 
 
20081119-EE-VQP-48 - Hierarchy / EE_QW_2_20070628