Program f08ke_p0w_fe
! F08KE_P0W_F Example Program Text
! Mark 30.1 Release. NAG Copyright 2024.
! .. Use Statements ..
Use iso_c_binding, Only: c_ptr
Use nagad_library, Only: f08ke_p0w_f
Use nag_library, Only: nag_wp
! .. Implicit None Statement ..
Implicit None
! .. Parameters ..
Integer, Parameter :: nin = 5, nout = 6
! .. Local Scalars ..
Type (c_ptr) :: ad_handle
Integer :: i, ifail, 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,*) 'F08KE_P0W_F 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
ifail = 0
Call f08ke_p0w_f(ad_handle,m,n,a,lda,d,e,tauq,taup,work,lwork,ifail)
! 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 f08ke_p0w_fe