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

NAG FL Interface Introduction
Example description
    Program f01qkfe

!     F01QKF Example Program Text

!     Mark 30.3 Release. nAG Copyright 2024.

!     .. Use Statements ..
      Use nag_library, Only: f01qjf, f01qkf, nag_wp
!     .. Implicit None Statement ..
      Implicit None
!     .. Parameters ..
      Integer, Parameter               :: nin = 5, nout = 6
!     .. Local Scalars ..
      Integer                          :: i, ifail, lda, ldpt, m, n, nrowp
!     .. Local Arrays ..
      Real (Kind=nag_wp), Allocatable  :: a(:,:), pt(:,:), work(:), zeta(:)
!     .. Executable Statements ..
      Write (nout,*) 'F01QKF Example Program Results'
      Write (nout,*)
!     Skip heading in data file
      Read (nin,*)
      Read (nin,*) m, n
      lda = m
      ldpt = n
      Allocate (a(lda,n),pt(ldpt,n),work(n),zeta(n))
      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 f01qjf(m,n,a,lda,zeta,ifail)

!     Copy array A into PT and form the n by n matrix conjg(P')
      pt(1:m,1:n) = a(1:m,1:n)
      nrowp = n

      ifail = 0
      Call f01qkf('Separate',m,n,nrowp,pt,ldpt,zeta,work,ifail)

      Write (nout,*) 'Matrix  P'
      Write (nout,99999) pt(1:nrowp,1:n)

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