Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Calling subroutines

Status
Not open for further replies.

notnek

Technical User
Apr 25, 2011
3
GB
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(n), intent(in) :: rk
real(dp), dimension(n), intent(out) :: zk

real(dp), dimension(n) :: 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(n)
sum1=0
do m=1,n-1
sum1=sum1+A(j,m)*zkh(m)
end do

zk(n)=(1/A(n,n))*(rk(n)-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(n))
allocate(zk(n))
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.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top