Program e04ncfe ! E04NCF Example Program Text ! Mark 24 Release. NAG Copyright 2012. ! .. Use Statements .. Use nag_library, Only: e04ncf, nag_wp ! .. Implicit None Statement .. Implicit None ! .. Parameters .. Integer, Parameter :: nin = 5, nout = 6 ! .. Local Scalars .. Real (Kind=nag_wp) :: obj Integer :: i, ifail, iter, lda, ldc, liwork, & lwork, m, n, nclin, sdc ! .. Local Arrays .. Real (Kind=nag_wp), Allocatable :: a(:,:), b(:), bl(:), bu(:), c(:,:), & clamda(:), cvec(:), work(:), x(:) Integer, Allocatable :: istate(:), iwork(:), kx(:) ! .. Intrinsic Procedures .. Intrinsic :: max ! .. Executable Statements .. Write (nout,*) 'E04NCF Example Program Results' Flush (nout) ! Skip heading in data file Read (nin,*) Read (nin,*) m, n, nclin liwork = n ldc = max(1,nclin) lda = max(1,m) If (nclin>0) Then sdc = n Else sdc = 1 End If ! This particular example problem is of type LS1, so we allocate ! A(LDA,N), CVEC(1), B(M) and define LWORK as below If (nclin>0) Then lwork = 2*n**2 + 9*n + 6*nclin Else lwork = 9*n End If Allocate (istate(n+nclin),kx(n),iwork(liwork),c(ldc,sdc),bl(n+nclin), & bu(n+nclin),cvec(1),x(n),a(lda,n),b(m),clamda(n+nclin),work(lwork)) Read (nin,*)(a(i,1:n),i=1,m) Read (nin,*) b(1:m) Read (nin,*)(c(i,1:sdc),i=1,nclin) Read (nin,*) bl(1:(n+nclin)) Read (nin,*) bu(1:(n+nclin)) Read (nin,*) x(1:n) ! Solve the problem ifail = 0 Call e04ncf(m,n,nclin,ldc,lda,c,bl,bu,cvec,istate,kx,x,a,b,iter,obj, & clamda,iwork,liwork,work,lwork,ifail) End Program e04ncfe