[Fortran] 纯文本查看 复制代码
program main
implicit none
integer :: n, m, k, lda, ldb, ldc, info
real(kind=8), dimension(:,:), allocatable :: A, B, C
real(kind=8) :: alpha, beta
external dgemm
! 设置矩阵的大小
m = 3
n = 3
k = 3
! 设置矩阵 A、B、C 的值
allocate(A(m,k))
allocate(B(k,n))
allocate(C(m,n))
A = reshape([1., 2., 3., 4., 5., 6., 7., 8., 9.], [m, k])
B = reshape([1., 2., 3., 4., 5., 6., 7., 8., 9.], [k, n])
C = 0.0
! 设置矩阵乘法的参数
alpha = 1.0
beta = 0.0
lda = m
ldb = k
ldc = m
! 调用 BLAS 库的 DGEMM 子程序进行矩阵乘法
call dgemm('N', 'N', m, n, k, alpha, A, lda, B, ldb, beta, C, ldc)
! 输出结果
write(*, *) 'Result:'
write(*, *) C
end program main
问题:提示“