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

NAG FL Interface Introduction
Example description
    Program f08qffe

!     F08QFF Example Program Text

!     Mark 30.3 Release. nAG Copyright 2024.

!     .. Use Statements ..
      Use nag_library, Only: dtrexc, nag_wp, x04caf
!     .. Implicit None Statement ..
      Implicit None
!     .. Parameters ..
      Integer, Parameter               :: nin = 5, nout = 6
!     .. Local Scalars ..
      Integer                          :: i, ifail, ifst, ilst, info, ldq,     &
                                          ldt, n
!     .. Local Arrays ..
      Real (Kind=nag_wp), Allocatable  :: q(:,:), t(:,:), work(:)
!     .. Executable Statements ..
      Write (nout,*) 'F08QFF Example Program Results'
      Write (nout,*)
      Flush (nout)
!     Skip heading in data file
      Read (nin,*)
      Read (nin,*) n
      ldq = 1
      ldt = n
      Allocate (q(ldq,1),t(ldt,n),work(n))

!     Read T from data file

      Read (nin,*)(t(i,1:n),i=1,n)

!     Read the row indices

      Read (nin,*) ifst, ilst

!     Reorder the Schur factor T

!     The NAG name equivalent of dtrexc is f08qff
      Call dtrexc('No update',n,t,ldt,q,ldq,ifst,ilst,work,info)
      If (info>0) Then
        Write (nout,99999) info, ilst
        Write (nout,*)
        Flush (nout)
      End If

!     Print reordered Schur factor

!     ifail: behaviour on error exit
!             =0 for hard exit, =1 for quiet-soft, =-1 for noisy-soft
      ifail = 0
      Call x04caf('General',' ',n,n,t,ldt,'Reordered Schur form',ifail)

99999 Format (' Reordering could not be completed. INFO = ',I3,' ILST = ',I5)
    End Program f08qffe