PROGRAM f04mcfe ! F04MCF Example Program Text ! Mark 23 Release. NAG Copyright 2011. ! .. Use Statements .. USE nag_library, ONLY : f01mcf, f04mcf, nag_wp ! .. Implicit None Statement .. IMPLICIT NONE ! .. Parameters .. INTEGER, PARAMETER :: nin = 5, nout = 6 ! .. Local Scalars .. INTEGER :: i, ifail, ir, iselct, k1, k2, lal, & ldb, ldx, n ! .. Local Arrays .. REAL (KIND=nag_wp), ALLOCATABLE :: a(:), al(:), b(:,:), d(:), x(:,:) INTEGER, ALLOCATABLE :: nrow(:) ! .. Executable Statements .. WRITE (nout,*) 'F04MCF Example Program Results' WRITE (nout,*) ! Skip heading in data file READ (nin,*) READ (nin,*) n, ir ldb = n ldx = n ALLOCATE (b(ldb,ir),d(n),x(ldx,ir),nrow(n)) READ (nin,*) nrow(1:n) lal = 0 DO i = 1, n lal = lal + nrow(i) END DO ALLOCATE (a(lal),al(lal)) k2 = 0 DO i = 1, n k1 = k2 + 1 k2 = k2 + nrow(i) READ (nin,*) a(k1:k2) END DO READ (nin,*) (b(i,1:ir),i=1,n) ! ifail: behaviour on error exit ! =0 for hard exit, =1 for quiet-soft, =-1 for noisy-soft ifail = 0 CALL f01mcf(n,a,lal,nrow,al,d,ifail) iselct = 1 ifail = 0 CALL f04mcf(n,al,lal,d,nrow,ir,b,ldb,iselct,x,ldx,ifail) WRITE (nout,*) ' Solution' DO i = 1, n WRITE (nout,99999) x(i,1:ir) END DO 99999 FORMAT (1X,8F9.3) END PROGRAM f04mcfe