* F07FNF Example Program Text * Mark 21 Release. NAG Copyright 2004. * .. Parameters .. INTEGER NIN, NOUT PARAMETER (NIN=5,NOUT=6) INTEGER NMAX PARAMETER (NMAX=8) INTEGER LDA PARAMETER (LDA=NMAX) * .. Local Scalars .. INTEGER I, IFAIL, INFO, J, N * .. Local Arrays .. COMPLEX *16 A(LDA,NMAX), B(NMAX) CHARACTER CLABS(1), RLABS(1) * .. External Subroutines .. EXTERNAL X04DBF, ZPOSV * .. Executable Statements .. WRITE (NOUT,*) 'F07FNF Example Program Results' WRITE (NOUT,*) * Skip heading in data file READ (NIN,*) READ (NIN,*) N IF (N.LE.NMAX) THEN * * Read the upper triangular part of A from data file * READ (NIN,*) ((A(I,J),J=I,N),I=1,N) * * Read b from data file * READ (NIN,*) (B(I),I=1,N) * * Solve the equations Ax = b for x * CALL ZPOSV('Upper',N,1,A,LDA,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 X04DBF('Upper','Non-unit diagonal',N,N,A,LDA, + 'Bracketed','F7.4','Cholesky factor U', + 'Integer',RLABS,'Integer',CLABS,80,0,IFAIL) * ELSE WRITE (NOUT,99998) 'The leading minor of order ', INFO, + ' is not positive definite' END IF ELSE WRITE (NOUT,*) 'NMAX too small' END IF STOP * 99999 FORMAT ((3X,4(' (',F7.4,',',F7.4,')',:))) 99998 FORMAT (1X,A,I3,A) END