Program e02gcfe
! E02GCF Example Program Text
! Mark 27.3 Release. NAG Copyright 2021.
! .. Use Statements ..
Use nag_library, Only: e02gcf, nag_wp
! .. Implicit None Statement ..
Implicit None
! .. Parameters ..
Integer, Parameter :: n = 3, nin = 5, nout = 6
! .. Local Scalars ..
Real (Kind=nag_wp) :: relerr, resmax, t, tol
Integer :: i, ifail, irank, iter, lda, m, sda
! .. Local Arrays ..
Real (Kind=nag_wp), Allocatable :: a(:,:), b(:), x(:)
! .. Intrinsic Procedures ..
Intrinsic :: exp
! .. Executable Statements ..
Write (nout,*) 'E02GCF Example Program Results'
! Skip heading in data file
Read (nin,*)
Read (nin,*) m
lda = n + 3
sda = m + 1
Allocate (a(lda,sda),b(m),x(n))
Do i = 1, m
Read (nin,*) t, b(i)
a(1,i) = exp(t)
a(2,i) = exp(-t)
a(3,i) = 1.0E0_nag_wp
End Do
tol = 0.0E0_nag_wp
relerr = 0.0E0_nag_wp
ifail = -1
Call e02gcf(m,n,sda,lda,a,b,tol,relerr,x,resmax,irank,iter,ifail)
Select Case (ifail)
Case (0,1)
Write (nout,*)
Write (nout,99999) 'RESMAX = ', resmax, ' Rank = ', irank, &
' Iterations = ', iter, ' IFAIL =', ifail
Write (nout,*)
Write (nout,*) 'Solution'
Write (nout,99998) x(1:n)
End Select
99999 Format (1X,A,E10.2,3(A,I5))
99998 Format (1X,6F10.4)
End Program e02gcfe