Test TDMA to verify operation
Nodes of different colours represent the following:
Solid arrows point from a procedure to one which it calls. Dashed arrows point from an interface to procedures which implement that interface. This could include the module procedures in a generic interface or the implementation in a submodule of an interface in a parent module.
Nodes of different colours represent the following:
Solid arrows point from a procedure to one which it calls. Dashed arrows point from an interface to procedures which implement that interface. This could include the module procedures in a generic interface or the implementation in a submodule of an interface in a parent module.
subroutine testTDMA
!! Test TDMA to verify operation
real(wp),dimension(:,:),allocatable::A
real(wp),dimension(:),allocatable::b,x,xt
integer::N,k
N = 10
allocate( A(N,-1:+1) , x(N) , b(N) )
xt = linspace(0.0_wp,1.0_wp,N)
A(1,-1:+1) = [0.0_wp,1.0_wp,0.0_wp]
b( 1 ) = 0.0_wp
do k=2,N-1
A(k,-1) = 1.0_wp
A(k, 0) = -2.0_wp
A(k,+1) = 1.0_wp
b( k ) = 0.0_wp
end do
A(N,-1:+1) = [0.0_wp,1.0_wp,0.0_wp]
b( N ) = 1.0_wp
x = TDMA(A,b)
do k=1,N
write(*,*) xt(k),x(k)
end do
write(*,*) norm2(xt-x)
end subroutine testTDMA