Program f02ecfe
! F02ECF Example Program Text
! Mark 27.3 Release. NAG Copyright 2021.
! .. Use Statements ..
Use nag_library, Only: f02ecf, nag_wp, x04dbf
! .. Implicit None Statement ..
Implicit None
! .. Parameters ..
Integer, Parameter :: nin = 5, nout = 6
! .. Local Scalars ..
Real (Kind=nag_wp) :: wl, wu
Integer :: i, ifail, j, lda, ldv, ldvi, ldvr, &
lwork, m, mest, n
! .. Local Arrays ..
Complex (Kind=nag_wp), Allocatable :: v(:,:)
Real (Kind=nag_wp), Allocatable :: a(:,:), vi(:,:), vr(:,:), wi(:), &
work(:), wr(:)
Integer, Allocatable :: iwork(:)
Logical, Allocatable :: bwork(:)
Character (1) :: clabs(1), rlabs(1)
! .. Intrinsic Procedures ..
Intrinsic :: cmplx
! .. Executable Statements ..
Write (nout,*) 'F02ECF Example Program Results'
! Skip heading in data file
Read (nin,*)
Read (nin,*) n, mest, wl, wu
lda = n
ldv = n
ldvi = n
ldvr = n
lwork = 64*n
Allocate (v(ldv,n),a(lda,n),vi(ldvi,mest),vr(ldvr,mest),wi(n), &
work(lwork),wr(n),iwork(n),bwork(n))
! Read A from data file
Read (nin,*)(a(i,1:n),i=1,n)
! Compute selected eigenvalues and eigenvectors of A
! ifail: behaviour on error exit
! =0 for hard exit, =1 for quiet-soft, =-1 for noisy-soft
ifail = 0
Call f02ecf('Moduli',n,a,lda,wl,wu,mest,m,wr,wi,vr,ldvr,vi,ldvi,work, &
lwork,iwork,bwork,ifail)
Write (nout,*)
Write (nout,*) 'Eigenvalues'
Write (nout,99999)(' (',wr(i),',',wi(i),')',i=1,m)
Write (nout,*)
Flush (nout)
Do j = 1, m
Do i = 1, n
v(i,j) = cmplx(vr(i,j),vi(i,j),kind=nag_wp)
End Do
End Do
ifail = 0
Call x04dbf('General',' ',n,m,v,ldv,'Bracketed','F7.4','Eigenvectors', &
'Integer',rlabs,'Integer',clabs,80,0,ifail)
99999 Format ((3X,4(A,F7.4,A,F7.4,A,:)))
End Program f02ecfe