PROGRAM f04axfe ! F04AXF Example Program Text ! Mark 23 Release. NAG Copyright 2011. ! .. Use Statements .. USE nag_library, ONLY : f01brf, f04axf, nag_wp ! .. Implicit None Statement .. IMPLICIT NONE ! .. Parameters .. INTEGER, PARAMETER :: nin = 5, nout = 6 ! .. Local Scalars .. REAL (KIND=nag_wp) :: resid, u INTEGER :: i, ifail, licn, lirn, mtype, n, nz LOGICAL :: grow, lblock ! .. Local Arrays .. REAL (KIND=nag_wp), ALLOCATABLE :: a(:), rhs(:), w(:) INTEGER, ALLOCATABLE :: icn(:), ikeep(:,:), irn(:), iw(:,:) INTEGER :: idisp(10) LOGICAL :: abort(4) ! .. Executable Statements .. WRITE (nout,*) 'F04AXF Example Program Results' WRITE (nout,*) ! Skip heading in data file READ (nin,*) READ (nin,*) n, nz licn = 3*nz lirn = 3*nz/2 ALLOCATE (a(licn),rhs(n),w(n),icn(licn),ikeep(n,5),irn(lirn),iw(n,8)) READ (nin,*) (a(i),irn(i),icn(i),i=1,nz) u = 0.1E0_nag_wp lblock = .TRUE. grow = .TRUE. abort(1) = .TRUE. abort(2) = .TRUE. abort(3) = .FALSE. abort(4) = .TRUE. ! ifail: behaviour on error exit ! =0 for hard exit, =1 for quiet-soft, =-1 for noisy-soft ifail = 0 ! Decomposition of sparse matrix CALL f01brf(n,nz,a,licn,irn,lirn,icn,u,ikeep,iw,w,lblock,grow,abort, & idisp,ifail) IF (grow) THEN WRITE (nout,*) 'On exit from F01BRF' WRITE (nout,99999) 'Value of W(1) = ', w(1) END IF READ (nin,*) rhs(1:n) mtype = 1 ! Approximate solution of sparse linear equations CALL f04axf(n,a,licn,icn,ikeep,rhs,w,mtype,idisp,resid) WRITE (nout,*) WRITE (nout,*) 'On exit from F04AXF' WRITE (nout,*) ' Solution' WRITE (nout,99998) rhs(1:n) 99999 FORMAT (1X,A,F9.4) 99998 FORMAT (1X,F9.4) END PROGRAM f04axfe