PROGRAM f07agfe ! F07AGF Example Program Text ! Mark 23 Release. NAG Copyright 2011. ! .. Use Statements .. USE nag_library, ONLY : dgecon, dgetrf, dlange => f06raf, nag_wp, x02ajf ! .. Implicit None Statement .. IMPLICIT NONE ! .. Parameters .. INTEGER, PARAMETER :: nin = 5, nout = 6 CHARACTER (1), PARAMETER :: norm = '1' ! .. Local Scalars .. REAL (KIND=nag_wp) :: anorm, rcond INTEGER :: i, info, lda, n ! .. Local Arrays .. REAL (KIND=nag_wp), ALLOCATABLE :: a(:,:), work(:) INTEGER, ALLOCATABLE :: ipiv(:), iwork(:) ! .. Executable Statements .. WRITE (nout,*) 'F07AGF Example Program Results' ! Skip heading in data file READ (nin,*) READ (nin,*) n lda = n ALLOCATE (a(lda,n),work(4*n),ipiv(n),iwork(n)) ! Read A from data file READ (nin,*) (a(i,1:n),i=1,n) ! Compute norm of A ! f06raf is the NAG name equivalent of the LAPACK auxiliary dlange anorm = dlange(norm,n,n,a,lda,work) ! Factorize A ! The NAG name equivalent of dgetrf is f07adf CALL dgetrf(n,n,a,lda,ipiv,info) WRITE (nout,*) IF (info==0) THEN ! Estimate condition number ! The NAG name equivalent of dgecon is f07agf CALL dgecon(norm,n,a,lda,anorm,rcond,work,iwork,info) IF (rcond>=x02ajf()) THEN WRITE (nout,99999) 'Estimate of condition number =', & 1.0E0_nag_wp/rcond ELSE WRITE (nout,*) 'A is singular to working precision' END IF ELSE WRITE (nout,*) 'The factor U is singular' END IF 99999 FORMAT (1X,A,1P,E10.2) END PROGRAM f07agfe