PROGRAM f08qyfe ! F08QYF Example Program Text ! Mark 23 Release. NAG Copyright 2011. ! .. 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