Program f01blfe
! F01BLF Example Program Text
! Mark 29.3 Release. NAG Copyright 2023.
! .. Use Statements ..
Use nag_library, Only: f01blf, f06raf, nag_wp, x02ajf, x04cbf
! .. Implicit None Statement ..
Implicit None
! .. Parameters ..
Integer, Parameter :: indent = 0, ncols = 80, nin = 5, &
nout = 6
Character (1), Parameter :: diag = 'N', matrix = 'G', &
nolabel = 'N'
Character (8), Parameter :: form = '1P,E12.4'
! .. Local Scalars ..
Real (Kind=nag_wp) :: anorm, t
Integer :: i, ifail, irank, lda, ldu, m, n
Character (9) :: norm
Character (27) :: title
! .. Local Arrays ..
Real (Kind=nag_wp), Allocatable :: a(:,:), aijmax(:), d(:), du(:), &
u(:,:)
Real (Kind=nag_wp) :: work(1)
Integer, Allocatable :: inc(:)
Character (1) :: dummy(1)
! .. Intrinsic Procedures ..
Intrinsic :: min
! .. Executable Statements ..
Write (nout,*) 'F01BLF Example Program Results'
Write (nout,*)
! Skip heading in data file
Read (nin,*)
Read (nin,*) m, n
lda = m
ldu = n
Allocate (a(lda,n),aijmax(n),d(m),du(n),u(ldu,n),inc(n))
Read (nin,*)(a(i,1:n),i=1,m)
! Set t = eps times norm of A.
norm = 'Frobenius'
anorm = f06raf(norm,m,n,a,lda,work)
t = anorm*x02ajf()
! ifail: behaviour on error exit
! =0 for hard exit, =1 for quiet-soft, =-1 for noisy-soft
ifail = 0
Call f01blf(m,n,t,a,lda,aijmax,irank,inc,d,u,ldu,du,ifail)
Write (nout,*) 'Maximum element in A(K) for I.GE.K and J.GE.K'
Write (nout,*)
Write (nout,*) ' K Modulus'
Write (nout,99999)(i,aijmax(i),i=1,min(n,irank+1))
Write (nout,*)
Write (nout,99998) 'Rank = ', irank
Write (nout,*)
Write (nout,99997) 'T = ', t, ' (machine dependent)'
Write (nout,*)
Flush (nout)
! Print the result matrix A.
title = 'Transpose of pseudo-inverse'
ifail = 0
Call x04cbf(matrix,diag,m,n,a,lda,form,title,nolabel,dummy,nolabel, &
dummy,ncols,indent,ifail)
99999 Format (1X,I4,2X,1P,E12.4)
99998 Format (1X,A,I5)
99997 Format (1X,A,1P,E11.4,A)
End Program f01blfe