NAG Library Manual, Mark 30.3
Interfaces:  FL   CL   CPP   AD 

NAG FL Interface Introduction
Example description
    Program f02gcfe

!     F02GCF Example Program Text

!     Mark 30.3 Release. nAG Copyright 2024.

!     .. Use Statements ..
      Use nag_library, Only: f02gcf, 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, lda, ldv, lwork, m, mest,  &
                                          n
!     .. Local Arrays ..
      Complex (Kind=nag_wp), Allocatable :: a(:,:), v(:,:), w(:), work(:)
      Real (Kind=nag_wp), Allocatable  :: rwork(:)
      Integer, Allocatable             :: iwork(:)
      Logical, Allocatable             :: bwork(:)
      Character (1)                    :: clabs(1), rlabs(1)
!     .. Executable Statements ..
      Write (nout,*) 'F02GCF Example Program Results'
!     Skip heading in data file
      Read (nin,*)
      Read (nin,*) n, mest, wl, wu
      lda = n
      ldv = n
      lwork = 64*n
      Allocate (a(lda,n),v(ldv,n),w(n),work(lwork),rwork(2*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 f02gcf('Moduli',n,a,lda,wl,wu,mest,m,w,v,ldv,work,lwork,rwork,      &
        iwork,bwork,ifail)

      Write (nout,*)
      Write (nout,*) 'Eigenvalues'
      Write (nout,99999) w(1:m)
      Write (nout,*)
      Flush (nout)
      ifail = 0
      Call x04dbf('General',' ',n,m,v,ldv,'Bracketed','F7.4','Eigenvectors',   &
        'Integer',rlabs,'Integer',clabs,80,0,ifail)

99999 Format ((3X,4(' (',F7.4,',',F7.4,')',:)))
    End Program f02gcfe