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