Program f07ftfe ! F07FTF Example Program Text ! Mark 24 Release. NAG Copyright 2012. ! .. Use Statements .. Use nag_library, Only: f06kcf, nag_wp, x02ajf, x02amf, x02bhf, x04dbf, & zdscal, zpoequ ! .. Implicit None Statement .. Implicit None ! .. Parameters .. Real (Kind=nag_wp), Parameter :: one = 1.0_nag_wp Real (Kind=nag_wp), Parameter :: thresh = 0.1_nag_wp Integer, Parameter :: nin = 5, nout = 6 ! .. Local Scalars .. Real (Kind=nag_wp) :: amax, big, scond, small Integer :: i, ifail, info, j, lda, n ! .. Local Arrays .. Complex (Kind=nag_wp), Allocatable :: a(:,:) Real (Kind=nag_wp), Allocatable :: s(:) Character (1) :: clabs(1), rlabs(1) ! .. Intrinsic Procedures .. Intrinsic :: real ! .. Executable Statements .. Write (nout,*) 'F07FTF Example Program Results' Write (nout,*) Flush (nout) ! Skip heading in data file Read (nin,*) Read (nin,*) n lda = n Allocate (a(lda,n),s(n)) ! Read the upper triangular part of the matrix A from data file Read (nin,*)(a(i,i:n),i=1,n) ! Print the matrix A ! ifail: behaviour on error exit ! =0 for hard exit, =1 for quiet-soft, =-1 for noisy-soft ifail = 0 Call x04dbf('Upper','Non-unit',n,n,a,lda,'Bracketed','1P,E10.2', & 'Matrix A','Integer',rlabs,'Integer',clabs,80,0,ifail) Write (nout,*) ! Compute diagonal scaling factors ! The NAG name equivalent of zpoequ is f07ftf Call zpoequ(n,a,lda,s,scond,amax,info) If (info>0) Then Write (nout,99999) 'Diagonal element', info, ' of A is non positive' Else ! Print SCOND, AMAX and the scale factors Write (nout,99998) 'SCOND =', scond, ', AMAX =', amax Write (nout,*) Write (nout,*) 'Diagonal scaling factors' Write (nout,99997) s(1:n) Write (nout,*) Flush (nout) ! Compute values close to underflow and overflow small = x02amf()/(x02ajf()*real(x02bhf(),kind=nag_wp)) big = one/small If ((scondbig)) Then ! Scale A ! The NAG name equivalent of zdscal is f06jdf Do j = 1, n Call zdscal(j,s(j),a(1,j),1) Call f06kcf(j,s,1,a(1,j),1) End Do ! Print the scaled matrix ifail = 0 Call x04dbf('Upper','Non-unit',n,n,a,lda,'Bracketed','F8.4', & 'Scaled matrix','Integer',rlabs,'Integer',clabs,80,0,ifail) End If End If 99999 Format (1X,A,I4,A) 99998 Format (1X,2(A,1P,E8.1)) 99997 Format ((1X,1P,7E11.1)) End Program f07ftfe