Program f04mcfe
! F04MCF Example Program Text
! Mark 27.0 Release. NAG Copyright 2019.
! .. 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