使用gsl,Blas和Lapack计算{Aᵀ×A)*(Bᵀ×B)矩阵

时间:2018-09-09 16:04:14

标签: matrix matrix-multiplication lapack blas gsl

让我有2个对称矩阵:

A = {{1,2}, {2,3}}
B = {{2,3},{3,4}}

我可以使用gsl,Blas和Lapack计算矩阵(A T ×A)*(B T ×B)吗?

我正在使用

gsl_blas_dsyrk(CblasUpper, CblasTrans, 1.0, A, 0.0, ATA);
gsl_blas_dsyrk(CblasUpper, CblasTrans, 1.0, B, 0.0, BTB);
gsl_blas_dsymm(CblasLeft, CblasUpper, 1.0, ATA, BTB, 0.0, ATABTB); // It doesn't work

它返回:

(Aᵀ·A) = ATA = {{5, 8}, {0, 13}} -- ok, gsl_blas_dsyrk returns symmetric matrix as upper triangular matrix.
(Bᵀ·B) = BTB = {{13, 8}, {0, 25}} -- ok.
(Aᵀ·A)·(Bᵀ·B) = ATABTB = {{65, 290}, {104, 469}} -- it's wrong.

0 个答案:

没有答案