PROGRAM e04nffe ! E04NFF Example Program Text ! Mark 23 Release. NAG Copyright 2011. ! .. Use Statements .. USE nag_library, ONLY : e04nff, e04nfu, 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, ldh, liwork, & lwork, n, nclin, sda ! .. Local Arrays .. REAL (KIND=nag_wp), ALLOCATABLE :: a(:,:), ax(:), bl(:), bu(:), & clamda(:), cvec(:), h(:,:), work(:), & x(:) INTEGER, ALLOCATABLE :: istate(:), iwork(:) ! .. Intrinsic Functions .. INTRINSIC max ! .. Executable Statements .. WRITE (nout,*) 'E04NFF Example Program Results' FLUSH (nout) ! Skip heading in data file READ (nin,*) READ (nin,*) n, nclin liwork = 2*n + 3 lda = max(1,nclin) IF (nclin>0) THEN sda = n ELSE sda = 1 END IF ! This particular example problem is of type QP2 with H stored explicitly, ! so we allocate CVEC(N) and H(LDH,N), and define LDH and LWORK as below ldh = n IF (nclin>0) THEN lwork = 2*n**2 + 8*n + 5*nclin ELSE lwork = n**2 + 8*n END IF ALLOCATE (istate(n+nclin),ax(max(1,nclin)),iwork(liwork),h(ldh,n),bl(n+ & nclin),bu(n+nclin),cvec(n),x(n),a(lda,sda),clamda(n+nclin), & work(lwork)) READ (nin,*) cvec(1:n) READ (nin,*) (a(i,1:sda),i=1,nclin) READ (nin,*) bl(1:(n+nclin)) READ (nin,*) bu(1:(n+nclin)) READ (nin,*) x(1:n) READ (nin,*) (h(i,1:n),i=1,n) ! Solve the problem ifail = 0 CALL e04nff(n,nclin,a,lda,bl,bu,cvec,h,ldh,e04nfu,istate,x,iter,obj,ax, & clamda,iwork,liwork,work,lwork,ifail) END PROGRAM e04nffe