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

NAG FL Interface Introduction
Example description
    Program f08lsfe

!     F08LSF Example Program Text

!     Mark 28.7 Release. NAG Copyright 2022.

!     .. Use Statements ..
      Use nag_library, Only: nag_wp, zgbbrd
!     .. Implicit None Statement ..
      Implicit None
!     .. Parameters ..
      Integer, Parameter               :: nin = 5, nout = 6
      Character (1), Parameter         :: vect = 'N'
!     .. Local Scalars ..
      Integer                          :: i, info, j, kl, ku, ldab, ldc, ldpt, &
                                          ldq, m, n, ncc
!     .. Local Arrays ..
      Complex (Kind=nag_wp), Allocatable :: ab(:,:), c(:,:), pt(:,:), q(:,:),  &
                                          work(:)
      Real (Kind=nag_wp), Allocatable  :: d(:), e(:), rwork(:)
!     .. Intrinsic Procedures ..
      Intrinsic                        :: max, min
!     .. Executable Statements ..
      Write (nout,*) 'F08LSF Example Program Results'
!     Skip heading in data file
      Read (nin,*)
      Read (nin,*) m, n, kl, ku, ncc
      ldab = kl + ku + 1
      ldc = m
      ldpt = n
      ldq = m
      Allocate (ab(ldab,n),c(m,ncc),pt(ldpt,n),q(ldq,m),work(m+n),d(n),e(n-1), &
        rwork(m+n))

!     Read A from data file

      Read (nin,*)((ab(ku+1+i-j,j),j=max(i-kl,1),min(i+ku,n)),i=1,m)

!     Reduce A to upper bidiagonal form

!     The NAG name equivalent of zgbbrd is f08lsf
      Call zgbbrd(vect,m,n,ncc,kl,ku,ab,ldab,d,e,q,ldq,pt,ldpt,c,ldc,work,     &
        rwork,info)

!     Print bidiagonal form

      Write (nout,*)
      Write (nout,*) 'Diagonal'
      Write (nout,99999) d(1:min(m,n))
      Write (nout,*) 'Superdiagonal'
      Write (nout,99999) e(1:min(m,n)-1)

99999 Format (1X,8F9.4)
    End Program f08lsfe