珊瑚虫 发表于 2014-7-22 21:51
检查一下函数名称是不是写错了,此外,相应的库有没有配置好
珊瑚虫 发表于 2014-7-22 22:41
请参考
http://fcode.cn/guide-58-1.html
vvt 发表于 2014-7-23 06:40
代码发出来看看吧。应该是没有 use 模块。
编译错误,要么是没有 use,要么是没有设置好 include。
Subroutine Test_sdot!矢量点乘
implicit none
real x(10), y(10), sdot, res
integer n, incx, incy, i
external dot
n = 5
incx = 2
incy = 1
do i = 1, 10
x(i) = 1
y(i) = 1
end do
res = sdot (n, x, incx, y, incy)
print*,"SDOT=",res
res=dot(x,y)
write(*,*) res
End subroutine
捕获.PNG (80.14 KB, 下载次数: 679)
Program www_fcode_cn
call Test_sdot()
End Program www_fcode_cn
Subroutine Test_sdot!矢量点乘
use BLAS95 !// 必须 use 某个module
implicit none
real x(10), y(10), res !// sdot 和 dot 无需声明
integer n, incx, incy, i
!external dot // 同上
n = 5
incx = 2
incy = 1
do i = 1, 10
x(i) = 1
y(i) = 1
end do
res = dot ( x, y ) !// F95 的接口很简单,两个参数既可
print*,"SDOT=",res
res=dot(x,y)
write(*,*) res
End subroutine
vvt 发表于 2014-7-23 06:59
[mw_shl_code=fortran,true]Program www_fcode_cn
call Test_sdot()
End Program www_fcode_cn
Include Files
Fortran: mkl.fi
Fortran 95: blas.f90
C: mkl.h
vvt 发表于 2014-7-23 07:33
1.那篇帖子是针对各种函数库进行的,是说的使用所有函数库的“通则”,不可能说得很详细。
2.帮助里提到:
...
Include Files
• Fortran: mkl.fi
• Fortran 95: lapack.f90
• C: mkl.h
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)
vvt 发表于 2014-7-23 10:20
两个问题:
1.如果你既使用了 mkl_blas95.lib,又使用了 mkl_lapack95.lib,请在项目—属性—Linker-Input- ...
欢迎光临 Fortran Coder (http://bbs.fcode.cn/) | Powered by Discuz! X3.2 |