mkl cblas_dgemm错误参数

时间:2016-11-19 06:43:57

标签: c++ intel-mkl cblas

我尝试使用mkl cblas_dgemm来计算矩阵矩阵乘法。

据我所知,ldaldbldc应该是简单行主矩阵的列数。我试着做以下事情:

double a[3 * 2] = { 1,2,3,4,5,6 };      // 3 x 2 matrix
double b[2 * 4] = { 1,2,3,4,5,6,7,8 };  // 2 x 4 matrix
double c[3 * 4] = { 0, };               // 3 x 4 matrix

// c <- 1.0 * (a*b) + 0.0 * c
cblas_dgemm(CblasRowMajor, CblasNoTrans, CblasNoTrans, 3, 2, 4, 1.0, a, 2, b, 4, 0.0, c, 4);
//            rowmajor       no trans      no trans    m  k  n  alph A lda B ldb beta C ldc

但是它给了我一条错误消息,c没有更新。

Intel MKL ERROR: Parameter 9 was incorrect on entry to cblas_dgemm.

参数9为lda

我的代码出了什么问题?

1 个答案:

答案 0 :(得分:0)

我错了。参数排序为m,n,k,如上所述

相关问题