PROGRAM f07hgfe ! F07HGF Example Program Text ! Mark 23 Release. NAG Copyright 2011. ! .. Use Statements .. USE nag_library, ONLY : dlansb => f06ref, dpbcon, dpbtrf, nag_wp, x02ajf ! .. Implicit None Statement .. IMPLICIT NONE ! .. Parameters .. INTEGER, PARAMETER :: nin = 5, nout = 6 ! .. Local Scalars .. REAL (KIND=nag_wp) :: anorm, rcond INTEGER :: i, info, j, kd, ldab, n CHARACTER (1) :: uplo ! .. Local Arrays .. REAL (KIND=nag_wp), ALLOCATABLE :: ab(:,:), work(:) INTEGER, ALLOCATABLE :: iwork(:) ! .. Intrinsic Functions .. INTRINSIC max, min ! .. Executable Statements .. WRITE (nout,*) 'F07HGF Example Program Results' ! Skip heading in data file READ (nin,*) READ (nin,*) n, kd ldab = kd + 1 ALLOCATE (ab(ldab,n),work(3*n),iwork(n)) ! Read A from data file READ (nin,*) uplo IF (uplo=='U') THEN DO i = 1, n READ (nin,*) (ab(kd+1+i-j,j),j=i,min(n,i+kd)) END DO ELSE IF (uplo=='L') THEN DO i = 1, n READ (nin,*) (ab(1+i-j,j),j=max(1,i-kd),i) END DO END IF ! Compute norm of A ! f06ref is the NAG name equivalent of the LAPACK auxiliary dlansb anorm = dlansb('1-norm',uplo,n,kd,ab,ldab,work) ! Factorize A ! The NAG name equivalent of dpbtrf is f07hdf CALL dpbtrf(uplo,n,kd,ab,ldab,info) WRITE (nout,*) IF (info==0) THEN ! Estimate condition number ! The NAG name equivalent of dpbcon is f07hgf CALL dpbcon(uplo,n,kd,ab,ldab,anorm,rcond,work,iwork,info) IF (rcond>=x02ajf()) THEN WRITE (nout,99999) 'Estimate of condition number =', & 1.0_nag_wp/rcond ELSE WRITE (nout,*) 'A is singular to working precision' END IF ELSE WRITE (nout,*) 'A is not positive definite' END IF 99999 FORMAT (1X,A,1P,E10.2) END PROGRAM f07hgfe