Program f04yafe
! F04YAF Example Program Text
! Mark 29.2 Release. NAG Copyright 2023.
! .. Use Statements ..
Use nag_library, Only: f04jgf, f04yaf, 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, job, lda, lwork, n, &
p
Logical :: svd
! .. Local Arrays ..
Real (Kind=nag_wp), Allocatable :: a(:,:), cj(:), work(:), y(:)
! .. Executable Statements ..
Write (nout,*) 'F04YAF Example Program Results'
! Skip heading in data file
Read (nin,*)
Read (nin,*) n, p
lda = n
lwork = 4*p
Allocate (a(lda,p),cj(p),work(lwork),y(n))
tol = 5.0E-4_nag_wp
Read (nin,*)(a(i,1:p),i=1,n)
Read (nin,*) y(1:n)
! ifail: behaviour on error exit
! =0 for hard exit, =1 for quiet-soft, =-1 for noisy-soft
ifail = 0
Call f04jgf(n,p,a,lda,y,tol,svd,sigma,irank,work,lwork,ifail)
Write (nout,*)
Write (nout,99999) 'SIGMA =', sigma, ' Rank =', irank, ' SVD =', svd
Write (nout,*)
Write (nout,*) 'Solution vector'
Write (nout,99998) y(1:p)
job = 0
ifail = 0
Call f04yaf(job,p,sigma,a,lda,svd,irank,work,cj,work(p+1),ifail)
Write (nout,*)
Write (nout,*) 'Estimated variances of regression coefficients'
Write (nout,99998) cj(1:p)
99999 Format (1X,A,F9.4,A,I3,A,L3)
99998 Format (1X,7F9.4)
End Program f04yafe