```    Program e04nffe

!     E04NFF Example Program Text

!     Mark 26 Release. NAG Copyright 2016.

!     .. 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 Procedures ..
Intrinsic                        :: max
!     .. Executable Statements ..
Write (nout,*) 'E04NFF Example Program Results'
Flush (nout)

!     Skip heading in data file

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))