Hello, I don't have much experience with Fortran and I've never had this problem before:
module cg
use numeric_kinds
implicit none
contains
subroutine symgs(A,rk,n,zk)
integer, intent(in) :: n
real(dp), dimension(n,n), intent(in) :: A
real(dp), dimension, intent(in) :: rk
real(dp), dimension, intent(out) :: zk
real(dp), dimension :: zkh
real(dp) :: sum1,sum2
integer :: j,m
! Define zkh(1)
zkh(1)=(1/A(1,1))*(rk(1))
do j=2,n
sum1=0
do m=1,(j-1)
sum1=sum1+A(j,m)*zkh(m)
end do
zkh(j)=(1/(A(j,j)))*(rk(j)-sum1)
end do
! Define zk
sum1=0
do m=1,n-1
sum1=sum1+A(j,m)*zkh(m)
end do
zk=(1/A(n,n))*(rk-sum1)
do j=n-1,1,-1
sum1=0
do m=1,j-1
sum1=sum1+A(j,m)*zkh(m)
end do
sum2=0
do m=j+1,n
sum2=sum2+A(j,m)+zk(m)
end do
zk(j)=(1/(A(j,j)))*(rk(j)-sum1-sum2)
end do
end subroutine symgs
end module cg
--------------------------------------------------
program gausstest
use numeric_kinds
use cg
implicit none
integer :: n,i
real(dp), dimension,,allocatable :: A
real(dp), dimension), allocatable :: rk
real(dp), dimension), allocatable :: zk
print*, 'Enter n:'
read*, n
allocate(rk)
allocate(zk)
allocate(A(n,n))
do i=1,n
print*, 'Enter row', i
read*, A(i,
end do
print*, 'Enter rk:'
read*, rk
call symgs(A,rk,n,zk)
end program gausstest
-----------------------------------------
Here I have two separate f95 files, a module 'cg' which contains the subroutine symgs and a program 'gausstest' which (should) call the subroutine. gausstest compiles fine but when I try to execute it I receive this error:
error 29, call to missing routine:_CG!SYMGS at 0x004015d5
The routine is not missing though...? Can someone help? Thanks in advance.
module cg
use numeric_kinds
implicit none
contains
subroutine symgs(A,rk,n,zk)
integer, intent(in) :: n
real(dp), dimension(n,n), intent(in) :: A
real(dp), dimension, intent(in) :: rk
real(dp), dimension, intent(out) :: zk
real(dp), dimension :: zkh
real(dp) :: sum1,sum2
integer :: j,m
! Define zkh(1)
zkh(1)=(1/A(1,1))*(rk(1))
do j=2,n
sum1=0
do m=1,(j-1)
sum1=sum1+A(j,m)*zkh(m)
end do
zkh(j)=(1/(A(j,j)))*(rk(j)-sum1)
end do
! Define zk
sum1=0
do m=1,n-1
sum1=sum1+A(j,m)*zkh(m)
end do
zk=(1/A(n,n))*(rk-sum1)
do j=n-1,1,-1
sum1=0
do m=1,j-1
sum1=sum1+A(j,m)*zkh(m)
end do
sum2=0
do m=j+1,n
sum2=sum2+A(j,m)+zk(m)
end do
zk(j)=(1/(A(j,j)))*(rk(j)-sum1-sum2)
end do
end subroutine symgs
end module cg
--------------------------------------------------
program gausstest
use numeric_kinds
use cg
implicit none
integer :: n,i
real(dp), dimension,,allocatable :: A
real(dp), dimension), allocatable :: rk
real(dp), dimension), allocatable :: zk
print*, 'Enter n:'
read*, n
allocate(rk)
allocate(zk)
allocate(A(n,n))
do i=1,n
print*, 'Enter row', i
read*, A(i,
end do
print*, 'Enter rk:'
read*, rk
call symgs(A,rk,n,zk)
end program gausstest
-----------------------------------------
Here I have two separate f95 files, a module 'cg' which contains the subroutine symgs and a program 'gausstest' which (should) call the subroutine. gausstest compiles fine but when I try to execute it I receive this error:
error 29, call to missing routine:_CG!SYMGS at 0x004015d5
The routine is not missing though...? Can someone help? Thanks in advance.