Program f01kafe
! F01KAF Example Program Text
! Mark 30.1 Release. NAG Copyright 2024.
! .. Use Statements ..
Use nag_library, Only: f01kaf, nag_wp, x02ajf, x04daf
! .. Implicit None Statement ..
Implicit None
! .. Parameters ..
Integer, Parameter :: nin = 5, nout = 6
! .. Local Scalars ..
Real (Kind=nag_wp) :: conda, cond_rel, eps, norma, normfa
Integer :: i, ifail, lda, n
Character (4) :: fun
! .. Local Arrays ..
Complex (Kind=nag_wp), Allocatable :: a(:,:)
! .. Executable Statements ..
Write (nout,*) 'F01KAF Example Program Results'
Write (nout,*)
Flush (nout)
! Skip heading in data file
Read (nin,*)
Read (nin,*) n, fun
lda = n
Allocate (a(lda,n))
! Read A from data file
Read (nin,*)(a(i,1:n),i=1,n)
! Display A
ifail = 0
Call x04daf('G','N',n,n,a,lda,'A',ifail)
! Find absolute condition number estimate
ifail = 0
Call f01kaf(fun,n,a,lda,conda,norma,normfa,ifail)
If (ifail==0) Then
! Print solution
Write (nout,*)
Write (nout,*) 'F(A) = ', fun, '(A)'
Write (nout,99999) 'Estimated absolute condition number is: ', conda
! Find relative condition number estimate
eps = x02ajf()
If (normfa>eps) Then
cond_rel = conda*norma/normfa
Write (nout,99999) 'Estimated relative condition number is: ', &
cond_rel
Else
Write (nout,99998) 'The estimated norm of f(A) is effectively zero', &
'and so the relative condition number is undefined.'
End If
End If
99999 Format (1X,A,F6.2)
99998 Format (/,1X,A,/,1X,A)
End Program f01kafe