Program f08kefe
! F08KEF Example Program Text
! Mark 26.1 Release. NAG Copyright 2016.
! .. Use Statements ..
Use nag_library, Only: dgebrd, nag_wp
! .. Implicit None Statement ..
Implicit None
! .. Parameters ..
Integer, Parameter :: nin = 5, nout = 6
! .. Local Scalars ..
Integer :: i, info, lda, lwork, m, n
! .. Local Arrays ..
Real (Kind=nag_wp), Allocatable :: a(:,:), d(:), e(:), taup(:), &
tauq(:), work(:)
! .. Intrinsic Procedures ..
Intrinsic :: min
! .. Executable Statements ..
Write (nout,*) 'F08KEF Example Program Results'
! Skip heading in data file
Read (nin,*)
Read (nin,*) m, n
lda = m
lwork = 64*(m+n)
Allocate (a(lda,n),d(n),e(n-1),taup(n),tauq(n),work(lwork))
! Read A from data file
Read (nin,*)(a(i,1:n),i=1,m)
! Reduce A to bidiagonal form
! The NAG name equivalent of dgebrd is f08kef
Call dgebrd(m,n,a,lda,d,e,tauq,taup,work,lwork,info)
! Print bidiagonal form
Write (nout,*)
Write (nout,*) 'Diagonal'
Write (nout,99999) d(1:min(m,n))
If (m>=n) Then
Write (nout,*) 'Superdiagonal'
Else
Write (nout,*) 'Subdiagonal'
End If
Write (nout,99999) e(1:min(m,n)-1)
99999 Format (1X,8F9.4)
End Program f08kefe