PROGRAM f08kefe ! F08KEF Example Program Text ! Mark 23 Release. NAG Copyright 2011. ! .. 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 Functions .. 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,*) 'Super-diagonal' ELSE WRITE (nout,*) 'Sub-diagonal' END IF WRITE (nout,99999) e(1:min(m,n)-1) 99999 FORMAT (1X,8F9.4) END PROGRAM f08kefe