Program f04jgfe
! F04JGF Example Program Text
! Mark 30.1 Release. NAG Copyright 2024.
! .. Use Statements ..
Use nag_library, Only: f04jgf, nag_wp
! .. Implicit None Statement ..
Implicit None
! .. Parameters ..
Integer, Parameter :: nin = 5, nout = 6
! .. Local Scalars ..
Real (Kind=nag_wp) :: sigma, tol
Integer :: i, ifail, irank, lda, lwork, m, n
Logical :: svd
! .. Local Arrays ..
Real (Kind=nag_wp), Allocatable :: a(:,:), b(:), work(:)
! .. Executable Statements ..
Write (nout,*) 'F04JGF Example Program Results'
Write (nout,*)
! Skip heading in data file
Read (nin,*)
Read (nin,*) m, n
tol = 5.0E-4_nag_wp
lda = m
lwork = 4*n
Allocate (a(lda,n),b(m),work(lwork))
Read (nin,*)(a(i,1:n),i=1,m)
Read (nin,*) b(1:m)
! ifail: behaviour on error exit
! =0 for hard exit, =1 for quiet-soft, =-1 for noisy-soft
ifail = 0
Call f04jgf(m,n,a,lda,b,tol,svd,sigma,irank,work,lwork,ifail)
Write (nout,*) 'Solution vector'
Write (nout,99997) b(1:n)
Write (nout,*)
Write (nout,99999) 'Standard error = ', sigma, ' Rank = ', irank
Write (nout,*)
Write (nout,99998) 'SVD = ', svd
99999 Format (1X,A,F6.3,A,I2)
99998 Format (1X,A,L2)
99997 Format (1X,8F9.3)
End Program f04jgfe