Program f01rkfe
! F01RKF Example Program Text
! Mark 30.0 Release. NAG Copyright 2024.
! .. Use Statements ..
Use nag_library, Only: f01rjf, f01rkf, nag_wp
! .. Implicit None Statement ..
Implicit None
! .. Parameters ..
Integer, Parameter :: nin = 5, nout = 6
! .. Local Scalars ..
Integer :: i, ifail, lda, ldph, m, n, nrowp
! .. Local Arrays ..
Complex (Kind=nag_wp), Allocatable :: a(:,:), ph(:,:), theta(:), work(:)
! .. Intrinsic Procedures ..
Intrinsic :: conjg
! .. Executable Statements ..
Write (nout,*) 'F01RKF Example Program Results'
Write (nout,*)
! Skip heading in data file
Read (nin,*)
Read (nin,*) m, n
lda = m
ldph = n
Allocate (a(lda,n),ph(ldph,n),theta(n),work(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 f01rjf(m,n,a,lda,theta,ifail)
! Copy array A into PH and form the n by n matrix conjg(P')
ph(1:m,1:n) = a(1:m,1:n)
nrowp = n
ifail = 0
Call f01rkf('Separate',m,n,nrowp,ph,ldph,theta,work,ifail)
Write (nout,*) 'Matrix P'
Write (nout,99999)(conjg(ph(1:nrowp,i)),i=1,n)
99999 Format (5(' (',F6.3,',',F6.3,')',:))
End Program f01rkfe