    Program f04abfe

!     F04ABF Example Program Text

!     Mark 24 Release. NAG Copyright 2012.

!     .. Use Statements ..
      Use nag_library, Only: f04abf, nag_wp
!     .. Implicit None Statement ..
      Implicit None
!     .. Parameters ..
      Integer, Parameter               :: nin = 5, nout = 6
!     .. Local Scalars ..
      Integer                          :: i, ifail, lda, ldb, ldbb, ldc, m, n
!     .. Local Arrays ..
      Real (Kind=nag_wp), Allocatable  :: a(:,:), b(:,:), bb(:,:), c(:,:),     &
                                          wkspce(:)
!     .. Executable Statements ..
      Write (nout,*) 'F04ABF Example Program Results'
      Write (nout,*)
!     Skip heading in data file
      Read (nin,*)
      Read (nin,*) n, m
      lda = n
      ldb = n
      ldbb = n
      ldc = n
      Allocate (a(lda,n),b(ldb,m),bb(ldbb,m),c(ldc,m),wkspce(n))
      Read (nin,*)(a(i,1:n),i=1,n), (b(i,1:m),i=1,n)

!     ifail: behaviour on error exit
!             =0 for hard exit, =1 for quiet-soft, =-1 for noisy-soft
      ifail = 0
      Call f04abf(a,lda,b,ldb,n,m,c,ldc,wkspce,bb,ldbb,ifail)

      Write (nout,*) ' Solution'
      Write (nout,99999)(c(i,1:m),i=1,n)

99999 Format (1X,F9.4)
    End Program f04abfe
