PROGRAM f07bufe ! F07BUF Example Program Text ! Mark 23 Release. NAG Copyright 2011. ! .. Use Statements .. USE nag_library, ONLY : nag_wp, x02ajf, zgbcon, zgbtrf, zlangb => f06ubf ! .. 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, j, k, kl, ku, ldab, n ! .. Local Arrays .. COMPLEX (KIND=nag_wp), ALLOCATABLE :: ab(:,:), work(:) REAL (KIND=nag_wp), ALLOCATABLE :: rwork(:) INTEGER, ALLOCATABLE :: ipiv(:) ! .. Intrinsic Functions .. INTRINSIC max, min ! .. Executable Statements .. WRITE (nout,*) 'F07BUF Example Program Results' ! Skip heading in data file READ (nin,*) READ (nin,*) n, kl, ku ldab = 2*kl + ku + 1 ALLOCATE (ab(ldab,n),work(2*n),rwork(n),ipiv(n)) ! Read A from data file k = kl + ku + 1 READ (nin,*) ((ab(k+i-j,j),j=max(i-kl,1),min(i+ku,n)),i=1,n) ! f06ubf is the NAG name equivalent of the LAPACK auxiliary zlangb anorm = zlangb(norm,n,kl,ku,ab(kl+1,1),ldab,rwork) ! Factorize A ! The NAG name equivalent of zgbtrf is f07brf CALL zgbtrf(n,n,kl,ku,ab,ldab,ipiv,info) WRITE (nout,*) IF (info==0) THEN ! Estimate condition number ! The NAG name equivalent of zgbcon is f07buf CALL zgbcon(norm,n,kl,ku,ab,ldab,ipiv,anorm,rcond,work,rwork,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 f07bufe