Program f07arfe
! F07ARF Example Program Text
! Mark 27.3 Release. NAG Copyright 2021.
! .. Use Statements ..
Use nag_library, Only: nag_wp, x04dbf, zgetrf
! .. Implicit None Statement ..
Implicit None
! .. Parameters ..
Integer, Parameter :: nin = 5, nout = 6
! .. Local Scalars ..
Integer :: i, ifail, info, lda, m, n
! .. Local Arrays ..
Complex (Kind=nag_wp), Allocatable :: a(:,:)
Integer, Allocatable :: ipiv(:)
Character (1) :: clabs(1), rlabs(1)
! .. Intrinsic Procedures ..
Intrinsic :: min
! .. Executable Statements ..
Write (nout,*) 'F07ARF Example Program Results'
! Skip heading in data file
Read (nin,*)
Read (nin,*) m, n
lda = m
Allocate (a(lda,n),ipiv(n))
! Read A from data file
Read (nin,*)(a(i,1:n),i=1,m)
! Factorize A
! The NAG name equivalent of zgetrf is f07arf
Call zgetrf(m,n,a,lda,ipiv,info)
! Print details of factorization
Write (nout,*)
Flush (nout)
! ifail: behaviour on error exit
! =0 for hard exit, =1 for quiet-soft, =-1 for noisy-soft
ifail = 0
Call x04dbf('General',' ',m,n,a,lda,'Bracketed','F7.4', &
'Details of factorization','Integer',rlabs,'Integer',clabs,80,0,ifail)
! Print pivot indices
Write (nout,*)
Write (nout,*) 'IPIV'
Write (nout,99999) ipiv(1:min(m,n))
If (info/=0) Then
Write (nout,*) 'The factor U is singular'
End If
99999 Format ((1X,I12,3I18))
End Program f07arfe