* F07PNF Example Program Text * Mark 21 Release. NAG Copyright 2004. * .. Parameters .. INTEGER NIN, NOUT PARAMETER (NIN=5,NOUT=6) INTEGER NMAX PARAMETER (NMAX=8) CHARACTER UPLO PARAMETER (UPLO='U') * .. Local Scalars .. INTEGER I, IFAIL, INFO, J, N * .. Local Arrays .. COMPLEX *16 AP((NMAX*(NMAX+1))/2), B(NMAX) INTEGER IPIV(NMAX) CHARACTER CLABS(1), RLABS(1) * .. External Subroutines .. EXTERNAL X04DDF, ZHPSV * .. Executable Statements .. WRITE (NOUT,*) 'F07PNF Example Program Results' WRITE (NOUT,*) * Skip heading in data file READ (NIN,*) READ (NIN,*) N IF (N.LE.NMAX) THEN * * Read the upper or lower triangular part of the matrix A from * data file * IF (UPLO.EQ.'U') THEN READ (NIN,*) ((AP(I+(J*(J-1))/2),J=I,N),I=1,N) ELSE IF (UPLO.EQ.'L') THEN READ (NIN,*) ((AP(I+((2*N-J)*(J-1))/2),J=1,I),I=1,N) END IF * * Read b from data file * READ (NIN,*) (B(I),I=1,N) * * Solve the equations Ax = b for x * CALL ZHPSV(UPLO,N,1,AP,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 factorization * WRITE (NOUT,*) IFAIL = 0 CALL X04DDF(UPLO,'Non-unit diagonal',N,AP,'Bracketed', + 'F7.4','Details of factorization','Integer', + RLABS,'Integer',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 diagonal block ', INFO, + ' of D is zero' END IF ELSE WRITE (NOUT,*) 'NMAX too small' END IF STOP * 99999 FORMAT ((3X,4(' (',F7.4,',',F7.4,')',:))) 99998 FORMAT (1X,7I11) 99997 FORMAT (1X,A,I3,A) END