Program f08qyfe
! F08QYF Example Program Text
! Mark 30.3 Release. nAG Copyright 2024.
! .. Use Statements ..
Use nag_library, Only: f06uaf, nag_wp, x02ajf, ztrevc, ztrsna
! .. Implicit None Statement ..
Implicit None
! .. Parameters ..
Integer, Parameter :: nin = 5, nout = 6
! .. Local Scalars ..
Real (Kind=nag_wp) :: eps, tnorm
Integer :: i, info, ldt, ldvl, ldvr, ldwork, m, &
n
! .. Local Arrays ..
Complex (Kind=nag_wp), Allocatable :: t(:,:), vl(:,:), vr(:,:), &
work(:,:)
Real (Kind=nag_wp), Allocatable :: rwork(:), s(:), sep(:)
Logical :: select(1)
! .. Executable Statements ..
Write (nout,*) 'F08QYF Example Program Results'
Write (nout,*)
! Skip heading in data file
Read (nin,*)
Read (nin,*) n
ldt = n
ldvl = n
ldvr = n
ldwork = n
Allocate (t(ldt,n),vl(ldvl,n),vr(ldvr,n),work(ldwork,n+1),rwork(n),s(n), &
sep(n))
! Read T from data file
Read (nin,*)(t(i,1:n),i=1,n)
! Calculate the left and right eigenvectors of T
! The NAG name equivalent of ztrevc is f08qxf
Call ztrevc('Both','All',select,n,t,ldt,vl,ldvl,vr,ldvr,n,m,work,rwork, &
info)
! Estimate condition numbers for all the eigenvalues and right
! eigenvectors of T
! The NAG name equivalent of ztrsna is f08qyf
Call ztrsna('Both','All',select,n,t,ldt,vl,ldvl,vr,ldvr,s,sep,n,m,work, &
ldwork,rwork,info)
! Print condition numbers of eigenvalues and right eigenvectors
Write (nout,*) 'S'
Write (nout,99999) s(1:m)
Write (nout,*)
Write (nout,*) 'SEP'
Write (nout,99999) sep(1:m)
! Calculate approximate error estimates (using the 1-norm)
eps = x02ajf()
tnorm = f06uaf('1-norm',n,n,t,ldt,rwork)
Write (nout,*)
Write (nout,*) 'Approximate error estimates for eigenvalues ', &
'of T (machine-dependent)'
Write (nout,99999)(eps*tnorm/s(i),i=1,m)
Write (nout,*)
Write (nout,*) 'Approximate error estimates for right ', &
'eigenvectors of T (machine-dependent)'
Write (nout,99999)(eps*tnorm/sep(i),i=1,m)
99999 Format ((3X,1P,7E11.1))
End Program f08qyfe