按照你说的,在加载其他文件的时候我还是遇到一些问题。
比如我想利用fortran95接口求矩阵的逆阵:
首先需要将矩阵LU分解,分解函数为getrf(fortran95接口,Page420),求逆阵函数getri,两个函数版主文件相同。帮助里提到:
Include Files
• Fortran: mkl.fi
• Fortran 95: lapack.f90
• C: mkl.h
我在项目—属性—Linker-Input-Additional Dependencies 输入 mkl_lapack95.lib
完整代码如下:
[Fortran] 纯文本查看 复制代码 Program Main
call Test_getrf
call Test_dot
End program
Subroutine Test_dot!矢量点乘
use BlAS95
implicit none
real x(10), y(10),res
integer::i
do i = 1, 10
x(i) = 1
y(i) = 1
end do
res=5
res=dot(x,y)
write(*,*) res
End subroutine
Subroutine Test_getrf!矩阵分解成LU,并求逆阵
use LAPACK95
implicit none
real(kind=4)::a(3,3)=(/1,1,3,2,1,-1,-1,2,1/)
integer::ipiv=3,info=0,work(1)=3
write(*,*) a(1,:)
write(*,*) a(2,:)
write(*,*) a(3,:)
call getrf(a,ipiv,info)!矩阵分解成LU
call getri(a,ipiv,info)!求逆阵
write(*,*) info
write(*,*) a(1,:)
write(*,*) a(2,:)
write(*,*) a(3,:)
End subroutine
编译之后错误如下:
错误 3 error #5508: Declaration of routine 'TEST_DOT' conflicts with a previous declaration
错误 1 error #6285: There is no matching specific subroutine for this generic subroutine call. [GETRF]
错误 2 error #6285: There is no matching specific subroutine for this generic subroutine call. [GETRI]
错误 4 Compilation Aborted (code 1)
本来能运行的dot函数也不能运行了。
怎么办啊。。。 |