32.81 KB, 下载次数: 0
右手侧b
5.81 KB, 下载次数: 0
x
169.98 KB, 下载次数: 0
矩阵A
145.51 KB, 下载次数: 0
矩阵A
! MKL库函数求解线性方程组
include 'lapack.f90'
program test
use lapack95
integer,parameter::n=3
integer i
real(4)::a(n,n),b(n)
integer ipiv(n)
a=reshape([1,0,1,2,1,0,3,3,0],[n,n])
b(:)=[14,11,1]
call sgetrf(n,n,a,n,ipiv,i) !LU分解
call sgetrs( 'N', n, n, a, n, ipiv, b,n, i )
print*,b !1,2,3
pause
end program
include 'lapack.f90'
Program kontrolle
use lapack95
Implicit None
Integer,parameter :: n=2400 , nrhs=1
Integer :: i
Integer,allocatable :: ipiv(:)
Real,allocatable :: A(:,:) , B(:,:)
Allocate( A(n,n) , B(n,nrhs) , ipiv(n) )
Open(12,File="Vm.txt")
Open(13,File="RHS.txt")
Read(12,*) A
Read(13,*) B
Close(12)
Close(13)
Call sgetrf(n,n,A,n,ipiv,i)
Call sgetrs('N',n,n,A,n,ipiv,B,n,i)
Print*,B
Pause
End Program kontrolle
! MKL库函数求解线性方程组
! 依赖 mkl_lapack95.lib
program test
use lapack95
integer,parameter::n=3
integer i
real(4)::a(n,n), b(n)
integer ipiv(n)
a=reshape([1,0,1,2,1,0,3,3,0],[n,n])
b(:)=[14,11,1]
call getrf(a,ipiv,i) !LU分解
call getrs(a,ipiv, b) !a,b均被覆盖
print*,b !1,2,3
pause
end program
QQ截图20190928123041.png (114.18 KB, 下载次数: 205)
li913 发表于 2019-9-28 16:32
给你的例子,你能得到正确结果不?我自己测试了一下,新版本ivf的结果不对。所以,你需要试试新的代码。[mw ...
欢迎光临 Fortran Coder (http://bbs.fcode.cn/) | Powered by Discuz! X3.2 |