NAG Library Manual, Mark 30.3
Interfaces:  FL   CL   CPP   AD 

NAG FL Interface Introduction
Example description
    Program f01qgfe

!     F01QGF Example Program Text

!     Mark 30.3 Release. nAG Copyright 2024.

!     .. Use Statements ..
      Use nag_library, Only: f01qgf, nag_wp, x04cbf
!     .. Implicit None Statement ..
      Implicit None
!     .. Parameters ..
      Integer, Parameter               :: indent = 0, ncols = 80, nin = 5,     &
                                          nout = 6
      Character (1), Parameter         :: diag = 'N', matrix = 'G',            &
                                          nolabel = 'N'
      Character (4), Parameter         :: form = 'F8.4'
!     .. Local Scalars ..
      Integer                          :: i, ifail, lda, m, n
      Character (63)                   :: title
!     .. Local Arrays ..
      Real (Kind=nag_wp), Allocatable  :: a(:,:), zeta(:)
      Character (1)                    :: dummy(1)
!     .. Executable Statements ..
      Write (nout,*) 'F01QGF Example Program Results'
      Write (nout,*)
!     Skip heading in data file
      Read (nin,*)
      Read (nin,*) m, n
      lda = m
      Allocate (a(lda,n),zeta(m))
      Read (nin,*)(a(i,1:n),i=1,m)

!     ifail: behaviour on error exit
!             =0 for hard exit, =1 for quiet-soft, =-1 for noisy-soft
      ifail = 0
!     Find the RQ factorization of A
      Call f01qgf(m,n,a,lda,zeta,ifail)

      Write (nout,*) 'RQ factorization of A'
      Write (nout,*)
      Write (nout,*) 'Vector ZETA'
      Write (nout,99999) zeta(1:m)
      Write (nout,*)
      Flush (nout)
      title =                                                                  &
        'Matrix A after factorization (R is in left-hand upper triangle)'
      ifail = 0
      Call x04cbf(matrix,diag,m,n,a,lda,form,title,nolabel,dummy,nolabel,      &
        dummy,ncols,indent,ifail)

99999 Format (5(1X,F8.4))
    End Program f01qgfe