    PROGRAM nag_qp_ex03

      ! Example Program Text for nag_qp
      ! NAG fl90, Release 4. NAG Copyright 2000.

      ! .. Use Statements ..
      USE nag_examples_io, ONLY : nag_std_in, nag_std_out
      USE nag_qp, ONLY : nag_qp_sol
      ! .. Implicit None Statement ..
      IMPLICIT NONE
      ! .. Intrinsic Functions ..
      INTRINSIC KIND
      ! .. Parameters ..
      INTEGER, PARAMETER :: wp = KIND(1.0D0)
      ! .. Local Scalars ..
      INTEGER :: i, m, n
      REAL (wp) :: obj_f
      ! .. Local Arrays ..
      REAL (wp), ALLOCATABLE :: a(:,:), ax_lower(:), ax_upper(:), c(:), &
       h(:,:), x(:), x_lower(:), x_upper(:)
      ! .. Executable Statements ..
      WRITE (nag_std_out,*) 'Example Program Results for nag_qp_ex03'

      READ (nag_std_in,*)          ! Skip heading in data file

      ! Read number of linear constraints (m) and variables (n)
      READ (nag_std_in,*) m, n

      ALLOCATE (a(m,n),ax_lower(m),ax_upper(m),c(n),h(n,n),x(n),x_lower(n), &
       x_upper(n))                 ! Allocate storage

      ! Read in problem data
      READ (nag_std_in,*) c
      READ (nag_std_in,*) (a(i,:),i=1,m)
      READ (nag_std_in,*) x_lower
      READ (nag_std_in,*) ax_lower
      READ (nag_std_in,*) x_upper
      READ (nag_std_in,*) ax_upper
      READ (nag_std_in,*) x
      READ (nag_std_in,*) (h(i,:),i=1,n)

      ! Solve the problem

      CALL nag_qp_sol(x,obj_f,prob_type='S',h=h,a=a,ax_lower=ax_lower, &
       ax_upper=ax_upper,c=c,x_lower=x_lower,x_upper=x_upper)

      DEALLOCATE (a,ax_lower,ax_upper,c,h,x,x_lower, &
       x_upper)                    ! Deallocate storage

    END PROGRAM nag_qp_ex03
