主题:BICGSTAB测试问题
帮忙测试下下面我写的bicgstab子程序吧,为什么我自己测试的线性方程组老是求解出错
哪位达人能提供下可以用的权威测试例子?
我自己测试的结果是
第1次迭代后的残差为: 0.2677087229D+02
第2次迭代后的残差为: 0.2234323081D+02
第3次迭代后的残差为: 0.1579755198D+02
第4次迭代后的残差为: 0.1342154479D+02
第5次迭代后的残差为: 0.1605011227D+02
第6次迭代后的残差为: 0.2511729052D-03
第7次迭代后的残差为: 0.5275236190D-06
第8次迭代后的残差为: 0.1909758431D-08
one of the scalar quantities calculated during BICGSTAB became too small!
BICGSTAB is failed!
Press any key to continue
!main.f90
program SOR_BICGSTAB_CSR_test
implicit none
integer, parameter :: N=8,NNZ=28,ITMAX = 100
complex(8) :: rhs(n),X(N),expected_sol(N)
real(8) :: reg_err(ITMAX)
integer :: jcol(N+1)
integer :: irw(NNZ)
complex(8) :: A(NNZ)
real(8) :: W,EPS
INTEGER :: IT
DATA jcol /1,5,8,12,14,18,22,26,29/
DATA irw /1, 3, 6, 7, &
2, 3, 5, &
1, 2, 3, 8, &
4, 7, &
2, 5, 6, 7, &
2, 5, 6, 8, &
1, 4, 5, 7, &
3, 6, 8/
DATA A /7.D0, 1.D0, 2.D0, 7.D0, &
-4.D0,8.D0, 2.D0, &
6.D0, 8.D0,1.D0, 3.D0, &
7.D0, 9.D0, &
2.D0, 5.D0, 1.D0, 3.D0, &
2.D0, 1.D0,-1.D0, 5.D0, &
7.D0, 9.D0,5.D0, 11.D0, &
2.D0, 5.D0, 5.D0/
X=(1.0D0,0.0D0)
call MatMulVec_US_CSR(N,NNZ,A,X,rhs,irw,jcol)
X = (0.0D0,0.0D0)
EPS = 1.0D-10
W = 1
call SOR_BICGSTAB_CSR(N,NNZ,A,rhs,X,irw,jcol,EPS,ITMAX,W,IT,reg_err)
write(*,*) X,IT,REG_ERR(IT)
stop
end program
!bicgstab子程序在代码包里面,包括bicgstab的理论公式,采用按行非零压缩存储格式(CSR)