cblas_dgemm - 正确的参数:错误消息
我正在尝试使用 cblas_dgemm() 计算:C = 1*(A*B') + 0*C
。 据我所知,参数是正确的。 错误消息本身没有意义:
"ldb must be >= MAX(K,1): ldb=3 K=3Parameter 11 to routine cblas_dgemm was incorrect"
但是,ldb = k = 3!这是所有三个矩阵和参数的详细输出。
A: (m x n: 4x3), lda = 4
B': (n x k: 3x9), lda = 3
C: (m x k, 4x9), ldc = 4
A:
Dense matrix: 0xfe5cf0, nrows = 4, ncols = 3, ColumnMajor = 1
0.1246 0.5407 0.1822
0.1020 0.4639 0.3164
0.3058 0.9872 0.3348
0.8375 0.9343 0.5893
B:
Dense matrix: 0xfe5cd0, nrows = 9, ncols = 3, ColumnMajor = 1
0.4387 0.3447 0.2999
0.1582 0.6505 0.5076
0.1497 0.6515 0.7486
0.3936 0.1065 0.7850
0.7182 0.5477 0.0220
0.3291 0.0453 0.6630
0.4005 0.3075 0.1818
0.4071 0.0083 0.0840
0.1868 0.0998 0.3279
C:
Dense matrix: 0xfe7180, nrows = 4, ncols = 9, ColumnMajor = 1
0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000
0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000
0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000
0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000
Transpose A ta = 111 (CblasNoTrans)
Transpose B tb = 112 (CblasTrans)
m = 4, k = 3, n = 9
lda = 4, ldb = 3, ldc = 4
alpha = 1, beta = 0
CALLING CBLAS_DGEMM:
cblas_dgemm( CblasColMajor, ta, tb, m, n, k, alpha, A->d, lda, B->d, ldb, beta, C->d, ldc );
我确信我犯了一个愚蠢的错误,我只是无法发现它。任何帮助将不胜感激。
非常感谢,
拉斯
I am trying to compute: C = 1*(A*B') + 0*C
using cblas_dgemm().
As far as I can tell, the parameters are correct.
The error message itself does not make sense:
"ldb must be >= MAX(K,1): ldb=3 K=3Parameter 11 to routine cblas_dgemm was incorrect"
But, ldb = k = 3! Here is the detailed output of all three matrices and the parameters.
A: (m x n: 4x3), lda = 4
B': (n x k: 3x9), lda = 3
C: (m x k, 4x9), ldc = 4
A:
Dense matrix: 0xfe5cf0, nrows = 4, ncols = 3, ColumnMajor = 1
0.1246 0.5407 0.1822
0.1020 0.4639 0.3164
0.3058 0.9872 0.3348
0.8375 0.9343 0.5893
B:
Dense matrix: 0xfe5cd0, nrows = 9, ncols = 3, ColumnMajor = 1
0.4387 0.3447 0.2999
0.1582 0.6505 0.5076
0.1497 0.6515 0.7486
0.3936 0.1065 0.7850
0.7182 0.5477 0.0220
0.3291 0.0453 0.6630
0.4005 0.3075 0.1818
0.4071 0.0083 0.0840
0.1868 0.0998 0.3279
C:
Dense matrix: 0xfe7180, nrows = 4, ncols = 9, ColumnMajor = 1
0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000
0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000
0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000
0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000
Transpose A ta = 111 (CblasNoTrans)
Transpose B tb = 112 (CblasTrans)
m = 4, k = 3, n = 9
lda = 4, ldb = 3, ldc = 4
alpha = 1, beta = 0
CALLING CBLAS_DGEMM:
cblas_dgemm( CblasColMajor, ta, tb, m, n, k, alpha, A->d, lda, B->d, ldb, beta, C->d, ldc );
I am sure I am making a silly mistake, I just can't spot it. Any help will be appreciated.
many thanks,
Russ
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我对ldb的理解是错误的。 ldb 指的是行(B)而不是行(B')!
抱歉浪费了您的时间。不知怎的,只是发帖似乎有帮助。
My understanding of ldb was incorrect. ldb refers to the rows(B) and NOT rows(B')!
Sorry to have wasted your time. Somehow just posting seems to help.