* F07BNF Example Program Text * Mark 21 Release. NAG Copyright 2004. * .. Parameters .. INTEGER NIN, NOUT PARAMETER (NIN=5,NOUT=6) INTEGER NMAX, KLMAX, KUMAX PARAMETER (NMAX=8,KLMAX=4,KUMAX=4) INTEGER LDAB PARAMETER (LDAB=2*KLMAX+KUMAX+1) * .. Local Scalars .. INTEGER I, IFAIL, INFO, J, K, KL, KU, N * .. Local Arrays .. COMPLEX *16 AB(LDAB,NMAX), B(NMAX) INTEGER IPIV(NMAX) CHARACTER CLABS(1), RLABS(1) * .. External Subroutines .. EXTERNAL X04DFF, ZGBSV * .. Intrinsic Functions .. INTRINSIC MAX, MIN * .. Executable Statements .. WRITE (NOUT,*) 'F07BNF Example Program Results' WRITE (NOUT,*) * Skip heading in data file READ (NIN,*) READ (NIN,*) N, KL, KU IF (N.LE.NMAX .AND. KL.LE.KLMAX .AND. KU.LE.KUMAX) THEN * * Read the band matrix A and the right hand side b 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) READ (NIN,*) (B(I),I=1,N) * * Solve the equations Ax = b for x * CALL ZGBSV(N,KL,KU,1,AB,LDAB,IPIV,B,N,INFO) * IF (INFO.EQ.0) THEN * * Print solution * WRITE (NOUT,*) 'Solution' WRITE (NOUT,99999) (B(I),I=1,N) * * Print details of the factorization * WRITE (NOUT,*) IFAIL = 0 CALL X04DFF(N,N,KL,KL+KU,AB,LDAB,'Bracketed','F7.4', + 'Details of factorization','None',RLABS,'None', + CLABS,80,0,IFAIL) * * Print pivot indices' * WRITE (NOUT,*) WRITE (NOUT,*) 'Pivot indices' WRITE (NOUT,99998) (IPIV(I),I=1,N) * ELSE WRITE (NOUT,99997) 'The (', INFO, ',', INFO, ')', + ' element of the factor U is zero' END IF ELSE WRITE (NOUT,*) + 'One or more of NMAX, KLMAX or KUMAX is too small' END IF * 99999 FORMAT ((3X,4(' (',F7.4,',',F7.4,')',:))) 99998 FORMAT (1X,I5,3I18) 99997 FORMAT (1X,A,I3,A,I3,A,A) END